Skip to content

Commit

Permalink
Add vitest globals (#274)
Browse files Browse the repository at this point in the history
  • Loading branch information
yongholeeme authored Dec 18, 2024
1 parent ad28ede commit 06a5723
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 0 deletions.
21 changes: 21 additions & 0 deletions data/vitest.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// This file is autogenerated by scripts
// Do NOT modify this file manually

export default {
afterAll: false,
afterEach: false,
assert: false,
assertType: false,
beforeAll: false,
beforeEach: false,
describe: false,
expect: false,
expectTypeOf: false,
it: false,
onTestFailed: false,
onTestFinished: false,
suite: false,
test: false,
vi: false,
vitest: false,
};
18 changes: 18 additions & 0 deletions globals.json
Original file line number Diff line number Diff line change
Expand Up @@ -2656,6 +2656,24 @@
"uniq": false,
"which": false
},
"vitest": {
"afterAll": false,
"afterEach": false,
"assert": false,
"assertType": false,
"beforeAll": false,
"beforeEach": false,
"describe": false,
"expect": false,
"expectTypeOf": false,
"it": false,
"onTestFailed": false,
"onTestFinished": false,
"suite": false,
"test": false,
"vi": false,
"vitest": false
},
"webextensions": {
"browser": false,
"chrome": false,
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"update:worker": "node scripts/update.mjs --environment=worker",
"update:shelljs": "node scripts/update.mjs --environment=shelljs",
"update:jest": "node scripts/update.mjs --environment=jest",
"update:vitest": "node scripts/update.mjs --environment=vitest",
"build": "run-s build:data build:types",
"build:data": "node scripts/generate-data.mjs",
"build:types": "node scripts/generate-types.mjs"
Expand All @@ -44,6 +45,7 @@
"environments"
],
"devDependencies": {
"@vitest/eslint-plugin": "^1.1.18",
"ava": "^6.1.3",
"cheerio": "^1.0.0-rc.12",
"eslint-plugin-jest": "^28.8.3",
Expand Down
6 changes: 6 additions & 0 deletions scripts/get-vitest-globals.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import vitest from '@vitest/eslint-plugin';

// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/src/index.ts#L269-L285
export default function getVitestGlobals() {
return Object.fromEntries(Object.keys(vitest.environments.env.globals).map(name => [name, false]));
}
6 changes: 6 additions & 0 deletions scripts/update.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {getBrowserGlobals, getWebWorkerGlobals} from './get-browser-globals.mjs'
import getShelljsGlobals from './get-shelljs-globals.mjs';
import getJestGlobals from './get-jest-globals.mjs';
import {updateGlobals} from './utilities.mjs';
import getVitestGlobals from './get-vitest-globals.mjs';

const ALL_JOBS = [
{
Expand Down Expand Up @@ -36,6 +37,11 @@ const ALL_JOBS = [
getGlobals: getJestGlobals,
incremental: false,
},
{
environment: 'vitest',
getGlobals: getVitestGlobals,
incremental: false,
},
];

async function run(options) {
Expand Down

0 comments on commit 06a5723

Please sign in to comment.