Skip to content

Commit 06a5723

Browse files
authored
Add vitest globals (#274)
1 parent ad28ede commit 06a5723

File tree

5 files changed

+53
-0
lines changed

5 files changed

+53
-0
lines changed

data/vitest.mjs

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// This file is autogenerated by scripts
2+
// Do NOT modify this file manually
3+
4+
export default {
5+
afterAll: false,
6+
afterEach: false,
7+
assert: false,
8+
assertType: false,
9+
beforeAll: false,
10+
beforeEach: false,
11+
describe: false,
12+
expect: false,
13+
expectTypeOf: false,
14+
it: false,
15+
onTestFailed: false,
16+
onTestFinished: false,
17+
suite: false,
18+
test: false,
19+
vi: false,
20+
vitest: false,
21+
};

globals.json

+18
Original file line numberDiff line numberDiff line change
@@ -2656,6 +2656,24 @@
26562656
"uniq": false,
26572657
"which": false
26582658
},
2659+
"vitest": {
2660+
"afterAll": false,
2661+
"afterEach": false,
2662+
"assert": false,
2663+
"assertType": false,
2664+
"beforeAll": false,
2665+
"beforeEach": false,
2666+
"describe": false,
2667+
"expect": false,
2668+
"expectTypeOf": false,
2669+
"it": false,
2670+
"onTestFailed": false,
2671+
"onTestFinished": false,
2672+
"suite": false,
2673+
"test": false,
2674+
"vi": false,
2675+
"vitest": false
2676+
},
26592677
"webextensions": {
26602678
"browser": false,
26612679
"chrome": false,

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"update:worker": "node scripts/update.mjs --environment=worker",
2525
"update:shelljs": "node scripts/update.mjs --environment=shelljs",
2626
"update:jest": "node scripts/update.mjs --environment=jest",
27+
"update:vitest": "node scripts/update.mjs --environment=vitest",
2728
"build": "run-s build:data build:types",
2829
"build:data": "node scripts/generate-data.mjs",
2930
"build:types": "node scripts/generate-types.mjs"
@@ -44,6 +45,7 @@
4445
"environments"
4546
],
4647
"devDependencies": {
48+
"@vitest/eslint-plugin": "^1.1.18",
4749
"ava": "^6.1.3",
4850
"cheerio": "^1.0.0-rc.12",
4951
"eslint-plugin-jest": "^28.8.3",

scripts/get-vitest-globals.mjs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import vitest from '@vitest/eslint-plugin';
2+
3+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/src/index.ts#L269-L285
4+
export default function getVitestGlobals() {
5+
return Object.fromEntries(Object.keys(vitest.environments.env.globals).map(name => [name, false]));
6+
}

scripts/update.mjs

+6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {getBrowserGlobals, getWebWorkerGlobals} from './get-browser-globals.mjs'
77
import getShelljsGlobals from './get-shelljs-globals.mjs';
88
import getJestGlobals from './get-jest-globals.mjs';
99
import {updateGlobals} from './utilities.mjs';
10+
import getVitestGlobals from './get-vitest-globals.mjs';
1011

1112
const ALL_JOBS = [
1213
{
@@ -36,6 +37,11 @@ const ALL_JOBS = [
3637
getGlobals: getJestGlobals,
3738
incremental: false,
3839
},
40+
{
41+
environment: 'vitest',
42+
getGlobals: getVitestGlobals,
43+
incremental: false,
44+
},
3945
];
4046

4147
async function run(options) {

0 commit comments

Comments
 (0)