Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add vitest globals #274

Merged
merged 3 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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": {
yongholeeme marked this conversation as resolved.
Show resolved Hide resolved
"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
Loading