This commit is contained in:
2026-03-18 20:54:43 +01:00
parent b3c8b77f12
commit 9fe656b34c
8058 changed files with 912898 additions and 23 deletions
+1523
View File
File diff suppressed because it is too large Load Diff
+7
View File
@@ -0,0 +1,7 @@
# vitest
[![NPM version](https://img.shields.io/npm/v/vitest?color=a1b858&label=)](https://www.npmjs.com/package/vitest)
Next generation testing framework powered by Vite.
[GitHub](https://github.com/vitest-dev/vitest) | [Documentation](https://vitest.dev/)
+1
View File
@@ -0,0 +1 @@
export * from './dist/browser.js'
+1
View File
@@ -0,0 +1 @@
export * from './dist/config.js'
+1
View File
@@ -0,0 +1 @@
export * from './dist/coverage.js'
+1
View File
@@ -0,0 +1 @@
export * from './dist/environments'
+1
View File
@@ -0,0 +1 @@
export * from './dist/execute.js'
+19
View File
@@ -0,0 +1,19 @@
declare global {
const suite: typeof import('vitest')['suite']
const test: typeof import('vitest')['test']
const describe: typeof import('vitest')['describe']
const it: typeof import('vitest')['it']
const expectTypeOf: typeof import('vitest')['expectTypeOf']
const assertType: typeof import('vitest')['assertType']
const expect: typeof import('vitest')['expect']
const assert: typeof import('vitest')['assert']
const vitest: typeof import('vitest')['vitest']
const vi: typeof import('vitest')['vitest']
const beforeAll: typeof import('vitest')['beforeAll']
const afterAll: typeof import('vitest')['afterAll']
const beforeEach: typeof import('vitest')['beforeEach']
const afterEach: typeof import('vitest')['afterEach']
const onTestFailed: typeof import('vitest')['onTestFailed']
const onTestFinished: typeof import('vitest')['onTestFinished']
}
export {}
+5
View File
@@ -0,0 +1,5 @@
/// <reference path="./importMeta.d.ts" />
// https://github.com/microsoft/TypeScript/issues/45096
// TypeScript has a bug that makes <reference types="vite/types/importMeta" />
// not possible in userland. This file provides a workaround for now.
+4
View File
@@ -0,0 +1,4 @@
interface ImportMeta {
url: string
readonly vitest?: typeof import('vitest')
}
+5
View File
@@ -0,0 +1,5 @@
throw new Error(
'Vitest cannot be imported in a CommonJS module using require(). Please use "import" instead.'
+ '\n\nIf you are using "import" in your source code, then it\'s possible it was bundled into require() automatically by your bundler. '
+ 'In that case, do not bundle CommonJS output since it will never work with Vitest, or use dynamic import() which is available in all CommonJS modules.',
)
+1
View File
@@ -0,0 +1 @@
export * from './dist/index.js'
+6
View File
@@ -0,0 +1,6 @@
import type { JSDOM } from 'jsdom'
declare global {
const jsdom: JSDOM
}
export {}
+1
View File
@@ -0,0 +1 @@
export * from './dist/mocker.js'
+1
View File
@@ -0,0 +1 @@
export * from './dist/node.js'
+207
View File
@@ -0,0 +1,207 @@
{
"name": "vitest",
"type": "module",
"version": "2.1.9",
"description": "Next generation testing framework powered by Vite",
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
"license": "MIT",
"funding": "https://opencollective.com/vitest",
"homepage": "https://github.com/vitest-dev/vitest#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/vitest-dev/vitest.git",
"directory": "packages/vitest"
},
"bugs": {
"url": "https://github.com/vitest-dev/vitest/issues"
},
"keywords": [
"vite",
"vitest",
"test",
"jest"
],
"sideEffects": false,
"exports": {
".": {
"import": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"require": {
"types": "./index.d.cts",
"default": "./index.cjs"
}
},
"./*": "./*",
"./globals": {
"types": "./globals.d.ts"
},
"./jsdom": {
"types": "./jsdom.d.ts"
},
"./importMeta": {
"types": "./importMeta.d.ts"
},
"./import-meta": {
"types": "./import-meta.d.ts"
},
"./node": {
"types": "./dist/node.d.ts",
"default": "./dist/node.js"
},
"./execute": {
"types": "./dist/execute.d.ts",
"default": "./dist/execute.js"
},
"./workers": {
"types": "./dist/workers.d.ts",
"import": "./dist/workers.js"
},
"./browser": {
"types": "./dist/browser.d.ts",
"default": "./dist/browser.js"
},
"./runners": {
"types": "./dist/runners.d.ts",
"default": "./dist/runners.js"
},
"./suite": {
"types": "./dist/suite.d.ts",
"default": "./dist/suite.js"
},
"./environments": {
"types": "./dist/environments.d.ts",
"default": "./dist/environments.js"
},
"./utils": {
"types": "./dist/utils.d.ts",
"default": "./dist/utils.js"
},
"./config": {
"types": "./config.d.ts",
"require": "./dist/config.cjs",
"default": "./dist/config.js"
},
"./coverage": {
"types": "./coverage.d.ts",
"default": "./dist/coverage.js"
},
"./reporters": {
"types": "./dist/reporters.d.ts",
"default": "./dist/reporters.js"
},
"./snapshot": {
"types": "./dist/snapshot.d.ts",
"default": "./dist/snapshot.js"
},
"./mocker": {
"types": "./dist/mocker.d.ts",
"default": "./dist/mocker.js"
}
},
"main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"bin": {
"vitest": "./vitest.mjs"
},
"files": [
"*.cjs",
"*.d.cts",
"*.d.ts",
"*.mjs",
"bin",
"dist"
],
"engines": {
"node": "^18.0.0 || >=20.0.0"
},
"peerDependencies": {
"@edge-runtime/vm": "*",
"@types/node": "^18.0.0 || >=20.0.0",
"happy-dom": "*",
"jsdom": "*",
"@vitest/browser": "2.1.9",
"@vitest/ui": "2.1.9"
},
"peerDependenciesMeta": {
"@edge-runtime/vm": {
"optional": true
},
"@types/node": {
"optional": true
},
"@vitest/browser": {
"optional": true
},
"@vitest/ui": {
"optional": true
},
"happy-dom": {
"optional": true
},
"jsdom": {
"optional": true
}
},
"dependencies": {
"chai": "^5.1.2",
"debug": "^4.3.7",
"expect-type": "^1.1.0",
"magic-string": "^0.30.12",
"pathe": "^1.1.2",
"std-env": "^3.8.0",
"tinybench": "^2.9.0",
"tinyexec": "^0.3.1",
"tinypool": "^1.0.1",
"tinyrainbow": "^1.2.0",
"vite": "^5.0.0",
"why-is-node-running": "^2.3.0",
"@vitest/expect": "2.1.9",
"@vitest/mocker": "2.1.9",
"@vitest/runner": "2.1.9",
"@vitest/snapshot": "2.1.9",
"@vitest/pretty-format": "^2.1.9",
"@vitest/spy": "2.1.9",
"vite-node": "2.1.9",
"@vitest/utils": "2.1.9"
},
"devDependencies": {
"@ampproject/remapping": "^2.3.0",
"@antfu/install-pkg": "^0.4.1",
"@edge-runtime/vm": "^4.0.4",
"@sinonjs/fake-timers": "11.1.0",
"@types/debug": "^4.1.12",
"@types/estree": "^1.0.6",
"@types/istanbul-lib-coverage": "^2.0.6",
"@types/istanbul-reports": "^3.0.4",
"@types/jsdom": "^21.1.7",
"@types/micromatch": "^4.0.9",
"@types/node": "^22.9.0",
"@types/prompts": "^2.4.9",
"@types/sinonjs__fake-timers": "^8.1.5",
"acorn-walk": "^8.3.4",
"birpc": "0.2.19",
"cac": "^6.7.14",
"chai-subset": "^1.6.0",
"cli-truncate": "^4.0.0",
"fast-glob": "3.3.2",
"find-up": "^6.3.0",
"flatted": "^3.3.1",
"get-tsconfig": "^4.8.1",
"happy-dom": "^15.11.4",
"jsdom": "^25.0.1",
"local-pkg": "^0.5.0",
"log-update": "^5.0.1",
"micromatch": "^4.0.8",
"pretty-format": "^29.7.0",
"prompts": "^2.4.2",
"strip-literal": "^2.1.0",
"ws": "^8.18.0"
},
"scripts": {
"build": "rimraf dist && rollup -c",
"dev": "NODE_OPTIONS=\"--max-old-space-size=8192\" rollup -c --watch -m inline"
}
}
+1
View File
@@ -0,0 +1 @@
export * from './dist/reporters.js'
+1
View File
@@ -0,0 +1 @@
export * from './dist/runners.js'
+1
View File
@@ -0,0 +1 @@
export * from './dist/snapshot.js'
+1
View File
@@ -0,0 +1 @@
export * from './dist/suite.js'
+21
View File
@@ -0,0 +1,21 @@
// borrowed from tsx implementation:
// https://github.com/esbuild-kit/tsx
const ignoreWarnings = new Set([
'--experimental-loader is an experimental feature. This feature could change at any time',
'Custom ESM Loaders is an experimental feature. This feature could change at any time',
'Custom ESM Loaders is an experimental feature and might change at any time',
'VM Modules is an experimental feature and might change at any time',
'VM Modules is an experimental feature. This feature could change at any time',
])
const { emit } = process
process.emit = function (event, warning) {
if (event === 'warning' && ignoreWarnings.has(warning.message)) {
return
}
// eslint-disable-next-line prefer-rest-params
return Reflect.apply(emit, this, arguments)
}
+1
View File
@@ -0,0 +1 @@
export * from './dist/utils.js'
Generated Vendored Executable
+2
View File
@@ -0,0 +1,2 @@
#!/usr/bin/env node
import './dist/cli.js'
+1
View File
@@ -0,0 +1 @@
export * from './dist/workers.js'