vitest 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +0 -17
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +1 -1
- package/dist/child.js +3 -3
- package/dist/chunks/install-pkg.LE8oaA1t.js +319 -0
- package/dist/chunks/{integrations-globals.eip0xL77.js → integrations-globals.8mr2ENps.js} +2 -2
- package/dist/cli.js +3 -3
- package/dist/config.cjs +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.js +1 -1
- package/dist/coverage.d.ts +1 -1
- package/dist/entry-vm.js +2 -2
- package/dist/entry.js +2 -2
- package/dist/environments.d.ts +2 -1
- package/dist/environments.js +1 -1
- package/dist/execute.d.ts +1 -1
- package/dist/execute.js +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/node.d.ts +2 -2
- package/dist/node.js +3 -3
- package/dist/{reporters-LLiOBu3g.d.ts → reporters-3OMQDZar.d.ts} +1 -1
- package/dist/reporters.d.ts +1 -1
- package/dist/runners.d.ts +1 -1
- package/dist/runners.js +1 -1
- package/dist/{suite-SvxfaIxW.d.ts → suite-yBB1jXl9.d.ts} +1 -1
- package/dist/suite.d.ts +2 -2
- package/dist/vendor/{environments.hTqxBFDN.js → environments.v4R4vGad.js} +10 -5
- package/dist/vendor/{execute.ILey0jnF.js → execute.1R_t2FPL.js} +3 -1
- package/dist/vendor/{index.VL3WbvjT.js → index.uQelX_YY.js} +1 -1
- package/dist/vendor/{loader.w8KTtIkD.js → loader.zIj6SiI8.js} +1 -1
- package/dist/vendor/{node.mLeBfrTn.js → node.hPXN4l9e.js} +15 -10
- package/dist/vendor/{vi.JXuS6emb.js → vi.pk4NToBt.js} +2 -0
- package/dist/vm.js +3 -3
- package/dist/worker.js +3 -3
- package/package.json +9 -9
- package/dist/chunks/install-pkg.ORGzQeqb.js +0 -457
package/dist/runners.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { setState, GLOBAL_EXPECT, getState } from '@vitest/expect';
|
|
2
|
-
import { g as getSnapshotClient, c as createExpect, v as vi } from './vendor/vi.
|
|
2
|
+
import { g as getSnapshotClient, c as createExpect, v as vi } from './vendor/vi.pk4NToBt.js';
|
|
3
3
|
import './vendor/index.XU72Rmy8.js';
|
|
4
4
|
import { a as rpc } from './vendor/rpc.Bl-ysZIr.js';
|
|
5
5
|
import { g as getFullName } from './vendor/tasks.IknbGB2n.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Custom } from '@vitest/runner';
|
|
2
2
|
import '@vitest/runner/utils';
|
|
3
|
-
import { ak as BenchFunction, al as BenchmarkAPI } from './reporters-
|
|
3
|
+
import { ak as BenchFunction, al as BenchmarkAPI } from './reporters-3OMQDZar.js';
|
|
4
4
|
import { Options } from 'tinybench';
|
|
5
5
|
|
|
6
6
|
declare function getBenchOptions(key: Custom): Options;
|
package/dist/suite.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { createTaskCollector, getCurrentSuite, getFn, setFn } from '@vitest/runner';
|
|
2
2
|
export { createChainable } from '@vitest/runner/utils';
|
|
3
|
-
export { g as getBenchFn, a as getBenchOptions } from './suite-
|
|
4
|
-
import './reporters-
|
|
3
|
+
export { g as getBenchFn, a as getBenchOptions } from './suite-yBB1jXl9.js';
|
|
4
|
+
import './reporters-3OMQDZar.js';
|
|
5
5
|
import 'vite';
|
|
6
6
|
import 'vite-node';
|
|
7
7
|
import '@vitest/snapshot';
|
|
@@ -350,12 +350,13 @@ const skipKeys = [
|
|
|
350
350
|
"top",
|
|
351
351
|
"parent"
|
|
352
352
|
];
|
|
353
|
-
function getWindowKeys(global, win) {
|
|
354
|
-
const
|
|
353
|
+
function getWindowKeys(global, win, additionalKeys = []) {
|
|
354
|
+
const keysArray = [...additionalKeys, ...KEYS];
|
|
355
|
+
const keys = new Set(keysArray.concat(Object.getOwnPropertyNames(win)).filter((k) => {
|
|
355
356
|
if (skipKeys.includes(k))
|
|
356
357
|
return false;
|
|
357
358
|
if (k in global)
|
|
358
|
-
return
|
|
359
|
+
return keysArray.includes(k);
|
|
359
360
|
return true;
|
|
360
361
|
}));
|
|
361
362
|
return keys;
|
|
@@ -365,7 +366,7 @@ function isClassLikeName(name) {
|
|
|
365
366
|
}
|
|
366
367
|
function populateGlobal(global, win, options = {}) {
|
|
367
368
|
const { bindFunctions = false } = options;
|
|
368
|
-
const keys = getWindowKeys(global, win);
|
|
369
|
+
const keys = getWindowKeys(global, win, options.additionalKeys);
|
|
369
370
|
const originals = /* @__PURE__ */ new Map();
|
|
370
371
|
const overrideObject = /* @__PURE__ */ new Map();
|
|
371
372
|
for (const key of keys) {
|
|
@@ -581,7 +582,11 @@ var happy = {
|
|
|
581
582
|
disableErrorCapturing: true
|
|
582
583
|
}
|
|
583
584
|
});
|
|
584
|
-
const { keys, originals } = populateGlobal(global, win, {
|
|
585
|
+
const { keys, originals } = populateGlobal(global, win, {
|
|
586
|
+
bindFunctions: true,
|
|
587
|
+
// jsdom doesn't support Request and Response, but happy-dom does
|
|
588
|
+
additionalKeys: ["Request", "Response"]
|
|
589
|
+
});
|
|
585
590
|
return {
|
|
586
591
|
teardown(global2) {
|
|
587
592
|
win.happyDOM.cancelAsync();
|
|
@@ -244,7 +244,9 @@ ${c.green(`vi.mock("${mockpath}", async () => {
|
|
|
244
244
|
if (isFunction) {
|
|
245
245
|
let mockFunction2 = function() {
|
|
246
246
|
if (this instanceof newContainer[property]) {
|
|
247
|
-
for (const { key } of getAllMockableProperties(this, false, primitives)) {
|
|
247
|
+
for (const { key, descriptor: descriptor2 } of getAllMockableProperties(this, false, primitives)) {
|
|
248
|
+
if (descriptor2.get)
|
|
249
|
+
continue;
|
|
248
250
|
const value2 = this[key];
|
|
249
251
|
const type2 = getType(value2);
|
|
250
252
|
const isFunction2 = type2.includes("Function") && typeof value2 === "function";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
|
|
2
2
|
import { b as bench } from './benchmark.WVm6DARl.js';
|
|
3
3
|
import { i as isFirstRun, r as runOnce } from './run-once.X3E7xx3F.js';
|
|
4
|
-
import { c as createExpect, a as globalExpect, v as vi, b as vitest } from './vi.
|
|
4
|
+
import { c as createExpect, a as globalExpect, v as vi, b as vitest } from './vi.pk4NToBt.js';
|
|
5
5
|
import { g as getWorkerState } from './global.L7JRz1qU.js';
|
|
6
6
|
import * as chai from 'chai';
|
|
7
7
|
import { assert, should } from 'chai';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { resolve, normalize } from 'pathe';
|
|
2
2
|
import { ViteNodeRunner } from 'vite-node/client';
|
|
3
|
-
import { e as environments } from './environments.
|
|
3
|
+
import { e as environments } from './environments.v4R4vGad.js';
|
|
4
4
|
|
|
5
5
|
function isBuiltinEnvironment(env) {
|
|
6
6
|
return env in environments;
|
|
@@ -33,6 +33,7 @@ import { writeFile, rm } from 'node:fs/promises';
|
|
|
33
33
|
import { performance } from 'node:perf_hooks';
|
|
34
34
|
import { execa } from 'execa';
|
|
35
35
|
import { TraceMap, generatedPositionFor, parseErrorStacktrace } from '@vitest/utils/source-map';
|
|
36
|
+
import { createRequire } from 'node:module';
|
|
36
37
|
import { isPackageExists, resolveModule } from 'local-pkg';
|
|
37
38
|
import { isCI, provider as provider$1 } from 'std-env';
|
|
38
39
|
import ge from 'module';
|
|
@@ -43,7 +44,7 @@ import crypto, { createHash } from 'node:crypto';
|
|
|
43
44
|
import require$$0$3 from 'assert';
|
|
44
45
|
import MagicString from 'magic-string';
|
|
45
46
|
import { stripLiteral } from 'strip-literal';
|
|
46
|
-
import { g as getEnvPackageName } from './environments.
|
|
47
|
+
import { g as getEnvPackageName } from './environments.v4R4vGad.js';
|
|
47
48
|
import readline from 'node:readline';
|
|
48
49
|
import require$$0$4 from 'readline';
|
|
49
50
|
|
|
@@ -62,14 +63,22 @@ function _mergeNamespaces(n, m) {
|
|
|
62
63
|
return Object.freeze(n);
|
|
63
64
|
}
|
|
64
65
|
|
|
65
|
-
var version$1 = "1.0.
|
|
66
|
+
var version$1 = "1.0.2";
|
|
66
67
|
|
|
67
68
|
const __dirname$1 = url.fileURLToPath(new URL(".", import.meta.url));
|
|
68
69
|
async function ensurePackageInstalled(dependency, root) {
|
|
70
|
+
if (process.versions.pnp) {
|
|
71
|
+
const targetRequire = createRequire(__dirname$1);
|
|
72
|
+
try {
|
|
73
|
+
targetRequire.resolve(dependency, { paths: [root, __dirname$1] });
|
|
74
|
+
return true;
|
|
75
|
+
} catch (error) {
|
|
76
|
+
}
|
|
77
|
+
}
|
|
69
78
|
if (isPackageExists(dependency, { paths: [root, __dirname$1] }))
|
|
70
79
|
return true;
|
|
71
80
|
const promptInstall = !isCI && process.stdout.isTTY;
|
|
72
|
-
process.stderr.write(c.red(`${c.inverse(c.red(" MISSING
|
|
81
|
+
process.stderr.write(c.red(`${c.inverse(c.red(" MISSING DEPENDENCY "))} Cannot find dependency '${dependency}'
|
|
73
82
|
|
|
74
83
|
`));
|
|
75
84
|
if (!promptInstall)
|
|
@@ -81,7 +90,7 @@ async function ensurePackageInstalled(dependency, root) {
|
|
|
81
90
|
message: c.reset(`Do you want to install ${c.green(dependency)}?`)
|
|
82
91
|
});
|
|
83
92
|
if (install) {
|
|
84
|
-
await (await import('../chunks/install-pkg.
|
|
93
|
+
await (await import('../chunks/install-pkg.LE8oaA1t.js')).installPackage(dependency, { dev: true });
|
|
85
94
|
process.stderr.write(c.yellow(`
|
|
86
95
|
Package ${dependency} installed, re-run the command to start.
|
|
87
96
|
`));
|
|
@@ -4687,7 +4696,7 @@ class StateManager {
|
|
|
4687
4696
|
|
|
4688
4697
|
var _a, _b;
|
|
4689
4698
|
const defaultInclude = ["**/*.{test,spec}.?(c|m)[jt]s?(x)"];
|
|
4690
|
-
const defaultExclude = ["**/node_modules/**", "**/dist/**", "**/cypress/**", "**/.{idea,git,cache,output,temp}/**", "**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*"];
|
|
4699
|
+
const defaultExclude = ["**/node_modules/**", "**/dist/**", "**/cypress/**", "**/.{idea,git,cache,output,temp}/**", "**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*"];
|
|
4691
4700
|
const benchmarkConfigDefaults = {
|
|
4692
4701
|
include: ["**/*.{bench,benchmark}.?(c|m)[jt]s?(x)"],
|
|
4693
4702
|
exclude: defaultExclude,
|
|
@@ -6283,7 +6292,7 @@ createLogUpdate(process$2.stdout);
|
|
|
6283
6292
|
|
|
6284
6293
|
createLogUpdate(process$2.stderr);
|
|
6285
6294
|
|
|
6286
|
-
var version = "1.0.
|
|
6295
|
+
var version = "1.0.2";
|
|
6287
6296
|
|
|
6288
6297
|
async function printError(error, project, options) {
|
|
6289
6298
|
const { showCodeFrame = true, fullStack = false, type } = options;
|
|
@@ -14779,10 +14788,6 @@ async function startVitest(mode, cliFilters = [], options = {}, viteOverrides) {
|
|
|
14779
14788
|
if (options.run)
|
|
14780
14789
|
options.watch = false;
|
|
14781
14790
|
const root = resolve(options.root || process.cwd());
|
|
14782
|
-
if (!await ensurePackageInstalled("vite", root)) {
|
|
14783
|
-
process.exitCode = 1;
|
|
14784
|
-
return;
|
|
14785
|
-
}
|
|
14786
14791
|
if (typeof options.coverage === "boolean")
|
|
14787
14792
|
options.coverage = { enabled: options.coverage };
|
|
14788
14793
|
if (typeof options.browser === "boolean")
|
|
@@ -316,6 +316,8 @@ const SnapshotPlugin = (chai, utils) => {
|
|
|
316
316
|
const error = utils.flag(this, "error");
|
|
317
317
|
const promise = utils.flag(this, "promise");
|
|
318
318
|
const errorMessage = utils.flag(this, "message");
|
|
319
|
+
if (inlineSnapshot)
|
|
320
|
+
inlineSnapshot = stripSnapshotIndentation(inlineSnapshot);
|
|
319
321
|
getSnapshotClient().assert({
|
|
320
322
|
received: getError(expected, promise),
|
|
321
323
|
message,
|
package/dist/vm.js
CHANGED
|
@@ -7,11 +7,11 @@ import { c as createBirpc } from './vendor/index.cAUulNDf.js';
|
|
|
7
7
|
import { resolve } from 'pathe';
|
|
8
8
|
import { installSourcemapsSupport } from 'vite-node/source-map';
|
|
9
9
|
import { distDir } from './paths.js';
|
|
10
|
-
import { l as loadEnvironment } from './vendor/loader.
|
|
11
|
-
import { b as startVitestExecutor } from './vendor/execute.
|
|
10
|
+
import { l as loadEnvironment } from './vendor/loader.zIj6SiI8.js';
|
|
11
|
+
import { b as startVitestExecutor } from './vendor/execute.1R_t2FPL.js';
|
|
12
12
|
import { createCustomConsole } from './chunks/runtime-console.hf2msWA9.js';
|
|
13
13
|
import { c as createSafeRpc } from './vendor/rpc.Bl-ysZIr.js';
|
|
14
|
-
import './vendor/environments.
|
|
14
|
+
import './vendor/environments.v4R4vGad.js';
|
|
15
15
|
import 'node:console';
|
|
16
16
|
import 'local-pkg';
|
|
17
17
|
import 'vite-node/utils';
|
package/dist/worker.js
CHANGED
|
@@ -2,13 +2,13 @@ import { performance } from 'node:perf_hooks';
|
|
|
2
2
|
import { c as createBirpc } from './vendor/index.cAUulNDf.js';
|
|
3
3
|
import { workerId } from 'tinypool';
|
|
4
4
|
import { g as getWorkerState } from './vendor/global.L7JRz1qU.js';
|
|
5
|
-
import { l as loadEnvironment } from './vendor/loader.
|
|
6
|
-
import { s as startViteNode, m as moduleCache, a as mockMap } from './vendor/execute.
|
|
5
|
+
import { l as loadEnvironment } from './vendor/loader.zIj6SiI8.js';
|
|
6
|
+
import { s as startViteNode, m as moduleCache, a as mockMap } from './vendor/execute.1R_t2FPL.js';
|
|
7
7
|
import { s as setupInspect } from './vendor/inspector.lFAeuaAt.js';
|
|
8
8
|
import { r as rpcDone, c as createSafeRpc } from './vendor/rpc.Bl-ysZIr.js';
|
|
9
9
|
import 'pathe';
|
|
10
10
|
import 'vite-node/client';
|
|
11
|
-
import './vendor/environments.
|
|
11
|
+
import './vendor/environments.v4R4vGad.js';
|
|
12
12
|
import 'node:console';
|
|
13
13
|
import 'local-pkg';
|
|
14
14
|
import 'node:url';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.2",
|
|
5
5
|
"description": "Next generation testing framework powered by Vite",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -145,18 +145,18 @@
|
|
|
145
145
|
"strip-literal": "^1.3.0",
|
|
146
146
|
"tinybench": "^2.5.1",
|
|
147
147
|
"tinypool": "^0.8.1",
|
|
148
|
-
"vite": "^5.0.0
|
|
148
|
+
"vite": "^5.0.0",
|
|
149
149
|
"why-is-node-running": "^2.2.2",
|
|
150
|
-
"
|
|
151
|
-
"@vitest/
|
|
152
|
-
"@vitest/
|
|
153
|
-
"@vitest/runner": "1.0.
|
|
154
|
-
"@vitest/
|
|
155
|
-
"
|
|
150
|
+
"vite-node": "1.0.2",
|
|
151
|
+
"@vitest/expect": "1.0.2",
|
|
152
|
+
"@vitest/utils": "1.0.2",
|
|
153
|
+
"@vitest/runner": "1.0.2",
|
|
154
|
+
"@vitest/spy": "1.0.2",
|
|
155
|
+
"@vitest/snapshot": "1.0.2"
|
|
156
156
|
},
|
|
157
157
|
"devDependencies": {
|
|
158
158
|
"@ampproject/remapping": "^2.2.1",
|
|
159
|
-
"@antfu/install-pkg": "^0.
|
|
159
|
+
"@antfu/install-pkg": "^0.3.1",
|
|
160
160
|
"@edge-runtime/vm": "^3.1.7",
|
|
161
161
|
"@sinonjs/fake-timers": "11.1.0",
|
|
162
162
|
"@types/estree": "^1.0.5",
|