diff --git a/data/vitest.mjs b/data/vitest.mjs index 2e9a2b0..efc1e9f 100644 --- a/data/vitest.mjs +++ b/data/vitest.mjs @@ -1,16 +1,15 @@ +// 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, diff --git a/globals.json b/globals.json index 8a0b08c..a78c284 100644 --- a/globals.json +++ b/globals.json @@ -2660,15 +2660,11 @@ "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, diff --git a/package.json b/package.json index f5e9714..a4045f3 100644 --- a/package.json +++ b/package.json @@ -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" @@ -44,6 +45,7 @@ "environments" ], "devDependencies": { + "@vitest/eslint-plugin": "^1.1.17", "ava": "^6.1.3", "cheerio": "^1.0.0-rc.12", "eslint-plugin-jest": "^28.8.3", diff --git a/scripts/get-vitest-globals.mjs b/scripts/get-vitest-globals.mjs new file mode 100644 index 0000000..5010d38 --- /dev/null +++ b/scripts/get-vitest-globals.mjs @@ -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])); +} diff --git a/scripts/update.mjs b/scripts/update.mjs index ee1d2a5..3de05fc 100644 --- a/scripts/update.mjs +++ b/scripts/update.mjs @@ -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 = [ { @@ -36,6 +37,11 @@ const ALL_JOBS = [ getGlobals: getJestGlobals, incremental: false, }, + { + environment: 'vitest', + getGlobals: getVitestGlobals, + incremental: false, + }, ]; async function run(options) {