Skip to content

Commit 7ad1857

Browse files
authored
Merge pull request #982 from crazy-max/vitest
switch from Jest to Vitest
2 parents c3c1213 + 0973a1a commit 7ad1857

63 files changed

Lines changed: 2126 additions & 4183 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
-
4949
name: Check coverage
5050
run: |
51-
if [ -f ./coverage/clover.xml ] && [ ! -f ./coverage/allSkipped.txt ]; then
51+
if [ -f ./coverage/clover.xml ]; then
5252
echo "RUN_CODECOV=true" >> $GITHUB_ENV
5353
else
5454
echo "RUN_CODECOV=false" >> $GITHUB_ENV
@@ -206,7 +206,7 @@ jobs:
206206
if (testName) {
207207
args.push(`--testNamePattern=^${testName} `);
208208
}
209-
args.push(`--runTestsByPath`, `__tests__/${{ matrix.test }}`, `--coverageDirectory=./coverage`);
209+
args.push(`__tests__/${{ matrix.test }}`, `--coverage.reportsDirectory=./coverage`);
210210
await exec.exec('yarn', args);
211211
env:
212212
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -218,7 +218,7 @@ jobs:
218218
-
219219
name: Check coverage
220220
run: |
221-
if [ -f ./coverage/clover.xml ] && [ ! -f ./coverage/allSkipped.txt ]; then
221+
if [ -f ./coverage/clover.xml ]; then
222222
echo "RUN_CODECOV=true" >> $GITHUB_ENV
223223
else
224224
echo "RUN_CODECOV=false" >> $GITHUB_ENV

.gitignore

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,6 @@ jspm_packages/
3838
# Yarn Integrity file
3939
.yarn-integrity
4040

41-
# dotenv environment variable files
42-
.env
43-
.env.development.local
44-
.env.test.local
45-
.env.production.local
46-
.env.local
47-
4841
# yarn v2
4942
.yarn/cache
5043
.yarn/unplugged

__mocks__/@actions/github.ts

Lines changed: 0 additions & 224 deletions
This file was deleted.

__tests__/.helpers/os.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@
1414
* limitations under the License.
1515
*/
1616

17-
import {jest} from '@jest/globals';
17+
import {vi} from 'vitest';
1818
import os from 'os';
1919

2020
export const mockPlatform = (platform: NodeJS.Platform) => {
21-
return jest.spyOn(os, 'platform').mockImplementation(() => platform);
21+
return vi.spyOn(os, 'platform').mockImplementation(() => platform);
2222
};
2323

2424
export const mockArch = (arch: string) => {
25-
return jest.spyOn(os, 'arch').mockImplementation(() => arch);
25+
return vi.spyOn(os, 'arch').mockImplementation(() => arch);
2626
};
2727

2828
export const mockHomedir = (dir: string) => {
29-
return jest.spyOn(os, 'homedir').mockImplementation(() => dir);
29+
return vi.spyOn(os, 'homedir').mockImplementation(() => dir);
3030
};
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/**
2+
* Copyright 2026 actions-toolkit authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
import fs from 'node:fs';
18+
import path from 'node:path';
19+
20+
const testsRoot = path.resolve('__tests__');
21+
const results = [];
22+
23+
const walk = dir => {
24+
for (const entry of fs.readdirSync(dir, {withFileTypes: true})) {
25+
const fullPath = path.join(dir, entry.name);
26+
if (entry.isDirectory()) {
27+
walk(fullPath);
28+
continue;
29+
}
30+
if (entry.isFile() && entry.name.endsWith('.test.itg.ts')) {
31+
results.push(fullPath.replaceAll(path.sep, '/'));
32+
}
33+
}
34+
};
35+
36+
walk(testsRoot);
37+
results.sort((a, b) => a.localeCompare(b));
38+
process.stdout.write(`${results.join('\n')}\n`);

0 commit comments

Comments
 (0)