vitest 0.20.3 → 0.21.0
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/dist/browser.d.ts +9 -1902
- package/dist/browser.mjs +7 -7
- package/dist/{chunk-api-setup.9bff74bb.mjs → chunk-api-setup.89eb0e7a.mjs} +5 -5
- package/dist/{chunk-constants.16825f0c.mjs → chunk-constants.9da1ef26.mjs} +1 -1
- package/dist/{chunk-defaults.6698a2d3.mjs → chunk-defaults.8390340d.mjs} +1 -1
- package/dist/{chunk-integrations-globals.c5b78414.mjs → chunk-integrations-globals.a798d352.mjs} +6 -6
- package/dist/{chunk-mock-date.9160e13b.mjs → chunk-mock-date.ea3b3121.mjs} +10 -7
- package/dist/{chunk-node-git.43dbdd42.mjs → chunk-node-git.e0dc0a7e.mjs} +1 -1
- package/dist/{chunk-runtime-chain.b6c2cdbc.mjs → chunk-runtime-chain.44b4224d.mjs} +30 -21
- package/dist/{chunk-runtime-error.034e03ba.mjs → chunk-runtime-error.95e53764.mjs} +12 -11
- package/dist/{chunk-runtime-hooks.a8401528.mjs → chunk-runtime-hooks.291644ec.mjs} +3 -3
- package/dist/{chunk-runtime-mocker.653847b2.mjs → chunk-runtime-mocker.6190d6a3.mjs} +19 -11
- package/dist/{chunk-runtime-rpc.dbf0b31d.mjs → chunk-runtime-rpc.fc50dcc0.mjs} +1 -1
- package/dist/{chunk-utils-source-map.8198ebd9.mjs → chunk-utils-source-map.d307e4ea.mjs} +1 -1
- package/dist/{chunk-vite-node-client.115caed2.mjs → chunk-vite-node-client.b59ba135.mjs} +2 -2
- package/dist/{chunk-vite-node-debug.c5887932.mjs → chunk-vite-node-debug.dbce2e1f.mjs} +1 -1
- package/dist/{chunk-vite-node-externalize.91ae6e85.mjs → chunk-vite-node-externalize.80bed9b3.mjs} +23 -13
- package/dist/{chunk-vite-node-utils.7e46948f.mjs → chunk-vite-node-utils.96438e82.mjs} +2 -2
- package/dist/cli.mjs +7 -7
- package/dist/config.d.ts +2 -67
- package/dist/entry.mjs +7 -7
- package/dist/global-644546f7.d.ts +1777 -0
- package/dist/index-3f764034.d.ts +164 -0
- package/dist/index.d.ts +10 -1928
- package/dist/index.mjs +5 -5
- package/dist/loader.mjs +72 -16
- package/dist/mocker-5e2a8e41.d.ts +3 -0
- package/dist/node.d.ts +7 -1682
- package/dist/node.mjs +8 -8
- package/dist/suite.mjs +4 -4
- package/dist/worker.mjs +6 -6
- package/package.json +3 -3
package/dist/browser.mjs
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
export { c as createExpect, d as describe, b as expect, i as it, s as suite, t as test } from './chunk-runtime-chain.
|
|
2
|
-
export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach } from './chunk-runtime-hooks.
|
|
3
|
-
export { a as setupGlobalEnv, s as startTests } from './chunk-runtime-error.
|
|
1
|
+
export { c as createExpect, d as describe, b as expect, i as it, s as suite, t as test } from './chunk-runtime-chain.44b4224d.mjs';
|
|
2
|
+
export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach } from './chunk-runtime-hooks.291644ec.mjs';
|
|
3
|
+
export { a as setupGlobalEnv, s as startTests } from './chunk-runtime-error.95e53764.mjs';
|
|
4
4
|
import * as chai from 'chai';
|
|
5
5
|
export { chai };
|
|
6
6
|
export { assert, should } from 'chai';
|
|
7
7
|
import 'util';
|
|
8
|
-
import './chunk-mock-date.
|
|
8
|
+
import './chunk-mock-date.ea3b3121.mjs';
|
|
9
9
|
import 'path';
|
|
10
10
|
import 'tty';
|
|
11
11
|
import 'local-pkg';
|
|
12
12
|
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
13
|
-
import './chunk-runtime-rpc.
|
|
13
|
+
import './chunk-runtime-rpc.fc50dcc0.mjs';
|
|
14
14
|
import './chunk-utils-global.fa20c2f6.mjs';
|
|
15
15
|
import './chunk-utils-timers.b48455ed.mjs';
|
|
16
16
|
import 'fs';
|
|
17
|
-
import './chunk-utils-source-map.
|
|
17
|
+
import './chunk-utils-source-map.d307e4ea.mjs';
|
|
18
18
|
import './spy.mjs';
|
|
19
19
|
import 'tinyspy';
|
|
20
|
-
import './chunk-defaults.
|
|
20
|
+
import './chunk-defaults.8390340d.mjs';
|
|
21
21
|
import 'module';
|
|
22
22
|
import 'url';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { promises } from 'fs';
|
|
2
|
-
import { c as createBirpc } from './chunk-vite-node-client.
|
|
2
|
+
import { c as createBirpc } from './chunk-vite-node-client.b59ba135.mjs';
|
|
3
3
|
import require$$0$1 from 'stream';
|
|
4
4
|
import require$$0 from 'zlib';
|
|
5
5
|
import require$$3 from 'net';
|
|
@@ -9,15 +9,15 @@ import require$$2 from 'events';
|
|
|
9
9
|
import require$$1 from 'https';
|
|
10
10
|
import require$$2$1 from 'http';
|
|
11
11
|
import _url from 'url';
|
|
12
|
-
import { A as API_PATH } from './chunk-constants.
|
|
13
|
-
import { j as interpretSourcePos, p as parseStacktrace } from './chunk-utils-source-map.
|
|
12
|
+
import { A as API_PATH } from './chunk-constants.9da1ef26.mjs';
|
|
13
|
+
import { j as interpretSourcePos, p as parseStacktrace } from './chunk-utils-source-map.d307e4ea.mjs';
|
|
14
14
|
import 'module';
|
|
15
15
|
import 'vm';
|
|
16
|
-
import './chunk-mock-date.
|
|
16
|
+
import './chunk-mock-date.ea3b3121.mjs';
|
|
17
17
|
import 'path';
|
|
18
18
|
import 'tty';
|
|
19
19
|
import 'local-pkg';
|
|
20
|
-
import './chunk-vite-node-utils.
|
|
20
|
+
import './chunk-vite-node-utils.96438e82.mjs';
|
|
21
21
|
import 'assert';
|
|
22
22
|
import 'util';
|
|
23
23
|
import 'debug';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _url from 'url';
|
|
2
|
-
import { y as resolve } from './chunk-mock-date.
|
|
2
|
+
import { y as resolve } from './chunk-mock-date.ea3b3121.mjs';
|
|
3
3
|
|
|
4
4
|
const rootDir = resolve(_url.fileURLToPath(import.meta.url), "../../");
|
|
5
5
|
const distDir = resolve(_url.fileURLToPath(import.meta.url), "../../dist");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { existsSync, promises } from 'fs';
|
|
2
2
|
import { createRequire } from 'module';
|
|
3
3
|
import _url from 'url';
|
|
4
|
-
import { t as toArray, y as resolve } from './chunk-mock-date.
|
|
4
|
+
import { t as toArray, y as resolve } from './chunk-mock-date.ea3b3121.mjs';
|
|
5
5
|
import { importModule } from 'local-pkg';
|
|
6
6
|
|
|
7
7
|
/*
|
package/dist/{chunk-integrations-globals.c5b78414.mjs → chunk-integrations-globals.a798d352.mjs}
RENAMED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { g as globalApis } from './chunk-constants.
|
|
2
|
-
import { i as index } from './chunk-runtime-hooks.
|
|
1
|
+
import { g as globalApis } from './chunk-constants.9da1ef26.mjs';
|
|
2
|
+
import { i as index } from './chunk-runtime-hooks.291644ec.mjs';
|
|
3
3
|
import 'url';
|
|
4
|
-
import './chunk-mock-date.
|
|
4
|
+
import './chunk-mock-date.ea3b3121.mjs';
|
|
5
5
|
import 'path';
|
|
6
6
|
import 'tty';
|
|
7
7
|
import 'local-pkg';
|
|
8
|
-
import './chunk-runtime-chain.
|
|
8
|
+
import './chunk-runtime-chain.44b4224d.mjs';
|
|
9
9
|
import 'util';
|
|
10
10
|
import 'chai';
|
|
11
11
|
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
12
|
-
import './chunk-runtime-rpc.
|
|
12
|
+
import './chunk-runtime-rpc.fc50dcc0.mjs';
|
|
13
13
|
import './chunk-utils-global.fa20c2f6.mjs';
|
|
14
14
|
import './chunk-utils-timers.b48455ed.mjs';
|
|
15
15
|
import 'fs';
|
|
16
|
-
import './chunk-utils-source-map.
|
|
16
|
+
import './chunk-utils-source-map.d307e4ea.mjs';
|
|
17
17
|
import './spy.mjs';
|
|
18
18
|
import 'tinyspy';
|
|
19
19
|
|
|
@@ -299,18 +299,21 @@ function isFinalObj(obj) {
|
|
|
299
299
|
return obj === Object.prototype || obj === Function.prototype || obj === RegExp.prototype;
|
|
300
300
|
}
|
|
301
301
|
function collectOwnProperties(obj, collector) {
|
|
302
|
-
const
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
symbols.forEach((symbol) => collector.add(symbol));
|
|
302
|
+
const collect = typeof collector === "function" ? collector : (key) => collector.add(key);
|
|
303
|
+
Object.getOwnPropertyNames(obj).forEach(collect);
|
|
304
|
+
Object.getOwnPropertySymbols(obj).forEach(collect);
|
|
306
305
|
}
|
|
307
|
-
function
|
|
306
|
+
function getAllMockableProperties(obj) {
|
|
308
307
|
const allProps = /* @__PURE__ */ new Set();
|
|
309
308
|
let curr = obj;
|
|
310
309
|
do {
|
|
311
310
|
if (isFinalObj(curr))
|
|
312
311
|
break;
|
|
313
|
-
collectOwnProperties(curr,
|
|
312
|
+
collectOwnProperties(curr, (key) => {
|
|
313
|
+
const descriptor = Object.getOwnPropertyDescriptor(curr, key);
|
|
314
|
+
if (descriptor)
|
|
315
|
+
allProps.add({ key, descriptor });
|
|
316
|
+
});
|
|
314
317
|
} while (curr = Object.getPrototypeOf(curr));
|
|
315
318
|
return Array.from(allProps);
|
|
316
319
|
}
|
|
@@ -549,4 +552,4 @@ class AggregateErrorPonyfill extends Error {
|
|
|
549
552
|
}
|
|
550
553
|
}
|
|
551
554
|
|
|
552
|
-
export { AggregateErrorPonyfill as A, isAbsolute as B, relative as C, getTests as D, hasFailedSnapshot as E, getSuites as F, normalize as G, deepMerge as H, toNamespacedPath as I, ensurePackageInstalled as J, stdout as K, extname as L, isWindows as M, mergeSlashes as N,
|
|
555
|
+
export { AggregateErrorPonyfill as A, isAbsolute as B, relative as C, getTests as D, hasFailedSnapshot as E, getSuites as F, normalize as G, deepMerge as H, toNamespacedPath as I, ensurePackageInstalled as J, stdout as K, extname as L, isWindows as M, mergeSlashes as N, getAllMockableProperties as O, RealDate as R, resetModules as a, getNames as b, assertTypes as c, dirname as d, getFullName as e, notNullish as f, getCallLastIndex as g, deepClone as h, isObject as i, join as j, getType as k, isNode as l, mockDate as m, noop as n, relativePath as o, picocolors as p, isBrowser as q, resetDate as r, slash as s, toArray as t, partitionSuiteChildren as u, shuffle as v, hasTests as w, hasFailed as x, resolve as y, basename as z };
|
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
import util$1 from 'util';
|
|
2
|
-
import { i as isObject, j as join, d as dirname, g as getCallLastIndex, s as slash, b as getNames, c as assertTypes, p as picocolors, e as getFullName, n as noop } from './chunk-mock-date.
|
|
2
|
+
import { i as isObject, j as join, d as dirname, g as getCallLastIndex, s as slash, b as getNames, c as assertTypes, p as picocolors, e as getFullName, n as noop } from './chunk-mock-date.ea3b3121.mjs';
|
|
3
3
|
import * as chai$2 from 'chai';
|
|
4
4
|
import { expect, AssertionError, util } from 'chai';
|
|
5
5
|
import { c as commonjsGlobal } from './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
6
|
-
import { r as rpc } from './chunk-runtime-rpc.
|
|
6
|
+
import { r as rpc } from './chunk-runtime-rpc.fc50dcc0.mjs';
|
|
7
7
|
import fs, { promises } from 'fs';
|
|
8
|
-
import { a as plugins_1, f as format_1, g as getOriginalPos, b as posToNumber, n as numberToPos, l as lineSplitRE, p as parseStacktrace, u as unifiedDiff, s as stringify, m as matcherUtils } from './chunk-utils-source-map.
|
|
8
|
+
import { a as plugins_1, f as format_1, g as getOriginalPos, b as posToNumber, n as numberToPos, l as lineSplitRE, p as parseStacktrace, u as unifiedDiff, s as stringify, m as matcherUtils } from './chunk-utils-source-map.d307e4ea.mjs';
|
|
9
9
|
import { g as getWorkerState } from './chunk-utils-global.fa20c2f6.mjs';
|
|
10
10
|
import { isMockFunction } from './spy.mjs';
|
|
11
11
|
import { s as safeSetTimeout, a as safeClearTimeout } from './chunk-utils-timers.b48455ed.mjs';
|
|
12
12
|
|
|
13
13
|
function createChainable(keys, fn) {
|
|
14
|
-
function create(
|
|
14
|
+
function create(context) {
|
|
15
15
|
const chain2 = function(...args) {
|
|
16
|
-
return fn.apply(
|
|
16
|
+
return fn.apply(context, args);
|
|
17
17
|
};
|
|
18
|
+
Object.assign(chain2, fn);
|
|
19
|
+
chain2.withContext = () => chain2.bind(context);
|
|
18
20
|
for (const key of keys) {
|
|
19
21
|
Object.defineProperty(chain2, key, {
|
|
20
22
|
get() {
|
|
21
|
-
return create({ ...
|
|
23
|
+
return create({ ...context, [key]: true });
|
|
22
24
|
}
|
|
23
25
|
});
|
|
24
26
|
}
|
|
@@ -1233,8 +1235,13 @@ const JestChaiExpect = (chai, utils) => {
|
|
|
1233
1235
|
args[0] = args[0].map((key) => key.replace(/([.[\]])/g, "\\$1")).join(".");
|
|
1234
1236
|
const actual = this._obj;
|
|
1235
1237
|
const [propertyName, expected] = args;
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
+
let pass = false;
|
|
1239
|
+
if (Object.prototype.hasOwnProperty.call(actual, propertyName)) {
|
|
1240
|
+
pass = true;
|
|
1241
|
+
} else {
|
|
1242
|
+
const { value, exists } = utils.getPathInfo(actual, propertyName);
|
|
1243
|
+
pass = exists && (args.length === 1 || equals(expected, value));
|
|
1244
|
+
}
|
|
1238
1245
|
return this.assert(pass, "expected #{this} to have property #{exp}", "expected #{this} to not have property #{exp}", expected, actual);
|
|
1239
1246
|
});
|
|
1240
1247
|
def("toBeCloseTo", function(received, precision = 2) {
|
|
@@ -2007,11 +2014,12 @@ function createSuiteCollector(name, factory = () => {
|
|
|
2007
2014
|
return collector;
|
|
2008
2015
|
}
|
|
2009
2016
|
function createSuite() {
|
|
2010
|
-
|
|
2017
|
+
function suiteFn(name, factory) {
|
|
2011
2018
|
const mode = this.only ? "only" : this.skip ? "skip" : this.todo ? "todo" : "run";
|
|
2012
2019
|
return createSuiteCollector(name, factory, mode, this.concurrent, this.shuffle);
|
|
2013
|
-
}
|
|
2014
|
-
|
|
2020
|
+
}
|
|
2021
|
+
suiteFn.each = function(cases) {
|
|
2022
|
+
const suite2 = this.withContext();
|
|
2015
2023
|
return (name, fn) => {
|
|
2016
2024
|
cases.forEach((i, idx) => {
|
|
2017
2025
|
const items = Array.isArray(i) ? i : [i];
|
|
@@ -2019,23 +2027,24 @@ function createSuite() {
|
|
|
2019
2027
|
});
|
|
2020
2028
|
};
|
|
2021
2029
|
};
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
return
|
|
2030
|
+
suiteFn.skipIf = (condition) => condition ? suite.skip : suite;
|
|
2031
|
+
suiteFn.runIf = (condition) => condition ? suite : suite.skip;
|
|
2032
|
+
return createChainable(["concurrent", "shuffle", "skip", "only", "todo"], suiteFn);
|
|
2025
2033
|
}
|
|
2026
2034
|
function createTest(fn) {
|
|
2027
|
-
const
|
|
2028
|
-
|
|
2029
|
-
|
|
2035
|
+
const testFn = fn;
|
|
2036
|
+
testFn.each = function(cases) {
|
|
2037
|
+
const test2 = this.withContext();
|
|
2038
|
+
return (name, fn2, timeout) => {
|
|
2030
2039
|
cases.forEach((i, idx) => {
|
|
2031
2040
|
const items = Array.isArray(i) ? i : [i];
|
|
2032
|
-
test2(formatTitle(name, items, idx), () => fn2(...items));
|
|
2041
|
+
test2(formatTitle(name, items, idx), () => fn2(...items), timeout);
|
|
2033
2042
|
});
|
|
2034
2043
|
};
|
|
2035
2044
|
};
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
return
|
|
2045
|
+
testFn.skipIf = (condition) => condition ? test.skip : test;
|
|
2046
|
+
testFn.runIf = (condition) => condition ? test : test.skip;
|
|
2047
|
+
return createChainable(["concurrent", "skip", "only", "todo", "fails"], testFn);
|
|
2039
2048
|
}
|
|
2040
2049
|
|
|
2041
2050
|
export { GLOBAL_EXPECT as G, getDefaultHookTimeout as a, globalExpect as b, createExpect as c, describe as d, clearCollectorContext as e, defaultSuite as f, getCurrentSuite as g, setHooks as h, it as i, getHooks as j, collectorContext as k, setState as l, getFn as m, getState as n, createSuiteHooks as o, chai$1 as p, suite as s, test as t, withTimeout as w };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { e as environments, t as takeCoverage, p as pLimit } from './chunk-defaults.
|
|
2
|
-
import { r as resetRunOnceCounter, i as index, v as vi } from './chunk-runtime-hooks.
|
|
3
|
-
import { h as deepClone, k as getType, l as isNode, R as RealDate, t as toArray, o as relativePath, q as isBrowser, u as partitionSuiteChildren, v as shuffle, w as hasTests, x as hasFailed, e as getFullName } from './chunk-mock-date.
|
|
4
|
-
import { e as clearCollectorContext, f as defaultSuite, h as setHooks, j as getHooks, k as collectorContext, l as setState, G as GLOBAL_EXPECT, m as getFn, n as getState } from './chunk-runtime-chain.
|
|
5
|
-
import { r as rpc } from './chunk-runtime-rpc.
|
|
1
|
+
import { e as environments, t as takeCoverage, p as pLimit } from './chunk-defaults.8390340d.mjs';
|
|
2
|
+
import { r as resetRunOnceCounter, i as index, v as vi } from './chunk-runtime-hooks.291644ec.mjs';
|
|
3
|
+
import { h as deepClone, k as getType, l as isNode, R as RealDate, t as toArray, o as relativePath, q as isBrowser, u as partitionSuiteChildren, v as shuffle, w as hasTests, x as hasFailed, e as getFullName } from './chunk-mock-date.ea3b3121.mjs';
|
|
4
|
+
import { e as clearCollectorContext, f as defaultSuite, h as setHooks, j as getHooks, k as collectorContext, l as setState, G as GLOBAL_EXPECT, m as getFn, n as getState } from './chunk-runtime-chain.44b4224d.mjs';
|
|
5
|
+
import { r as rpc } from './chunk-runtime-rpc.fc50dcc0.mjs';
|
|
6
6
|
import util$1 from 'util';
|
|
7
7
|
import { util } from 'chai';
|
|
8
|
-
import { s as stringify } from './chunk-utils-source-map.
|
|
8
|
+
import { s as stringify } from './chunk-utils-source-map.d307e4ea.mjs';
|
|
9
9
|
import { g as getWorkerState } from './chunk-utils-global.fa20c2f6.mjs';
|
|
10
10
|
import { a as safeClearTimeout, s as safeSetTimeout } from './chunk-utils-timers.b48455ed.mjs';
|
|
11
11
|
|
|
@@ -123,6 +123,7 @@ async function setupGlobalEnv(config) {
|
|
|
123
123
|
value: index,
|
|
124
124
|
enumerable: false
|
|
125
125
|
});
|
|
126
|
+
Error.stackTraceLimit = 100;
|
|
126
127
|
setupDefines(config.defines);
|
|
127
128
|
if (globalSetup)
|
|
128
129
|
return;
|
|
@@ -130,7 +131,7 @@ async function setupGlobalEnv(config) {
|
|
|
130
131
|
if (isNode)
|
|
131
132
|
await setupConsoleLogSpy();
|
|
132
133
|
if (config.globals)
|
|
133
|
-
(await import('./chunk-integrations-globals.
|
|
134
|
+
(await import('./chunk-integrations-globals.a798d352.mjs')).registerApiGlobally();
|
|
134
135
|
}
|
|
135
136
|
function setupDefines(defines) {
|
|
136
137
|
for (const key in defines)
|
|
@@ -441,7 +442,7 @@ async function sendTasksUpdate() {
|
|
|
441
442
|
async function runTest(test) {
|
|
442
443
|
var _a, _b;
|
|
443
444
|
if (test.mode !== "run") {
|
|
444
|
-
const { getSnapshotClient } = await import('./chunk-runtime-chain.
|
|
445
|
+
const { getSnapshotClient } = await import('./chunk-runtime-chain.44b4224d.mjs').then(function (n) { return n.p; });
|
|
445
446
|
getSnapshotClient().skipTestSnapshots(test);
|
|
446
447
|
return;
|
|
447
448
|
}
|
|
@@ -457,7 +458,7 @@ async function runTest(test) {
|
|
|
457
458
|
updateTask(test);
|
|
458
459
|
clearModuleMocks();
|
|
459
460
|
if (isNode) {
|
|
460
|
-
const { getSnapshotClient } = await import('./chunk-runtime-chain.
|
|
461
|
+
const { getSnapshotClient } = await import('./chunk-runtime-chain.44b4224d.mjs').then(function (n) { return n.p; });
|
|
461
462
|
await getSnapshotClient().setTest(test);
|
|
462
463
|
}
|
|
463
464
|
const workerState = getWorkerState();
|
|
@@ -510,7 +511,7 @@ async function runTest(test) {
|
|
|
510
511
|
if (isBrowser && test.result.error)
|
|
511
512
|
console.error(test.result.error.message, test.result.error.stackStr);
|
|
512
513
|
if (isNode) {
|
|
513
|
-
const { getSnapshotClient } = await import('./chunk-runtime-chain.
|
|
514
|
+
const { getSnapshotClient } = await import('./chunk-runtime-chain.44b4224d.mjs').then(function (n) { return n.p; });
|
|
514
515
|
getSnapshotClient().clearTest();
|
|
515
516
|
}
|
|
516
517
|
test.result.duration = now() - start;
|
|
@@ -622,7 +623,7 @@ async function startTestsBrowser(paths, config) {
|
|
|
622
623
|
async function startTestsNode(paths, config) {
|
|
623
624
|
const files = await collectTests(paths, config);
|
|
624
625
|
rpc().onCollected(files);
|
|
625
|
-
const { getSnapshotClient } = await import('./chunk-runtime-chain.
|
|
626
|
+
const { getSnapshotClient } = await import('./chunk-runtime-chain.44b4224d.mjs').then(function (n) { return n.p; });
|
|
626
627
|
getSnapshotClient().clear();
|
|
627
628
|
await runFiles(files, config);
|
|
628
629
|
takeCoverage();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { g as getCurrentSuite, w as withTimeout, a as getDefaultHookTimeout, s as suite, t as test, d as describe, i as it, c as createExpect, b as globalExpect } from './chunk-runtime-chain.
|
|
2
|
-
import { R as RealDate, r as resetDate, m as mockDate, a as resetModules } from './chunk-mock-date.
|
|
1
|
+
import { g as getCurrentSuite, w as withTimeout, a as getDefaultHookTimeout, s as suite, t as test, d as describe, i as it, c as createExpect, b as globalExpect } from './chunk-runtime-chain.44b4224d.mjs';
|
|
2
|
+
import { R as RealDate, r as resetDate, m as mockDate, a as resetModules } from './chunk-mock-date.ea3b3121.mjs';
|
|
3
3
|
import { g as getWorkerState } from './chunk-utils-global.fa20c2f6.mjs';
|
|
4
|
-
import { p as parseStacktrace } from './chunk-utils-source-map.
|
|
4
|
+
import { p as parseStacktrace } from './chunk-utils-source-map.d307e4ea.mjs';
|
|
5
5
|
import { c as commonjsGlobal } from './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
6
6
|
import util from 'util';
|
|
7
7
|
import { spyOn, fn, isMockFunction, spies } from './spy.mjs';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { V as ViteNodeRunner } from './chunk-vite-node-client.
|
|
1
|
+
import { V as ViteNodeRunner } from './chunk-vite-node-client.b59ba135.mjs';
|
|
2
2
|
import { normalizePath } from 'vite';
|
|
3
|
-
import { M as isWindows, N as mergeSlashes, d as dirname, j as join, z as basename, y as resolve, s as slash, k as getType, O as
|
|
3
|
+
import { M as isWindows, N as mergeSlashes, d as dirname, j as join, z as basename, y as resolve, s as slash, k as getType, O as getAllMockableProperties } from './chunk-mock-date.ea3b3121.mjs';
|
|
4
4
|
import { existsSync, readdirSync } from 'fs';
|
|
5
|
-
import { n as normalizeRequestId, i as isNodeBuiltin, b as toFilePath } from './chunk-vite-node-utils.
|
|
6
|
-
import { d as distDir } from './chunk-constants.
|
|
5
|
+
import { n as normalizeRequestId, i as isNodeBuiltin, b as toFilePath } from './chunk-vite-node-utils.96438e82.mjs';
|
|
6
|
+
import { d as distDir } from './chunk-constants.9da1ef26.mjs';
|
|
7
7
|
import { g as getWorkerState } from './chunk-utils-global.fa20c2f6.mjs';
|
|
8
8
|
|
|
9
9
|
class RefTracker {
|
|
@@ -123,13 +123,20 @@ const _VitestMocker = class {
|
|
|
123
123
|
const spyModule = _VitestMocker.spyModule;
|
|
124
124
|
const finalizers = new Array();
|
|
125
125
|
const refs = new RefTracker();
|
|
126
|
+
const define = (container, key, value) => {
|
|
127
|
+
try {
|
|
128
|
+
container[key] = value;
|
|
129
|
+
return true;
|
|
130
|
+
} catch {
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
};
|
|
126
134
|
const mockPropertiesOf = (container, newContainer) => {
|
|
127
135
|
const containerType = getType(container);
|
|
128
136
|
const isModule = containerType === "Module" || !!container.__esModule;
|
|
129
|
-
for (const property of
|
|
137
|
+
for (const { key: property, descriptor } of getAllMockableProperties(container)) {
|
|
130
138
|
if (!isModule) {
|
|
131
|
-
|
|
132
|
-
if ((descriptor == null ? void 0 : descriptor.get) || (descriptor == null ? void 0 : descriptor.set))
|
|
139
|
+
if (descriptor.get || descriptor.set)
|
|
133
140
|
continue;
|
|
134
141
|
}
|
|
135
142
|
if (isSpecialProp(property, containerType))
|
|
@@ -137,20 +144,21 @@ const _VitestMocker = class {
|
|
|
137
144
|
const value = container[property];
|
|
138
145
|
const refId = refs.getId(value);
|
|
139
146
|
if (refId) {
|
|
140
|
-
finalizers.push(() => newContainer
|
|
147
|
+
finalizers.push(() => define(newContainer, property, refs.getMockedValue(refId)));
|
|
141
148
|
continue;
|
|
142
149
|
}
|
|
143
150
|
const type = getType(value);
|
|
144
151
|
if (Array.isArray(value)) {
|
|
145
|
-
newContainer
|
|
152
|
+
define(newContainer, property, []);
|
|
146
153
|
continue;
|
|
147
154
|
}
|
|
148
155
|
const isFunction = type.includes("Function") && typeof value === "function";
|
|
149
156
|
if ((!isFunction || value.__isMockFunction) && type !== "Object" && type !== "Module") {
|
|
150
|
-
newContainer
|
|
157
|
+
define(newContainer, property, value);
|
|
151
158
|
continue;
|
|
152
159
|
}
|
|
153
|
-
newContainer
|
|
160
|
+
if (!define(newContainer, property, isFunction ? value : {}))
|
|
161
|
+
continue;
|
|
154
162
|
if (isFunction) {
|
|
155
163
|
spyModule.spyOn(newContainer, property).mockImplementation(() => void 0);
|
|
156
164
|
Object.defineProperty(newContainer[property], "length", { value: 0 });
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createRequire } from 'module';
|
|
2
2
|
import { pathToFileURL, fileURLToPath } from 'url';
|
|
3
3
|
import vm from 'vm';
|
|
4
|
-
import { y as resolve, d as dirname, B as isAbsolute, L as extname } from './chunk-mock-date.
|
|
5
|
-
import { s as slash, n as normalizeRequestId, b as toFilePath, i as isNodeBuiltin, c as isPrimitive, d as normalizeModuleId, m as mergeSlashes } from './chunk-vite-node-utils.
|
|
4
|
+
import { y as resolve, d as dirname, B as isAbsolute, L as extname } from './chunk-mock-date.ea3b3121.mjs';
|
|
5
|
+
import { s as slash, n as normalizeRequestId, b as toFilePath, i as isNodeBuiltin, c as isPrimitive, d as normalizeModuleId, m as mergeSlashes } from './chunk-vite-node-utils.96438e82.mjs';
|
|
6
6
|
import createDebug from 'debug';
|
|
7
7
|
|
|
8
8
|
const debugExecute = createDebug("vite-node:client:execute");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { existsSync, promises } from 'fs';
|
|
2
|
-
import { y as resolve, p as picocolors, j as join } from './chunk-mock-date.
|
|
2
|
+
import { y as resolve, p as picocolors, j as join } from './chunk-mock-date.ea3b3121.mjs';
|
|
3
3
|
import 'path';
|
|
4
4
|
import 'tty';
|
|
5
5
|
import 'local-pkg';
|
package/dist/{chunk-vite-node-externalize.91ae6e85.mjs → chunk-vite-node-externalize.80bed9b3.mjs}
RENAMED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { j as join, z as basename, d as dirname,
|
|
2
|
-
import { p as pLimit, c as configDefaults, r as resolveC8Options, a as cleanCoverage, b as reportCoverage, d as envPackageNames } from './chunk-defaults.
|
|
1
|
+
import { y as resolve, j as join, z as basename, d as dirname, A as AggregateErrorPonyfill, p as picocolors, B as isAbsolute, C as relative, s as slash$2, l as isNode, o as relativePath, D as getTests, e as getFullName, x as hasFailed, E as hasFailedSnapshot, F as getSuites, v as shuffle, t as toArray$1, G as normalize, n as noop$1, H as deepMerge, I as toNamespacedPath, g as getCallLastIndex, f as notNullish, J as ensurePackageInstalled, K as stdout } from './chunk-mock-date.ea3b3121.mjs';
|
|
2
|
+
import { p as pLimit, c as configDefaults, r as resolveC8Options, a as cleanCoverage, b as reportCoverage, d as envPackageNames } from './chunk-defaults.8390340d.mjs';
|
|
3
3
|
import { loadConfigFromFile, createServer, mergeConfig } from 'vite';
|
|
4
4
|
import path$a from 'path';
|
|
5
5
|
import _url, { fileURLToPath } from 'url';
|
|
6
6
|
import process$1 from 'process';
|
|
7
7
|
import fs$8, { promises, existsSync, readFileSync } from 'fs';
|
|
8
|
-
import { d as distDir, r as rootDir, c as configFiles, a as defaultPort } from './chunk-constants.
|
|
8
|
+
import { d as distDir, r as rootDir, c as configFiles, a as defaultPort } from './chunk-constants.9da1ef26.mjs';
|
|
9
9
|
import require$$0, { cpus, hostname } from 'os';
|
|
10
10
|
import util$2 from 'util';
|
|
11
11
|
import require$$0$1 from 'stream';
|
|
12
12
|
import require$$2 from 'events';
|
|
13
13
|
import { c as commonjsGlobal } from './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
14
|
-
import { c as createBirpc, V as ViteNodeRunner } from './chunk-vite-node-client.
|
|
14
|
+
import { c as createBirpc, V as ViteNodeRunner } from './chunk-vite-node-client.b59ba135.mjs';
|
|
15
15
|
import createDebug from 'debug';
|
|
16
|
-
import { i as isNodeBuiltin, a as isValidNodeImport, s as slash$1, t as toArray, b as toFilePath, w as withInlineSourcemap } from './chunk-vite-node-utils.
|
|
16
|
+
import { i as isNodeBuiltin, a as isValidNodeImport, s as slash$1, t as toArray, b as toFilePath, w as withInlineSourcemap } from './chunk-vite-node-utils.96438e82.mjs';
|
|
17
17
|
import { MessageChannel } from 'worker_threads';
|
|
18
18
|
import { Tinypool } from 'tinypool';
|
|
19
19
|
import { performance } from 'perf_hooks';
|
|
20
|
-
import { c as stripAnsi, d as cliTruncate, p as parseStacktrace, e as stringWidth, h as ansiStyles, i as sliceAnsi, j as interpretSourcePos, s as stringify$5, u as unifiedDiff, b as posToNumber, l as lineSplitRE } from './chunk-utils-source-map.
|
|
20
|
+
import { c as stripAnsi, d as cliTruncate, p as parseStacktrace, e as stringWidth, h as ansiStyles, i as sliceAnsi, j as interpretSourcePos, s as stringify$5, u as unifiedDiff, b as posToNumber, l as lineSplitRE } from './chunk-utils-source-map.d307e4ea.mjs';
|
|
21
21
|
import { b as safeSetInterval, c as safeClearInterval, s as safeSetTimeout, a as safeClearTimeout } from './chunk-utils-timers.b48455ed.mjs';
|
|
22
22
|
import { resolveModule } from 'local-pkg';
|
|
23
23
|
import { createHash } from 'crypto';
|
|
@@ -26,7 +26,7 @@ import MagicString from './chunk-magic-string.efe26975.mjs';
|
|
|
26
26
|
import require$$0$2 from 'readline';
|
|
27
27
|
import { p as prompts } from './vendor-index.de788b6a.mjs';
|
|
28
28
|
|
|
29
|
-
var version$1 = "0.
|
|
29
|
+
var version$1 = "0.21.0";
|
|
30
30
|
|
|
31
31
|
class EndError extends Error {
|
|
32
32
|
constructor(value) {
|
|
@@ -6850,14 +6850,14 @@ class ViteNodeServer {
|
|
|
6850
6850
|
}, options.debug ?? {});
|
|
6851
6851
|
}
|
|
6852
6852
|
if (options.debug)
|
|
6853
|
-
import('./chunk-vite-node-debug.
|
|
6853
|
+
import('./chunk-vite-node-debug.dbce2e1f.mjs').then((r) => this.debugger = new r.Debugger(server.config.root, options.debug));
|
|
6854
6854
|
}
|
|
6855
6855
|
shouldExternalize(id) {
|
|
6856
6856
|
return shouldExternalize(id, this.options.deps, this.externalizeCache);
|
|
6857
6857
|
}
|
|
6858
6858
|
async resolveId(id, importer) {
|
|
6859
6859
|
if (importer && !importer.startsWith(this.server.config.root))
|
|
6860
|
-
importer =
|
|
6860
|
+
importer = resolve(this.server.config.root, importer);
|
|
6861
6861
|
const mode = importer && this.getTransformMode(importer) || "ssr";
|
|
6862
6862
|
return this.server.pluginContainer.resolveId(id, importer, { ssr: mode === "ssr" });
|
|
6863
6863
|
}
|
|
@@ -8250,6 +8250,11 @@ function createReporters(reporterReferences, runner) {
|
|
|
8250
8250
|
return Promise.all(promisedReporters);
|
|
8251
8251
|
}
|
|
8252
8252
|
|
|
8253
|
+
const isAggregateError = (err) => {
|
|
8254
|
+
if (typeof AggregateError !== "undefined" && err instanceof AggregateError)
|
|
8255
|
+
return true;
|
|
8256
|
+
return err instanceof Error && "errors" in err;
|
|
8257
|
+
};
|
|
8253
8258
|
class StateManager {
|
|
8254
8259
|
constructor() {
|
|
8255
8260
|
this.filesMap = /* @__PURE__ */ new Map();
|
|
@@ -8260,6 +8265,8 @@ class StateManager {
|
|
|
8260
8265
|
this.errorsSet = /* @__PURE__ */ new Set();
|
|
8261
8266
|
}
|
|
8262
8267
|
catchError(err, type) {
|
|
8268
|
+
if (isAggregateError(err))
|
|
8269
|
+
return err.errors.forEach((error) => this.catchError(error, type));
|
|
8263
8270
|
err.type = type;
|
|
8264
8271
|
this.errorsSet.add(err);
|
|
8265
8272
|
}
|
|
@@ -8573,7 +8580,7 @@ function resolveConfig(options, viteConfig) {
|
|
|
8573
8580
|
resolved.deps.inline.push(...extraInlineDeps);
|
|
8574
8581
|
}
|
|
8575
8582
|
}
|
|
8576
|
-
(_c = resolved.deps).registerNodeLoader ?? (_c.registerNodeLoader =
|
|
8583
|
+
(_c = resolved.deps).registerNodeLoader ?? (_c.registerNodeLoader = false);
|
|
8577
8584
|
resolved.testNamePattern = resolved.testNamePattern ? resolved.testNamePattern instanceof RegExp ? resolved.testNamePattern : new RegExp(resolved.testNamePattern) : void 0;
|
|
8578
8585
|
const CI = !!process.env.CI;
|
|
8579
8586
|
const UPDATE_SNAPSHOT = resolved.update || process.env.UPDATE_SNAPSHOT;
|
|
@@ -9099,7 +9106,7 @@ createLogUpdate(process$1.stdout);
|
|
|
9099
9106
|
|
|
9100
9107
|
createLogUpdate(process$1.stderr);
|
|
9101
9108
|
|
|
9102
|
-
var version = "0.
|
|
9109
|
+
var version = "0.21.0";
|
|
9103
9110
|
|
|
9104
9111
|
function fileFromParsedStack(stack) {
|
|
9105
9112
|
var _a, _b;
|
|
@@ -9466,7 +9473,7 @@ class Vitest {
|
|
|
9466
9473
|
}
|
|
9467
9474
|
async filterTestsBySource(tests) {
|
|
9468
9475
|
if (this.config.changed && !this.config.related) {
|
|
9469
|
-
const { VitestGit } = await import('./chunk-node-git.
|
|
9476
|
+
const { VitestGit } = await import('./chunk-node-git.e0dc0a7e.mjs');
|
|
9470
9477
|
const vitestGit = new VitestGit(this.config.root);
|
|
9471
9478
|
const related2 = await vitestGit.findChangedFiles({
|
|
9472
9479
|
changedSince: this.config.changed
|
|
@@ -9968,6 +9975,9 @@ async function VitestPlugin(options = {}, ctx = new Vitest()) {
|
|
|
9968
9975
|
{
|
|
9969
9976
|
name: "vitest",
|
|
9970
9977
|
enforce: "pre",
|
|
9978
|
+
options() {
|
|
9979
|
+
this.meta.watchMode = false;
|
|
9980
|
+
},
|
|
9971
9981
|
config(viteConfig) {
|
|
9972
9982
|
const preOptions = deepMerge({}, configDefaults, options, viteConfig.test ?? {});
|
|
9973
9983
|
preOptions.api = resolveApiConfig(preOptions);
|
|
@@ -10052,7 +10062,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest()) {
|
|
|
10052
10062
|
await ctx.setServer(options, server);
|
|
10053
10063
|
haveStarted = true;
|
|
10054
10064
|
if (options.api && options.watch)
|
|
10055
|
-
(await import('./chunk-api-setup.
|
|
10065
|
+
(await import('./chunk-api-setup.89eb0e7a.mjs')).setup(ctx);
|
|
10056
10066
|
} catch (err) {
|
|
10057
10067
|
ctx.logger.printError(err, true);
|
|
10058
10068
|
process.exit(1);
|
|
@@ -4,7 +4,7 @@ import { pathToFileURL, fileURLToPath as fileURLToPath$1, URL as URL$1 } from 'u
|
|
|
4
4
|
import fs, { promises, statSync, existsSync, realpathSync, Stats } from 'fs';
|
|
5
5
|
import assert from 'assert';
|
|
6
6
|
import { format, inspect } from 'util';
|
|
7
|
-
import { y as resolve$1 } from './chunk-mock-date.
|
|
7
|
+
import { y as resolve$1 } from './chunk-mock-date.ea3b3121.mjs';
|
|
8
8
|
|
|
9
9
|
function normalizeWindowsPath(input = "") {
|
|
10
10
|
if (!input.includes("\\")) {
|
|
@@ -1111,4 +1111,4 @@ function toArray(array) {
|
|
|
1111
1111
|
return [array];
|
|
1112
1112
|
}
|
|
1113
1113
|
|
|
1114
|
-
export { isValidNodeImport as a, toFilePath as b, isPrimitive as c, normalizeModuleId as d, isNodeBuiltin as i, mergeSlashes as m, normalizeRequestId as n, slash as s, toArray as t, withInlineSourcemap as w };
|
|
1114
|
+
export { isValidNodeImport as a, toFilePath as b, isPrimitive as c, normalizeModuleId as d, hasCJSSyntax as h, isNodeBuiltin as i, mergeSlashes as m, normalizeRequestId as n, slash as s, toArray as t, withInlineSourcemap as w };
|
package/dist/cli.mjs
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import { EventEmitter } from 'events';
|
|
2
|
-
import { p as picocolors } from './chunk-mock-date.
|
|
3
|
-
import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.
|
|
2
|
+
import { p as picocolors } from './chunk-mock-date.ea3b3121.mjs';
|
|
3
|
+
import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.80bed9b3.mjs';
|
|
4
4
|
import 'path';
|
|
5
5
|
import 'tty';
|
|
6
6
|
import 'local-pkg';
|
|
7
|
-
import './chunk-defaults.
|
|
7
|
+
import './chunk-defaults.8390340d.mjs';
|
|
8
8
|
import 'fs';
|
|
9
9
|
import 'module';
|
|
10
10
|
import 'url';
|
|
11
11
|
import 'vite';
|
|
12
12
|
import 'process';
|
|
13
|
-
import './chunk-constants.
|
|
13
|
+
import './chunk-constants.9da1ef26.mjs';
|
|
14
14
|
import 'os';
|
|
15
15
|
import 'util';
|
|
16
16
|
import 'stream';
|
|
17
17
|
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
18
|
-
import './chunk-vite-node-client.
|
|
18
|
+
import './chunk-vite-node-client.b59ba135.mjs';
|
|
19
19
|
import 'vm';
|
|
20
|
-
import './chunk-vite-node-utils.
|
|
20
|
+
import './chunk-vite-node-utils.96438e82.mjs';
|
|
21
21
|
import 'assert';
|
|
22
22
|
import 'debug';
|
|
23
23
|
import 'worker_threads';
|
|
24
24
|
import 'tinypool';
|
|
25
25
|
import 'perf_hooks';
|
|
26
|
-
import './chunk-utils-source-map.
|
|
26
|
+
import './chunk-utils-source-map.d307e4ea.mjs';
|
|
27
27
|
import './chunk-utils-timers.b48455ed.mjs';
|
|
28
28
|
import 'crypto';
|
|
29
29
|
import './vendor-index.61438b77.mjs';
|