diff --git a/data/vitest.mjs b/data/vitest.mjs new file mode 100644 index 0000000..2127d6f --- /dev/null +++ b/data/vitest.mjs @@ -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, +}; diff --git a/globals.json b/globals.json index 07f5dbf..8a0b08c 100644 --- a/globals.json +++ b/globals.json @@ -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, diff --git a/package.json b/package.json index f5e9714..1a146ab 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.18", "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) {