Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions jest.config.js

This file was deleted.

8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"build": "tsc && ncc build lib/main.js && sed -i 's/\\x0D$//' ./dist/index.js",
"format": "prettier --write \"**/*.ts\"",
"format-check": "prettier --check \"**/*.ts\"",
"test": "NODE_OPTIONS='--experimental-vm-modules' jest",
"test": "vitest run",
"readme": "npx action-docs -u && prettier --write README.md"
},
"repository": {
Expand All @@ -26,15 +26,13 @@
"shellwords-ts": "^3.0.1"
},
"devDependencies": {
"@types/jest": "^30.0.0",
"@types/js-yaml": "^4.0.9",
"@types/node": "^24.13.3",
"@vercel/ncc": "^0.44.1",
"action-docs": "^2.5.1",
"jest": "^30.4.2",
"prettier": "^3.9.6",
"ts-jest": "^29.4.12",
"ts-node": "^10.9.2",
"typescript": "^7.0.2"
"typescript": "^7.0.2",
"vitest": "^4.1.10"
}
}
2 changes: 1 addition & 1 deletion src/dirty-files.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jest } from "@jest/globals";
import { describe, expect, test } from "vitest";

import { parseGitStatus, isInterestingFile } from "./dirty-files.js";

Expand Down
2 changes: 1 addition & 1 deletion src/envsubst.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jest } from "@jest/globals";
import { describe, expect, test } from "vitest";

import { envsubst } from "./envsubst.js";

Expand Down
2 changes: 1 addition & 1 deletion src/get-cache-keys.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jest } from "@jest/globals";
import { expect, test } from "vitest";

import { getCacheKeys } from "./get-cache-keys.js";

Expand Down
2 changes: 1 addition & 1 deletion src/parse-stack-path.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jest } from "@jest/globals";
import { expect, test } from "vitest";

import { parseStackPath } from "./parse-stack-path.js";

Expand Down
2 changes: 1 addition & 1 deletion src/parse-stack-query.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jest } from "@jest/globals";
import { expect, test } from "vitest";

import { parseStackQuery } from "./parse-stack-query.js";

Expand Down
4 changes: 2 additions & 2 deletions src/stack-cli.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ExecOptions } from "@actions/exec";
import { jest } from "@jest/globals";
import { describe, expect, test, vi } from "vitest";

import { ExecDelegate, StackCLI } from "./stack-cli.js";

const exec: ExecDelegate = {
exec: jest.fn((command: string, args: string[], options?: ExecOptions) =>
exec: vi.fn((command: string, args: string[], options?: ExecOptions) =>
Promise.resolve(0),
),
};
Expand Down
10 changes: 5 additions & 5 deletions src/stack-yaml.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jest } from "@jest/globals";
import { describe, expect, test, vi } from "vitest";

import { parseStackYaml, getStackDirectories } from "./stack-yaml.js";
import { StackCLI } from "./stack-cli.js";
Expand All @@ -13,9 +13,8 @@ programs: ${testPrograms}
function mockStackCLI(): StackCLI {
const stack = new StackCLI([]);

jest
.spyOn(stack, "read")
.mockImplementation((args: string[]): Promise<string> => {
vi.spyOn(stack, "read").mockImplementation(
(args: string[]): Promise<string> => {
// Stringify to avoid array-comparison pitfalls
const expected = ["path", "--stack-root", "--programs"].toString();
const given = args.toString();
Expand All @@ -27,7 +26,8 @@ function mockStackCLI(): StackCLI {
}

return Promise.resolve(testStackPathYaml);
});
},
);

return stack;
}
Expand Down
8 changes: 4 additions & 4 deletions src/with-cache.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as core from "@actions/core";
import { jest } from "@jest/globals";
import { expect, test, vi } from "vitest";

import { getCacheKeys } from "./get-cache-keys.js";
import {
Expand All @@ -9,11 +9,11 @@ import {
} from "./with-cache.js";

const cache: CacheDelegate = {
restoreCache: jest.fn(() => Promise.resolve("")),
saveCache: jest.fn(() => Promise.resolve(0)),
restoreCache: vi.fn(() => Promise.resolve("")),
saveCache: vi.fn(() => Promise.resolve(0)),
};

const restoreCacheMock = jest.spyOn(cache, "restoreCache");
const restoreCacheMock = vi.spyOn(cache, "restoreCache");

async function testFunction(): Promise<number> {
return 42;
Expand Down
8 changes: 8 additions & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
environment: "node",
mockReset: true,
},
});
Loading
Loading