vitest 0.10.0 → 0.10.1
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/{chunk-api-setup.d70fc960.js → chunk-api-setup.b55307fb.js} +40 -17
- package/dist/{chunk-constants.d540b1d1.js → chunk-constants.90075174.js} +1 -1
- package/dist/{chunk-defaults.04d5d90b.js → chunk-defaults.fd5b939d.js} +1 -1
- package/dist/{chunk-integrations-globals.d2c09cd2.js → chunk-integrations-globals.a759742a.js} +7 -7
- package/dist/{chunk-runtime-chain.f863f182.js → chunk-runtime-chain.6292a3de.js} +14 -8
- package/dist/{chunk-runtime-mocker.111ac858.js → chunk-runtime-mocker.ca5ecf98.js} +5 -21
- package/dist/{chunk-runtime-rpc.8f648236.js → chunk-runtime-rpc.8e14ae4f.js} +1 -1
- package/dist/{chunk-utils-global.37a7c822.js → chunk-utils-global.9b434e81.js} +35 -1
- package/dist/{chunk-utils-timers.12bc05d1.js → chunk-utils-timers.c50fec92.js} +3 -1
- package/dist/{chunk-vite-node-externalize.5c678054.js → chunk-vite-node-externalize.4dd7260b.js} +111 -36
- package/dist/{chunk-vite-node-utils.33447cc0.js → chunk-vite-node-utils.c160b239.js} +3 -1
- package/dist/cli.js +6 -6
- package/dist/entry.js +6 -6
- package/dist/index.d.ts +17 -7
- package/dist/index.js +4 -4
- package/dist/node.d.ts +11 -6
- package/dist/node.js +7 -7
- package/dist/{vendor-entry.369fd6c9.js → vendor-entry.9dd6e6e6.js} +53 -16
- package/dist/worker.js +8 -5
- package/package.json +9 -10
- package/vitest.mjs +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { promises } from 'fs';
|
|
2
|
-
import { c as createBirpc } from './chunk-vite-node-utils.
|
|
2
|
+
import { c as createBirpc } from './chunk-vite-node-utils.c160b239.js';
|
|
3
3
|
import require$$0$1 from 'stream';
|
|
4
4
|
import require$$0 from 'zlib';
|
|
5
5
|
import require$$3 from 'net';
|
|
@@ -9,11 +9,11 @@ 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 { r as interpretSourcePos, b as parseStacktrace } from './chunk-utils-timers.
|
|
12
|
+
import { A as API_PATH } from './chunk-constants.90075174.js';
|
|
13
|
+
import { r as interpretSourcePos, b as parseStacktrace } from './chunk-utils-timers.c50fec92.js';
|
|
14
14
|
import 'module';
|
|
15
15
|
import 'vm';
|
|
16
|
-
import './chunk-utils-global.
|
|
16
|
+
import './chunk-utils-global.9b434e81.js';
|
|
17
17
|
import 'tty';
|
|
18
18
|
import 'local-pkg';
|
|
19
19
|
import 'path';
|
|
@@ -2526,10 +2526,11 @@ const {
|
|
|
2526
2526
|
const { format, parse: parse$1 } = extension$1;
|
|
2527
2527
|
const { toBuffer } = bufferUtil$1.exports;
|
|
2528
2528
|
|
|
2529
|
+
const closeTimeout = 30 * 1000;
|
|
2530
|
+
const kAborted = Symbol('kAborted');
|
|
2531
|
+
const protocolVersions = [8, 13];
|
|
2529
2532
|
const readyStates = ['CONNECTING', 'OPEN', 'CLOSING', 'CLOSED'];
|
|
2530
2533
|
const subprotocolRegex = /^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;
|
|
2531
|
-
const protocolVersions = [8, 13];
|
|
2532
|
-
const closeTimeout = 30 * 1000;
|
|
2533
2534
|
|
|
2534
2535
|
/**
|
|
2535
2536
|
* Class representing a WebSocket.
|
|
@@ -3143,7 +3144,7 @@ function initAsClient(websocket, address, protocols, options) {
|
|
|
3143
3144
|
hostname: undefined,
|
|
3144
3145
|
protocol: undefined,
|
|
3145
3146
|
timeout: undefined,
|
|
3146
|
-
method:
|
|
3147
|
+
method: 'GET',
|
|
3147
3148
|
host: undefined,
|
|
3148
3149
|
path: undefined,
|
|
3149
3150
|
port: undefined
|
|
@@ -3197,7 +3198,7 @@ function initAsClient(websocket, address, protocols, options) {
|
|
|
3197
3198
|
|
|
3198
3199
|
const defaultPort = isSecure ? 443 : 80;
|
|
3199
3200
|
const key = randomBytes(16).toString('base64');
|
|
3200
|
-
const
|
|
3201
|
+
const request = isSecure ? https.request : http$1.request;
|
|
3201
3202
|
const protocolSet = new Set();
|
|
3202
3203
|
let perMessageDeflate;
|
|
3203
3204
|
|
|
@@ -3262,6 +3263,8 @@ function initAsClient(websocket, address, protocols, options) {
|
|
|
3262
3263
|
opts.path = parts[1];
|
|
3263
3264
|
}
|
|
3264
3265
|
|
|
3266
|
+
let req;
|
|
3267
|
+
|
|
3265
3268
|
if (opts.followRedirects) {
|
|
3266
3269
|
if (websocket._redirects === 0) {
|
|
3267
3270
|
websocket._originalHost = parsedUrl.host;
|
|
@@ -3279,7 +3282,10 @@ function initAsClient(websocket, address, protocols, options) {
|
|
|
3279
3282
|
options.headers[key.toLowerCase()] = value;
|
|
3280
3283
|
}
|
|
3281
3284
|
}
|
|
3282
|
-
} else if (
|
|
3285
|
+
} else if (
|
|
3286
|
+
websocket.listenerCount('redirect') === 0 &&
|
|
3287
|
+
parsedUrl.host !== websocket._originalHost
|
|
3288
|
+
) {
|
|
3283
3289
|
//
|
|
3284
3290
|
// Match curl 7.77.0 behavior and drop the following headers. These
|
|
3285
3291
|
// headers are also dropped when following a redirect to a subdomain.
|
|
@@ -3299,9 +3305,24 @@ function initAsClient(websocket, address, protocols, options) {
|
|
|
3299
3305
|
options.headers.authorization =
|
|
3300
3306
|
'Basic ' + Buffer.from(opts.auth).toString('base64');
|
|
3301
3307
|
}
|
|
3302
|
-
}
|
|
3303
3308
|
|
|
3304
|
-
|
|
3309
|
+
req = websocket._req = request(opts);
|
|
3310
|
+
|
|
3311
|
+
if (websocket._redirects) {
|
|
3312
|
+
//
|
|
3313
|
+
// Unlike what is done for the `'upgrade'` event, no early exit is
|
|
3314
|
+
// triggered here if the user calls `websocket.close()` or
|
|
3315
|
+
// `websocket.terminate()` from a listener of the `'redirect'` event. This
|
|
3316
|
+
// is because the user can also call `request.destroy()` with an error
|
|
3317
|
+
// before calling `websocket.close()` or `websocket.terminate()` and this
|
|
3318
|
+
// would result in an error being emitted on the `request` object with no
|
|
3319
|
+
// `'error'` event listeners attached.
|
|
3320
|
+
//
|
|
3321
|
+
websocket.emit('redirect', websocket.url, req);
|
|
3322
|
+
}
|
|
3323
|
+
} else {
|
|
3324
|
+
req = websocket._req = request(opts);
|
|
3325
|
+
}
|
|
3305
3326
|
|
|
3306
3327
|
if (opts.timeout) {
|
|
3307
3328
|
req.on('timeout', () => {
|
|
@@ -3310,7 +3331,7 @@ function initAsClient(websocket, address, protocols, options) {
|
|
|
3310
3331
|
}
|
|
3311
3332
|
|
|
3312
3333
|
req.on('error', (err) => {
|
|
3313
|
-
if (req === null || req
|
|
3334
|
+
if (req === null || req[kAborted]) return;
|
|
3314
3335
|
|
|
3315
3336
|
req = websocket._req = null;
|
|
3316
3337
|
emitErrorAndClose(websocket, err);
|
|
@@ -3357,8 +3378,8 @@ function initAsClient(websocket, address, protocols, options) {
|
|
|
3357
3378
|
websocket.emit('upgrade', res);
|
|
3358
3379
|
|
|
3359
3380
|
//
|
|
3360
|
-
// The user may have closed the connection from a listener of the
|
|
3361
|
-
// event.
|
|
3381
|
+
// The user may have closed the connection from a listener of the
|
|
3382
|
+
// `'upgrade'` event.
|
|
3362
3383
|
//
|
|
3363
3384
|
if (websocket.readyState !== WebSocket$1.CONNECTING) return;
|
|
3364
3385
|
|
|
@@ -3443,10 +3464,12 @@ function initAsClient(websocket, address, protocols, options) {
|
|
|
3443
3464
|
skipUTF8Validation: opts.skipUTF8Validation
|
|
3444
3465
|
});
|
|
3445
3466
|
});
|
|
3467
|
+
|
|
3468
|
+
req.end();
|
|
3446
3469
|
}
|
|
3447
3470
|
|
|
3448
3471
|
/**
|
|
3449
|
-
* Emit the `'error'` and `'close'`
|
|
3472
|
+
* Emit the `'error'` and `'close'` events.
|
|
3450
3473
|
*
|
|
3451
3474
|
* @param {WebSocket} websocket The WebSocket instance
|
|
3452
3475
|
* @param {Error} The error to emit
|
|
@@ -3503,6 +3526,7 @@ function abortHandshake$1(websocket, stream, message) {
|
|
|
3503
3526
|
Error.captureStackTrace(err, abortHandshake$1);
|
|
3504
3527
|
|
|
3505
3528
|
if (stream.setHeader) {
|
|
3529
|
+
stream[kAborted] = true;
|
|
3506
3530
|
stream.abort();
|
|
3507
3531
|
|
|
3508
3532
|
if (stream.socket && !stream.socket.destroyed) {
|
|
@@ -3514,8 +3538,7 @@ function abortHandshake$1(websocket, stream, message) {
|
|
|
3514
3538
|
stream.socket.destroy();
|
|
3515
3539
|
}
|
|
3516
3540
|
|
|
3517
|
-
|
|
3518
|
-
websocket.emit('error', err);
|
|
3541
|
+
process.nextTick(emitErrorAndClose, websocket, err);
|
|
3519
3542
|
} else {
|
|
3520
3543
|
stream.destroy(err);
|
|
3521
3544
|
stream.once('error', websocket.emit.bind(websocket, 'error'));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { fileURLToPath } from 'url';
|
|
2
|
-
import { k as resolve } from './chunk-utils-global.
|
|
2
|
+
import { k as resolve } from './chunk-utils-global.9b434e81.js';
|
|
3
3
|
|
|
4
4
|
const distDir = resolve(fileURLToPath(import.meta.url), "../../dist");
|
|
5
5
|
const defaultPort = 51204;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { existsSync, promises } from 'fs';
|
|
2
2
|
import { createRequire } from 'module';
|
|
3
3
|
import { pathToFileURL } from 'url';
|
|
4
|
-
import { t as toArray, k as resolve } from './chunk-utils-global.
|
|
4
|
+
import { t as toArray, k as resolve } from './chunk-utils-global.9b434e81.js';
|
|
5
5
|
|
|
6
6
|
const defaultInclude = ["**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"];
|
|
7
7
|
const defaultExclude = ["**/node_modules/**", "**/dist/**", "**/cypress/**", "**/.{idea,git,cache,output,temp}/**"];
|
package/dist/{chunk-integrations-globals.d2c09cd2.js → chunk-integrations-globals.a759742a.js}
RENAMED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { g as globalApis } from './chunk-constants.
|
|
2
|
-
import { i as index } from './vendor-entry.
|
|
1
|
+
import { g as globalApis } from './chunk-constants.90075174.js';
|
|
2
|
+
import { i as index } from './vendor-entry.9dd6e6e6.js';
|
|
3
3
|
import 'url';
|
|
4
|
-
import './chunk-utils-global.
|
|
4
|
+
import './chunk-utils-global.9b434e81.js';
|
|
5
5
|
import 'tty';
|
|
6
6
|
import 'local-pkg';
|
|
7
7
|
import 'path';
|
|
8
8
|
import 'fs';
|
|
9
9
|
import 'console';
|
|
10
10
|
import 'stream';
|
|
11
|
-
import './chunk-runtime-chain.
|
|
11
|
+
import './chunk-runtime-chain.6292a3de.js';
|
|
12
12
|
import 'chai';
|
|
13
13
|
import './vendor-_commonjsHelpers.addc3445.js';
|
|
14
|
-
import './chunk-runtime-rpc.
|
|
15
|
-
import './chunk-utils-timers.
|
|
14
|
+
import './chunk-runtime-rpc.8e14ae4f.js';
|
|
15
|
+
import './chunk-utils-timers.c50fec92.js';
|
|
16
16
|
import './chunk-integrations-spy.f036df6f.js';
|
|
17
17
|
import 'tinyspy';
|
|
18
18
|
import 'util';
|
|
19
|
-
import './chunk-defaults.
|
|
19
|
+
import './chunk-defaults.fd5b939d.js';
|
|
20
20
|
import 'module';
|
|
21
21
|
import 'crypto';
|
|
22
22
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import chai$1, { expect as expect$1, util } from 'chai';
|
|
2
2
|
import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js';
|
|
3
|
-
import { r as rpc } from './chunk-runtime-rpc.
|
|
4
|
-
import { i as isObject, a as index, g as getCallLastIndex, s as slash, b as getWorkerState, c as getNames, d as assertTypes, p as picocolors, n as noop, t as toArray, r as resetModules } from './chunk-utils-global.
|
|
3
|
+
import { r as rpc } from './chunk-runtime-rpc.8e14ae4f.js';
|
|
4
|
+
import { i as isObject, a as index, g as getCallLastIndex, s as slash, b as getWorkerState, c as getNames, d as assertTypes, p as picocolors, n as noop, t as toArray, r as resetModules } from './chunk-utils-global.9b434e81.js';
|
|
5
5
|
import fs, { promises } from 'fs';
|
|
6
|
-
import { p as plugins_1, f as format_1, g as getOriginalPos, a as posToNumber, n as numberToPos, l as lineSplitRE, b as parseStacktrace, u as unifiedDiff, s as stringify, m as matcherUtils, c as setTimeout, d as clearTimeout } from './chunk-utils-timers.
|
|
6
|
+
import { p as plugins_1, f as format_1, g as getOriginalPos, a as posToNumber, n as numberToPos, l as lineSplitRE, b as parseStacktrace, u as unifiedDiff, s as stringify, m as matcherUtils, c as setTimeout, d as clearTimeout } from './chunk-utils-timers.c50fec92.js';
|
|
7
7
|
import { i as isMockFunction, s as spyOn, f as fn, a as spies } from './chunk-integrations-spy.f036df6f.js';
|
|
8
8
|
import require$$0, { format } from 'util';
|
|
9
9
|
|
|
@@ -1307,8 +1307,8 @@ Number of calls: ${picocolors.exports.bold(spy.mock.calls.length)}
|
|
|
1307
1307
|
def(["toHaveReturnedTimes", "toReturnTimes"], function(times) {
|
|
1308
1308
|
const spy = getSpy(this);
|
|
1309
1309
|
const spyName = spy.getMockName();
|
|
1310
|
-
const
|
|
1311
|
-
this.assert(
|
|
1310
|
+
const successfulReturns = spy.mock.results.reduce((success, { type }) => type === "throw" ? success : ++success, 0);
|
|
1311
|
+
this.assert(successfulReturns === times, `expected "${spyName}" to be successfully called ${times} times`, `expected "${spyName}" to not be successfully called ${times} times`, `expected number of returns: ${times}`, `received number of returns: ${successfulReturns}`);
|
|
1312
1312
|
});
|
|
1313
1313
|
def(["toHaveReturnedWith", "toReturnWith"], function(value) {
|
|
1314
1314
|
const spy = getSpy(this);
|
|
@@ -1764,7 +1764,7 @@ function withTimeout(fn, timeout = getDefaultTestTimeout(), isHook = false) {
|
|
|
1764
1764
|
}
|
|
1765
1765
|
function createTestContext(test) {
|
|
1766
1766
|
const context = function() {
|
|
1767
|
-
throw new Error("done() callback is
|
|
1767
|
+
throw new Error("done() callback is deprecated, use promise instead");
|
|
1768
1768
|
};
|
|
1769
1769
|
context.meta = test;
|
|
1770
1770
|
let _expect;
|
|
@@ -1919,6 +1919,8 @@ function createSuite() {
|
|
|
1919
1919
|
});
|
|
1920
1920
|
};
|
|
1921
1921
|
};
|
|
1922
|
+
suite2.skipIf = (condition) => condition ? suite2.skip : suite2;
|
|
1923
|
+
suite2.runIf = (condition) => condition ? suite2 : suite2.skip;
|
|
1922
1924
|
return suite2;
|
|
1923
1925
|
}
|
|
1924
1926
|
function createTest(fn) {
|
|
@@ -1931,6 +1933,8 @@ function createTest(fn) {
|
|
|
1931
1933
|
});
|
|
1932
1934
|
};
|
|
1933
1935
|
};
|
|
1936
|
+
test2.skipIf = (condition) => condition ? test2.skip : test2;
|
|
1937
|
+
test2.runIf = (condition) => condition ? test2 : test2.skip;
|
|
1934
1938
|
return test2;
|
|
1935
1939
|
}
|
|
1936
1940
|
|
|
@@ -4632,8 +4636,10 @@ class VitestUtils {
|
|
|
4632
4636
|
});
|
|
4633
4637
|
this._mocker = typeof __vitest_mocker__ !== "undefined" ? __vitest_mocker__ : null;
|
|
4634
4638
|
this._mockedDate = null;
|
|
4635
|
-
if (!this._mocker)
|
|
4636
|
-
|
|
4639
|
+
if (!this._mocker) {
|
|
4640
|
+
const errorMsg = 'Vitest was initialized with native Node instead of Vite Node.\n\nOne of the following is possible:\n- "vitest" is imported outside of your tests (in that case, use "vitest/node" or import.meta.vitest)\n- "vitest" is imported inside "globalSetup" (use "setupFiles", because "globalSetup" runs in a different context)\n- Your dependency inside "node_modules" imports "vitest" directly (in that case, inline that dependency, using "deps.inline" config)\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n';
|
|
4641
|
+
throw new Error(errorMsg);
|
|
4642
|
+
}
|
|
4637
4643
|
}
|
|
4638
4644
|
useFakeTimers() {
|
|
4639
4645
|
this._timers.useFakeTimers();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as normalizeRequestId, i as isNodeBuiltin, t as toFilePath, V as ViteNodeRunner } from './chunk-vite-node-utils.
|
|
1
|
+
import { n as normalizeRequestId, i as isNodeBuiltin, t as toFilePath, V as ViteNodeRunner } from './chunk-vite-node-utils.c160b239.js';
|
|
2
2
|
import { normalizePath } from 'vite';
|
|
3
|
-
import { b as getWorkerState, B as isWindows, C as mergeSlashes, h as dirname, f as basename, k as resolve, s as slash } from './chunk-utils-global.
|
|
3
|
+
import { b as getWorkerState, B as isWindows, C as mergeSlashes, h as dirname, f as basename, k as resolve, D as getType, E as getAllProperties, s as slash } from './chunk-utils-global.9b434e81.js';
|
|
4
4
|
import { existsSync, readdirSync } from 'fs';
|
|
5
|
-
import { d as distDir } from './chunk-constants.
|
|
5
|
+
import { d as distDir } from './chunk-constants.90075174.js';
|
|
6
6
|
|
|
7
7
|
var __defProp = Object.defineProperty;
|
|
8
8
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
@@ -20,22 +20,6 @@ var __spreadValues = (a, b) => {
|
|
|
20
20
|
}
|
|
21
21
|
return a;
|
|
22
22
|
};
|
|
23
|
-
function getType(value) {
|
|
24
|
-
return Object.prototype.toString.apply(value).slice(8, -1);
|
|
25
|
-
}
|
|
26
|
-
function getAllProperties(obj) {
|
|
27
|
-
const allProps = /* @__PURE__ */ new Set();
|
|
28
|
-
let curr = obj;
|
|
29
|
-
do {
|
|
30
|
-
if (curr === Object.prototype || curr === Function.prototype || curr === RegExp.prototype)
|
|
31
|
-
break;
|
|
32
|
-
const props = Object.getOwnPropertyNames(curr);
|
|
33
|
-
const symbs = Object.getOwnPropertySymbols(curr);
|
|
34
|
-
props.forEach((prop) => allProps.add(prop));
|
|
35
|
-
symbs.forEach((symb) => allProps.add(symb));
|
|
36
|
-
} while (curr = Object.getPrototypeOf(curr));
|
|
37
|
-
return Array.from(allProps);
|
|
38
|
-
}
|
|
39
23
|
const _VitestMocker = class {
|
|
40
24
|
constructor(options, moduleCache, request) {
|
|
41
25
|
this.options = options;
|
|
@@ -136,8 +120,8 @@ const _VitestMocker = class {
|
|
|
136
120
|
else if (type !== "Object" && type !== "Module")
|
|
137
121
|
return value;
|
|
138
122
|
const newObj = {};
|
|
139
|
-
const
|
|
140
|
-
for (const k of
|
|
123
|
+
const properties = getAllProperties(value);
|
|
124
|
+
for (const k of properties) {
|
|
141
125
|
newObj[k] = this.mockValue(value[k]);
|
|
142
126
|
const type2 = getType(value[k]);
|
|
143
127
|
if (type2.includes("Function") && !value[k]._isMockFunction) {
|
|
@@ -250,6 +250,19 @@ function getWorkerState() {
|
|
|
250
250
|
return globalThis.__vitest_worker__;
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
+
function getAllProperties(obj) {
|
|
254
|
+
const allProps = /* @__PURE__ */ new Set();
|
|
255
|
+
let curr = obj;
|
|
256
|
+
do {
|
|
257
|
+
if (curr === Object.prototype || curr === Function.prototype || curr === RegExp.prototype)
|
|
258
|
+
break;
|
|
259
|
+
const props = Object.getOwnPropertyNames(curr);
|
|
260
|
+
const symbs = Object.getOwnPropertySymbols(curr);
|
|
261
|
+
props.forEach((prop) => allProps.add(prop));
|
|
262
|
+
symbs.forEach((symb) => allProps.add(symb));
|
|
263
|
+
} while (curr = Object.getPrototypeOf(curr));
|
|
264
|
+
return Array.from(allProps);
|
|
265
|
+
}
|
|
253
266
|
function notNullish(v) {
|
|
254
267
|
return v != null;
|
|
255
268
|
}
|
|
@@ -261,6 +274,27 @@ function mergeSlashes(str) {
|
|
|
261
274
|
}
|
|
262
275
|
const noop = () => {
|
|
263
276
|
};
|
|
277
|
+
function getType(value) {
|
|
278
|
+
return Object.prototype.toString.apply(value).slice(8, -1);
|
|
279
|
+
}
|
|
280
|
+
function clone(val) {
|
|
281
|
+
let k, out, tmp;
|
|
282
|
+
if (Array.isArray(val)) {
|
|
283
|
+
out = Array(k = val.length);
|
|
284
|
+
while (k--)
|
|
285
|
+
out[k] = (tmp = val[k]) && typeof tmp === "object" ? clone(tmp) : tmp;
|
|
286
|
+
return out;
|
|
287
|
+
}
|
|
288
|
+
if (Object.prototype.toString.call(val) === "[object Object]") {
|
|
289
|
+
out = Object.create(Object.getPrototypeOf(val));
|
|
290
|
+
const props = getAllProperties(val);
|
|
291
|
+
for (const k2 of props) {
|
|
292
|
+
out[k2] = (tmp = val[k2]) && typeof tmp === "object" ? clone(tmp) : tmp;
|
|
293
|
+
}
|
|
294
|
+
return out;
|
|
295
|
+
}
|
|
296
|
+
return val;
|
|
297
|
+
}
|
|
264
298
|
function toArray(array) {
|
|
265
299
|
if (array === null || array === void 0)
|
|
266
300
|
array = [];
|
|
@@ -420,4 +454,4 @@ function getCallLastIndex(code) {
|
|
|
420
454
|
return null;
|
|
421
455
|
}
|
|
422
456
|
|
|
423
|
-
export { extname as A, isWindows as B, mergeSlashes as C,
|
|
457
|
+
export { extname as A, isWindows as B, mergeSlashes as C, getType as D, getAllProperties as E, clone as F, partitionSuiteChildren as G, hasTests as H, index as a, getWorkerState as b, getNames as c, assertTypes as d, notNullish as e, basename as f, getCallLastIndex as g, dirname as h, isObject as i, join as j, resolve as k, isAbsolute as l, relative as m, noop as n, getTests as o, picocolors as p, getFullName as q, resetModules as r, slash as s, toArray as t, hasFailed as u, hasFailedSnapshot as v, getSuites as w, deepMerge as x, toNamespacedPath as y, ensurePackageInstalled as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { s as slash, e as notNullish, p as picocolors } from './chunk-utils-global.
|
|
1
|
+
import { s as slash, e as notNullish, p as picocolors } from './chunk-utils-global.9b434e81.js';
|
|
2
2
|
|
|
3
3
|
const setTimeout$1 = globalThis.setTimeout;
|
|
4
4
|
const setInterval = globalThis.setInterval;
|
|
@@ -5656,6 +5656,8 @@ const stackBarePathRE = /at ?(.*) (.+):(\d+):(\d+)$/;
|
|
|
5656
5656
|
async function interpretSourcePos(stackFrames, ctx) {
|
|
5657
5657
|
var _a;
|
|
5658
5658
|
for (const frame of stackFrames) {
|
|
5659
|
+
if ("sourcePos" in frame)
|
|
5660
|
+
continue;
|
|
5659
5661
|
const transformResult = (_a = ctx.server.moduleGraph.getModuleById(frame.file)) == null ? void 0 : _a.ssrTransformResult;
|
|
5660
5662
|
if (!transformResult)
|
|
5661
5663
|
continue;
|
package/dist/{chunk-vite-node-externalize.5c678054.js → chunk-vite-node-externalize.4dd7260b.js}
RENAMED
|
@@ -5,25 +5,25 @@ import process$1 from 'process';
|
|
|
5
5
|
import { s as signalExit, m as mergeStream, g as getStream, c as crossSpawn, o as onetime$1 } from './vendor-index.40be925a.js';
|
|
6
6
|
import url, { fileURLToPath, pathToFileURL } from 'url';
|
|
7
7
|
import require$$0, { constants as constants$5, cpus, hostname } from 'os';
|
|
8
|
-
import { j as join, f as basename, h as dirname, k as resolve, p as picocolors, s as slash$2, l as isAbsolute, m as relative, o as getTests, q as getFullName, u as hasFailed, v as hasFailedSnapshot, w as getSuites, t as toArray, n as noop$1, x as deepMerge, y as toNamespacedPath, g as getCallLastIndex, e as notNullish, z as ensurePackageInstalled } from './chunk-utils-global.
|
|
8
|
+
import { j as join, f as basename, h as dirname, k as resolve, p as picocolors, s as slash$2, l as isAbsolute, m as relative, o as getTests, q as getFullName, u as hasFailed, v as hasFailedSnapshot, w as getSuites, t as toArray, n as noop$1, x as deepMerge, y as toNamespacedPath, g as getCallLastIndex, e as notNullish, z as ensurePackageInstalled } from './chunk-utils-global.9b434e81.js';
|
|
9
9
|
import { createServer, mergeConfig } from 'vite';
|
|
10
|
-
import fs$8, { promises, existsSync } from 'fs';
|
|
11
|
-
import { d as distDir, a as defaultPort, c as configFiles } from './chunk-constants.
|
|
10
|
+
import fs$8, { promises, existsSync, readFileSync } from 'fs';
|
|
11
|
+
import { d as distDir, a as defaultPort, c as configFiles } from './chunk-constants.90075174.js';
|
|
12
12
|
import readline from 'readline';
|
|
13
13
|
import require$$0$1 from 'util';
|
|
14
14
|
import require$$0$2 from 'stream';
|
|
15
15
|
import require$$2 from 'events';
|
|
16
16
|
import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js';
|
|
17
|
-
import { i as isNodeBuiltin, a as isValidNodeImport, s as slash$1, t as toFilePath, w as withInlineSourcemap, c as createBirpc, V as ViteNodeRunner } from './chunk-vite-node-utils.
|
|
18
|
-
import { c as configDefaults, r as resolveC8Options, a as cleanCoverage, b as reportCoverage } from './chunk-defaults.
|
|
17
|
+
import { i as isNodeBuiltin, a as isValidNodeImport, s as slash$1, t as toFilePath, w as withInlineSourcemap, c as createBirpc, V as ViteNodeRunner } from './chunk-vite-node-utils.c160b239.js';
|
|
18
|
+
import { c as configDefaults, r as resolveC8Options, a as cleanCoverage, b as reportCoverage } from './chunk-defaults.fd5b939d.js';
|
|
19
19
|
import { MessageChannel } from 'worker_threads';
|
|
20
20
|
import { Tinypool } from 'tinypool';
|
|
21
21
|
import { performance } from 'perf_hooks';
|
|
22
|
-
import { e as stripAnsi, h as stringWidth, i as ansiStyles, j as sliceAnsi, k as setInterval, o as clearInterval, q as cliTruncate, c as setTimeout$1, b as parseStacktrace, r as interpretSourcePos, s as stringify$5, u as unifiedDiff, a as posToNumber, l as lineSplitRE, d as clearTimeout$1 } from './chunk-utils-timers.
|
|
22
|
+
import { e as stripAnsi, h as stringWidth, i as ansiStyles, j as sliceAnsi, k as setInterval, o as clearInterval, q as cliTruncate, c as setTimeout$1, b as parseStacktrace, r as interpretSourcePos, s as stringify$5, u as unifiedDiff, a as posToNumber, l as lineSplitRE, d as clearTimeout$1 } from './chunk-utils-timers.c50fec92.js';
|
|
23
23
|
import MagicString from './chunk-magic-string.d5e0e473.js';
|
|
24
24
|
import { p as prompts } from './vendor-index.405e58ef.js';
|
|
25
25
|
|
|
26
|
-
var version = "0.10.
|
|
26
|
+
var version = "0.10.1";
|
|
27
27
|
|
|
28
28
|
function stripFinalNewline(input) {
|
|
29
29
|
const LF = typeof input === 'string' ? '\n' : '\n'.charCodeAt();
|
|
@@ -8285,8 +8285,11 @@ function createChannel(ctx) {
|
|
|
8285
8285
|
ctx.state.updateUserLog(log);
|
|
8286
8286
|
ctx.report("onUserConsoleLog", log);
|
|
8287
8287
|
},
|
|
8288
|
+
onUnhandledRejection(err) {
|
|
8289
|
+
ctx.state.catchError(err, "Unhandled Rejection");
|
|
8290
|
+
},
|
|
8288
8291
|
onFinished(files) {
|
|
8289
|
-
ctx.report("onFinished", files);
|
|
8292
|
+
ctx.report("onFinished", files, ctx.state.getUnhandledErrors());
|
|
8290
8293
|
}
|
|
8291
8294
|
}, {
|
|
8292
8295
|
post(v) {
|
|
@@ -8477,9 +8480,21 @@ class BaseReporter {
|
|
|
8477
8480
|
relative(path) {
|
|
8478
8481
|
return relative(this.ctx.config.root, path);
|
|
8479
8482
|
}
|
|
8480
|
-
async onFinished(files = this.ctx.state.getFiles()) {
|
|
8483
|
+
async onFinished(files = this.ctx.state.getFiles(), errors = this.ctx.state.getUnhandledErrors()) {
|
|
8481
8484
|
this.end = performance.now();
|
|
8482
8485
|
await this.reportSummary(files);
|
|
8486
|
+
if (errors.length) {
|
|
8487
|
+
process.exitCode = 1;
|
|
8488
|
+
const errorMessage = picocolors.exports.red(picocolors.exports.bold(`
|
|
8489
|
+
Vitest catched ${errors.length} unhandled error${errors.length > 1 ? "s" : ""} during the test run. This might cause false positive tests.
|
|
8490
|
+
Please, resolve all the errors to make sure your tests are not affected.`));
|
|
8491
|
+
this.ctx.log(picocolors.exports.red(divider(picocolors.exports.bold(picocolors.exports.inverse(" Unhandled Errors ")))));
|
|
8492
|
+
this.ctx.log(errorMessage);
|
|
8493
|
+
await Promise.all(errors.map(async (err) => {
|
|
8494
|
+
await this.ctx.printError(err, true, err.type || "Unhandled Error");
|
|
8495
|
+
}));
|
|
8496
|
+
this.ctx.log(picocolors.exports.red(divider()));
|
|
8497
|
+
}
|
|
8483
8498
|
}
|
|
8484
8499
|
onTaskUpdate(packs) {
|
|
8485
8500
|
var _a, _b, _c;
|
|
@@ -8512,7 +8527,8 @@ class BaseReporter {
|
|
|
8512
8527
|
}
|
|
8513
8528
|
async onWatcherStart() {
|
|
8514
8529
|
const files = this.ctx.state.getFiles();
|
|
8515
|
-
const
|
|
8530
|
+
const errors = this.ctx.state.getUnhandledErrors();
|
|
8531
|
+
const failed = errors.length > 0 || hasFailed(files);
|
|
8516
8532
|
const failedSnap = hasFailedSnapshot(files);
|
|
8517
8533
|
if (failed)
|
|
8518
8534
|
this.ctx.log(WAIT_FOR_CHANGE_FAIL);
|
|
@@ -8623,9 +8639,7 @@ ${picocolors.exports.inverse(picocolors.exports.bold(picocolors.exports.blue(" R
|
|
|
8623
8639
|
registerUnhandledRejection() {
|
|
8624
8640
|
process.on("unhandledRejection", async (err) => {
|
|
8625
8641
|
process.exitCode = 1;
|
|
8626
|
-
this.ctx.
|
|
8627
|
-
${picocolors.exports.red(divider(picocolors.exports.bold(picocolors.exports.inverse(" Unhandled Rejection "))))}`);
|
|
8628
|
-
await this.ctx.printError(err);
|
|
8642
|
+
await this.ctx.printError(err, true, "Unhandled Rejection");
|
|
8629
8643
|
this.ctx.error("\n\n");
|
|
8630
8644
|
process.exit(1);
|
|
8631
8645
|
});
|
|
@@ -9238,10 +9252,10 @@ class DefaultReporter extends BaseReporter {
|
|
|
9238
9252
|
this.renderer.update(files);
|
|
9239
9253
|
}
|
|
9240
9254
|
}
|
|
9241
|
-
async onFinished(files = this.ctx.state.getFiles()) {
|
|
9255
|
+
async onFinished(files = this.ctx.state.getFiles(), errors = this.ctx.state.getUnhandledErrors()) {
|
|
9242
9256
|
await this.stopListRender();
|
|
9243
9257
|
this.ctx.log();
|
|
9244
|
-
await super.onFinished(files);
|
|
9258
|
+
await super.onFinished(files, errors);
|
|
9245
9259
|
}
|
|
9246
9260
|
async onWatcherStart() {
|
|
9247
9261
|
await this.stopListRender();
|
|
@@ -9328,10 +9342,10 @@ class DotReporter extends BaseReporter {
|
|
|
9328
9342
|
this.renderer.update(files);
|
|
9329
9343
|
}
|
|
9330
9344
|
}
|
|
9331
|
-
async onFinished(files = this.ctx.state.getFiles()) {
|
|
9345
|
+
async onFinished(files = this.ctx.state.getFiles(), errors = this.ctx.state.getUnhandledErrors()) {
|
|
9332
9346
|
await this.stopListRender();
|
|
9333
9347
|
this.ctx.log();
|
|
9334
|
-
await super.onFinished(files);
|
|
9348
|
+
await super.onFinished(files, errors);
|
|
9335
9349
|
}
|
|
9336
9350
|
async onWatcherStart() {
|
|
9337
9351
|
await this.stopListRender();
|
|
@@ -9418,7 +9432,7 @@ class JsonReporter {
|
|
|
9418
9432
|
return Math.max(prev, (((_a2 = next.result) == null ? void 0 : _a2.startTime) ?? 0) + (((_b2 = next.result) == null ? void 0 : _b2.duration) ?? 0));
|
|
9419
9433
|
}, startTime);
|
|
9420
9434
|
const assertionResults = tests2.map((t) => {
|
|
9421
|
-
var _a2, _b2, _c;
|
|
9435
|
+
var _a2, _b2, _c, _d;
|
|
9422
9436
|
const ancestorTitles = [];
|
|
9423
9437
|
let iter = t.suite;
|
|
9424
9438
|
while (iter) {
|
|
@@ -9429,10 +9443,10 @@ class JsonReporter {
|
|
|
9429
9443
|
return {
|
|
9430
9444
|
ancestorTitles,
|
|
9431
9445
|
fullName: ancestorTitles.length > 0 ? `${ancestorTitles.join(" ")} ${t.name}` : t.name,
|
|
9432
|
-
status: t.result
|
|
9446
|
+
status: StatusMap[((_a2 = t.result) == null ? void 0 : _a2.state) || t.mode] || "skipped",
|
|
9433
9447
|
title: t.name,
|
|
9434
|
-
duration: (
|
|
9435
|
-
failureMessages: ((
|
|
9448
|
+
duration: (_b2 = t.result) == null ? void 0 : _b2.duration,
|
|
9449
|
+
failureMessages: ((_d = (_c = t.result) == null ? void 0 : _c.error) == null ? void 0 : _d.message) == null ? [] : [t.result.error.message]
|
|
9436
9450
|
};
|
|
9437
9451
|
});
|
|
9438
9452
|
if (tests2.some((t) => {
|
|
@@ -9845,6 +9859,17 @@ class StateManager {
|
|
|
9845
9859
|
this.filesMap = /* @__PURE__ */ new Map();
|
|
9846
9860
|
this.idMap = /* @__PURE__ */ new Map();
|
|
9847
9861
|
this.taskFileMap = /* @__PURE__ */ new WeakMap();
|
|
9862
|
+
this.errorsSet = /* @__PURE__ */ new Set();
|
|
9863
|
+
}
|
|
9864
|
+
catchError(err, type) {
|
|
9865
|
+
err.type = type;
|
|
9866
|
+
this.errorsSet.add(err);
|
|
9867
|
+
}
|
|
9868
|
+
clearErrors() {
|
|
9869
|
+
this.errorsSet.clear();
|
|
9870
|
+
}
|
|
9871
|
+
getUnhandledErrors() {
|
|
9872
|
+
return Array.from(this.errorsSet.values());
|
|
9848
9873
|
}
|
|
9849
9874
|
getFiles(keys) {
|
|
9850
9875
|
if (keys)
|
|
@@ -9997,7 +10022,8 @@ function fileFromParsedStack(stack) {
|
|
|
9997
10022
|
return join(stack.file, "../", stack.sourcePos.source);
|
|
9998
10023
|
return stack.file;
|
|
9999
10024
|
}
|
|
10000
|
-
async function printError(error, ctx) {
|
|
10025
|
+
async function printError(error, ctx, options = {}) {
|
|
10026
|
+
const { showCodeFrame = true, fullStack = false, type } = options;
|
|
10001
10027
|
let e = error;
|
|
10002
10028
|
if (typeof error === "string") {
|
|
10003
10029
|
e = {
|
|
@@ -10005,20 +10031,56 @@ async function printError(error, ctx) {
|
|
|
10005
10031
|
stack: error
|
|
10006
10032
|
};
|
|
10007
10033
|
}
|
|
10008
|
-
const stacks = parseStacktrace(e);
|
|
10034
|
+
const stacks = parseStacktrace(e, fullStack);
|
|
10009
10035
|
await interpretSourcePos(stacks, ctx);
|
|
10010
10036
|
const nearest = stacks.find((stack) => ctx.server.moduleGraph.getModuleById(stack.file) && existsSync(stack.file));
|
|
10037
|
+
const errorProperties = getErrorProperties(e);
|
|
10038
|
+
if (type)
|
|
10039
|
+
printErrorType(type, ctx);
|
|
10011
10040
|
printErrorMessage(e, ctx.console);
|
|
10012
|
-
|
|
10013
|
-
if (s === nearest && nearest) {
|
|
10014
|
-
const sourceCode =
|
|
10041
|
+
printStack(ctx, stacks, nearest, errorProperties, (s, pos) => {
|
|
10042
|
+
if (showCodeFrame && s === nearest && nearest) {
|
|
10043
|
+
const sourceCode = readFileSync(fileFromParsedStack(nearest), "utf-8");
|
|
10015
10044
|
ctx.log(picocolors.exports.yellow(generateCodeFrame(sourceCode, 4, pos)));
|
|
10016
10045
|
}
|
|
10017
10046
|
});
|
|
10047
|
+
if (e.cause) {
|
|
10048
|
+
e.cause.name = `Caused by: ${e.cause.name}`;
|
|
10049
|
+
await printError(e.cause, ctx, { fullStack, showCodeFrame: false });
|
|
10050
|
+
}
|
|
10018
10051
|
handleImportOutsideModuleError(e.stack || e.stackStr || "", ctx);
|
|
10019
10052
|
if (e.showDiff)
|
|
10020
10053
|
displayDiff(stringify$5(e.actual), stringify$5(e.expected), ctx.console, ctx.config.outputTruncateLength);
|
|
10021
10054
|
}
|
|
10055
|
+
function printErrorType(type, ctx) {
|
|
10056
|
+
ctx.error(`
|
|
10057
|
+
${picocolors.exports.red(divider(picocolors.exports.bold(picocolors.exports.inverse(` ${type} `))))}`);
|
|
10058
|
+
}
|
|
10059
|
+
function getErrorProperties(e) {
|
|
10060
|
+
const errorObject = /* @__PURE__ */ Object.create(null);
|
|
10061
|
+
if (e.name === "AssertionError")
|
|
10062
|
+
return errorObject;
|
|
10063
|
+
const skip = [
|
|
10064
|
+
"message",
|
|
10065
|
+
"name",
|
|
10066
|
+
"nameStr",
|
|
10067
|
+
"stack",
|
|
10068
|
+
"cause",
|
|
10069
|
+
"stacks",
|
|
10070
|
+
"stackStr",
|
|
10071
|
+
"type",
|
|
10072
|
+
"showDiff",
|
|
10073
|
+
"actual",
|
|
10074
|
+
"expected",
|
|
10075
|
+
"constructor",
|
|
10076
|
+
"toString"
|
|
10077
|
+
];
|
|
10078
|
+
for (const key of Object.getOwnPropertyNames(e)) {
|
|
10079
|
+
if (!skip.includes(key))
|
|
10080
|
+
errorObject[key] = e[key];
|
|
10081
|
+
}
|
|
10082
|
+
return errorObject;
|
|
10083
|
+
}
|
|
10022
10084
|
const esmErrors = [
|
|
10023
10085
|
"Cannot use import statement outside a module",
|
|
10024
10086
|
"Unexpected token 'export'"
|
|
@@ -10054,7 +10116,7 @@ function printErrorMessage(error, console) {
|
|
|
10054
10116
|
const errorName = error.name || error.nameStr || "Unknown Error";
|
|
10055
10117
|
console.error(picocolors.exports.red(`${picocolors.exports.bold(errorName)}: ${error.message}`));
|
|
10056
10118
|
}
|
|
10057
|
-
|
|
10119
|
+
function printStack(ctx, stack, highlight, errorProperties, onStack) {
|
|
10058
10120
|
if (!stack.length)
|
|
10059
10121
|
return;
|
|
10060
10122
|
for (const frame of stack) {
|
|
@@ -10063,11 +10125,17 @@ async function printStack(ctx, stack, highlight, onStack) {
|
|
|
10063
10125
|
const file = fileFromParsedStack(frame);
|
|
10064
10126
|
const path = relative(ctx.config.root, file);
|
|
10065
10127
|
ctx.log(color(` ${picocolors.exports.dim(F_POINTER)} ${[frame.method, picocolors.exports.dim(`${path}:${pos.line}:${pos.column}`)].filter(Boolean).join(" ")}`));
|
|
10066
|
-
|
|
10128
|
+
onStack == null ? void 0 : onStack(frame, pos);
|
|
10067
10129
|
if (frame.file in ctx.state.filesMap)
|
|
10068
10130
|
break;
|
|
10069
10131
|
}
|
|
10070
10132
|
ctx.log();
|
|
10133
|
+
const hasProperties = Object.keys(errorProperties).length > 0;
|
|
10134
|
+
if (hasProperties) {
|
|
10135
|
+
ctx.log(picocolors.exports.red(picocolors.exports.dim(divider())));
|
|
10136
|
+
const propertiesString = stringify$5(errorProperties, 10, { printBasicPrototype: false });
|
|
10137
|
+
ctx.log(picocolors.exports.red(picocolors.exports.bold("Serialized Error:")), picocolors.exports.gray(propertiesString));
|
|
10138
|
+
}
|
|
10071
10139
|
}
|
|
10072
10140
|
function generateCodeFrame(source, indent = 0, start = 0, end, range = 2) {
|
|
10073
10141
|
start = posToNumber(source, start);
|
|
@@ -10329,10 +10397,15 @@ class Vitest {
|
|
|
10329
10397
|
const invalidates = Array.from(this.invalidates);
|
|
10330
10398
|
this.invalidates.clear();
|
|
10331
10399
|
this.snapshot.clear();
|
|
10332
|
-
|
|
10400
|
+
this.state.clearErrors();
|
|
10401
|
+
try {
|
|
10402
|
+
await this.pool.runTests(files, invalidates);
|
|
10403
|
+
} catch (err) {
|
|
10404
|
+
this.state.catchError(err, "Unhandled Error");
|
|
10405
|
+
}
|
|
10333
10406
|
if (hasFailed(this.state.getFiles()))
|
|
10334
10407
|
process.exitCode = 1;
|
|
10335
|
-
await this.report("onFinished", this.state.getFiles());
|
|
10408
|
+
await this.report("onFinished", this.state.getFiles(), this.state.getUnhandledErrors());
|
|
10336
10409
|
})().finally(() => {
|
|
10337
10410
|
this.runningPromise = void 0;
|
|
10338
10411
|
});
|
|
@@ -10532,8 +10605,12 @@ class Vitest {
|
|
|
10532
10605
|
isInSourceTestFile(code) {
|
|
10533
10606
|
return code.includes("import.meta.vitest");
|
|
10534
10607
|
}
|
|
10535
|
-
printError(err) {
|
|
10536
|
-
return printError(err, this
|
|
10608
|
+
printError(err, fullStack = false, type) {
|
|
10609
|
+
return printError(err, this, {
|
|
10610
|
+
fullStack,
|
|
10611
|
+
type,
|
|
10612
|
+
showCodeFrame: true
|
|
10613
|
+
});
|
|
10537
10614
|
}
|
|
10538
10615
|
onServerRestarted(fn) {
|
|
10539
10616
|
this._onRestartListeners.push(fn);
|
|
@@ -10847,7 +10924,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest()) {
|
|
|
10847
10924
|
await ctx.setServer(options, server);
|
|
10848
10925
|
haveStarted = true;
|
|
10849
10926
|
if (options.api && options.watch)
|
|
10850
|
-
(await import('./chunk-api-setup.
|
|
10927
|
+
(await import('./chunk-api-setup.b55307fb.js')).setup(ctx);
|
|
10851
10928
|
if (!options.watch)
|
|
10852
10929
|
await server.watcher.close();
|
|
10853
10930
|
}
|
|
@@ -10988,9 +11065,7 @@ async function startVitest(cliFilters, options, viteOverrides) {
|
|
|
10988
11065
|
await ctx.start(cliFilters);
|
|
10989
11066
|
} catch (e) {
|
|
10990
11067
|
process.exitCode = 1;
|
|
10991
|
-
ctx.
|
|
10992
|
-
${picocolors.exports.red(divider(picocolors.exports.bold(picocolors.exports.inverse(" Unhandled Error "))))}`);
|
|
10993
|
-
await ctx.printError(e);
|
|
11068
|
+
await ctx.printError(e, true, "Unhandled Error");
|
|
10994
11069
|
ctx.error("\n\n");
|
|
10995
11070
|
return false;
|
|
10996
11071
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { builtinModules, createRequire } from 'module';
|
|
2
2
|
import { pathToFileURL, fileURLToPath as fileURLToPath$2, URL as URL$1 } from 'url';
|
|
3
3
|
import vm from 'vm';
|
|
4
|
-
import { l as isAbsolute$2, k as resolve, j as join$2, A as extname$2, h as dirname$2 } from './chunk-utils-global.
|
|
4
|
+
import { l as isAbsolute$2, k as resolve, j as join$2, A as extname$2, h as dirname$2 } from './chunk-utils-global.9b434e81.js';
|
|
5
5
|
import path from 'path';
|
|
6
6
|
import fs, { realpathSync, statSync, Stats, promises, existsSync } from 'fs';
|
|
7
7
|
import assert from 'assert';
|
|
@@ -9063,6 +9063,8 @@ function proxyMethod(name, tryDefault) {
|
|
|
9063
9063
|
};
|
|
9064
9064
|
}
|
|
9065
9065
|
function exportAll(exports, sourceModule) {
|
|
9066
|
+
if (exports === sourceModule)
|
|
9067
|
+
return;
|
|
9066
9068
|
for (const key in sourceModule) {
|
|
9067
9069
|
if (key !== "default") {
|
|
9068
9070
|
try {
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventEmitter } from 'events';
|
|
2
|
-
import { p as picocolors } from './chunk-utils-global.
|
|
3
|
-
import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.
|
|
2
|
+
import { p as picocolors } from './chunk-utils-global.9b434e81.js';
|
|
3
|
+
import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.4dd7260b.js';
|
|
4
4
|
import 'tty';
|
|
5
5
|
import 'local-pkg';
|
|
6
6
|
import 'path';
|
|
@@ -16,16 +16,16 @@ import 'util';
|
|
|
16
16
|
import 'url';
|
|
17
17
|
import 'os';
|
|
18
18
|
import 'vite';
|
|
19
|
-
import './chunk-constants.
|
|
19
|
+
import './chunk-constants.90075174.js';
|
|
20
20
|
import 'readline';
|
|
21
|
-
import './chunk-vite-node-utils.
|
|
21
|
+
import './chunk-vite-node-utils.c160b239.js';
|
|
22
22
|
import 'module';
|
|
23
23
|
import 'vm';
|
|
24
|
-
import './chunk-defaults.
|
|
24
|
+
import './chunk-defaults.fd5b939d.js';
|
|
25
25
|
import 'worker_threads';
|
|
26
26
|
import 'tinypool';
|
|
27
27
|
import 'perf_hooks';
|
|
28
|
-
import './chunk-utils-timers.
|
|
28
|
+
import './chunk-utils-timers.c50fec92.js';
|
|
29
29
|
import './chunk-magic-string.d5e0e473.js';
|
|
30
30
|
import './vendor-index.405e58ef.js';
|
|
31
31
|
|
package/dist/entry.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
export { r as run } from './vendor-entry.
|
|
1
|
+
export { r as run } from './vendor-entry.9dd6e6e6.js';
|
|
2
2
|
import 'fs';
|
|
3
|
-
import './chunk-utils-global.
|
|
3
|
+
import './chunk-utils-global.9b434e81.js';
|
|
4
4
|
import 'tty';
|
|
5
5
|
import 'local-pkg';
|
|
6
6
|
import 'path';
|
|
7
7
|
import 'console';
|
|
8
8
|
import 'stream';
|
|
9
|
-
import './chunk-runtime-chain.
|
|
9
|
+
import './chunk-runtime-chain.6292a3de.js';
|
|
10
10
|
import 'chai';
|
|
11
11
|
import './vendor-_commonjsHelpers.addc3445.js';
|
|
12
|
-
import './chunk-runtime-rpc.
|
|
13
|
-
import './chunk-utils-timers.
|
|
12
|
+
import './chunk-runtime-rpc.8e14ae4f.js';
|
|
13
|
+
import './chunk-utils-timers.c50fec92.js';
|
|
14
14
|
import './chunk-integrations-spy.f036df6f.js';
|
|
15
15
|
import 'tinyspy';
|
|
16
16
|
import 'util';
|
|
17
|
-
import './chunk-defaults.
|
|
17
|
+
import './chunk-defaults.fd5b939d.js';
|
|
18
18
|
import 'module';
|
|
19
19
|
import 'url';
|
|
20
20
|
import 'crypto';
|
package/dist/index.d.ts
CHANGED
|
@@ -341,6 +341,10 @@ declare class StateManager {
|
|
|
341
341
|
filesMap: Map<string, File>;
|
|
342
342
|
idMap: Map<string, Task>;
|
|
343
343
|
taskFileMap: WeakMap<Task, File>;
|
|
344
|
+
errorsSet: Set<unknown>;
|
|
345
|
+
catchError(err: unknown, type: string): void;
|
|
346
|
+
clearErrors(): void;
|
|
347
|
+
getUnhandledErrors(): unknown[];
|
|
344
348
|
getFiles(keys?: string[]): File[];
|
|
345
349
|
getFilepaths(): string[];
|
|
346
350
|
getFailedFilepaths(): string[];
|
|
@@ -402,7 +406,7 @@ declare class Vitest {
|
|
|
402
406
|
globTestFiles(filters?: string[]): Promise<string[]>;
|
|
403
407
|
isTargetFile(id: string, source?: string): Promise<boolean>;
|
|
404
408
|
isInSourceTestFile(code: string): boolean;
|
|
405
|
-
printError(err: unknown): Promise<void>;
|
|
409
|
+
printError(err: unknown, fullStack?: boolean, type?: string): Promise<void>;
|
|
406
410
|
onServerRestarted(fn: () => void): void;
|
|
407
411
|
}
|
|
408
412
|
|
|
@@ -417,7 +421,7 @@ declare abstract class BaseReporter implements Reporter {
|
|
|
417
421
|
constructor();
|
|
418
422
|
onInit(ctx: Vitest): void;
|
|
419
423
|
relative(path: string): string;
|
|
420
|
-
onFinished(files?: File[]): Promise<void>;
|
|
424
|
+
onFinished(files?: File[], errors?: unknown[]): Promise<void>;
|
|
421
425
|
onTaskUpdate(packs: TaskResultPack[]): void;
|
|
422
426
|
onWatcherStart(): Promise<void>;
|
|
423
427
|
onWatcherRerun(files: string[], trigger?: string): Promise<void>;
|
|
@@ -444,7 +448,7 @@ declare class DefaultReporter extends BaseReporter {
|
|
|
444
448
|
rendererOptions: ListRendererOptions;
|
|
445
449
|
onTestRemoved(trigger?: string): Promise<void>;
|
|
446
450
|
onCollected(): void;
|
|
447
|
-
onFinished(files?: File[]): Promise<void>;
|
|
451
|
+
onFinished(files?: File[], errors?: unknown[]): Promise<void>;
|
|
448
452
|
onWatcherStart(): Promise<void>;
|
|
449
453
|
stopListRender(): Promise<void>;
|
|
450
454
|
onWatcherRerun(files: string[], trigger?: string): Promise<void>;
|
|
@@ -454,7 +458,7 @@ declare class DefaultReporter extends BaseReporter {
|
|
|
454
458
|
declare class DotReporter extends BaseReporter {
|
|
455
459
|
renderer?: ReturnType<typeof createListRenderer>;
|
|
456
460
|
onCollected(): void;
|
|
457
|
-
onFinished(files?: File[]): Promise<void>;
|
|
461
|
+
onFinished(files?: File[], errors?: unknown[]): Promise<void>;
|
|
458
462
|
onWatcherStart(): Promise<void>;
|
|
459
463
|
stopListRender(): Promise<void>;
|
|
460
464
|
onWatcherRerun(files: string[], trigger?: string): Promise<void>;
|
|
@@ -576,6 +580,7 @@ interface ErrorWithDiff extends Error {
|
|
|
576
580
|
actual?: any;
|
|
577
581
|
expected?: any;
|
|
578
582
|
operator?: string;
|
|
583
|
+
type?: string;
|
|
579
584
|
}
|
|
580
585
|
interface ModuleGraphData {
|
|
581
586
|
graph: Record<string, string[]>;
|
|
@@ -789,12 +794,16 @@ declare type TestAPI<ExtraContext = {}> = ChainableFunction<'concurrent' | 'only
|
|
|
789
794
|
timeout?: number
|
|
790
795
|
], void> & {
|
|
791
796
|
each: EachFunction;
|
|
797
|
+
skipIf(condition: any): TestAPI<ExtraContext>;
|
|
798
|
+
runIf(condition: any): TestAPI<ExtraContext>;
|
|
792
799
|
};
|
|
793
800
|
declare type SuiteAPI<ExtraContext = {}> = ChainableFunction<'concurrent' | 'only' | 'skip' | 'todo', [
|
|
794
801
|
name: string,
|
|
795
802
|
factory?: SuiteFactory
|
|
796
803
|
], SuiteCollector<ExtraContext>> & {
|
|
797
804
|
each: EachFunction;
|
|
805
|
+
skipIf(condition: any): SuiteAPI<ExtraContext>;
|
|
806
|
+
runIf(condition: any): SuiteAPI<ExtraContext>;
|
|
798
807
|
};
|
|
799
808
|
declare type HookListener<T extends any[], Return = void> = (...args: T) => Awaitable<Return | void>;
|
|
800
809
|
interface SuiteHooks {
|
|
@@ -837,7 +846,7 @@ interface TestContext {
|
|
|
837
846
|
interface Reporter {
|
|
838
847
|
onInit?(ctx: Vitest): void;
|
|
839
848
|
onCollected?: (files?: File[]) => Awaitable<void>;
|
|
840
|
-
onFinished?: (files?: File[]) => Awaitable<void>;
|
|
849
|
+
onFinished?: (files?: File[], errors?: unknown[]) => Awaitable<void>;
|
|
841
850
|
onTaskUpdate?: (packs: TaskResultPack[]) => Awaitable<void>;
|
|
842
851
|
onTestRemoved?: (trigger?: string) => Awaitable<void>;
|
|
843
852
|
onWatcherStart?: () => Awaitable<void>;
|
|
@@ -1000,7 +1009,7 @@ interface InlineConfig {
|
|
|
1000
1009
|
* Custom reporter for output. Can contain one or more built-in report names, reporter instances,
|
|
1001
1010
|
* and/or paths to custom reporters
|
|
1002
1011
|
*/
|
|
1003
|
-
reporters?: Arrayable<BuiltinReporters | Reporter | string
|
|
1012
|
+
reporters?: Arrayable<BuiltinReporters | Reporter | Omit<string, BuiltinReporters>>;
|
|
1004
1013
|
/**
|
|
1005
1014
|
* diff output length
|
|
1006
1015
|
*/
|
|
@@ -1223,9 +1232,10 @@ interface WorkerRPC {
|
|
|
1223
1232
|
fetch: FetchFunction;
|
|
1224
1233
|
resolveId: ResolveIdFunction;
|
|
1225
1234
|
getSourceMap: (id: string, force?: boolean) => Promise<RawSourceMap | undefined>;
|
|
1226
|
-
onFinished: (files: File[]) => void;
|
|
1235
|
+
onFinished: (files: File[], errors?: unknown[]) => void;
|
|
1227
1236
|
onWorkerExit: (code?: number) => void;
|
|
1228
1237
|
onUserConsoleLog: (log: UserConsoleLog) => void;
|
|
1238
|
+
onUnhandledRejection: (err: unknown) => void;
|
|
1229
1239
|
onCollected: (files: File[]) => void;
|
|
1230
1240
|
onTaskUpdate: (pack: TaskResultPack[]) => void;
|
|
1231
1241
|
snapshotSaved: (snapshot: SnapshotResult) => void;
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export { c as afterAll, f as afterEach, b as beforeAll, e as beforeEach, g as createExpect, d as describe, h as expect, k as getRunningMode, a as isFirstRun, l as isWatchMode, i as it, r as runOnce, s as suite, t as test, j as vi, v as vitest, w as withCallback } from './chunk-runtime-chain.
|
|
1
|
+
export { c as afterAll, f as afterEach, b as beforeAll, e as beforeEach, g as createExpect, d as describe, h as expect, k as getRunningMode, a as isFirstRun, l as isWatchMode, i as it, r as runOnce, s as suite, t as test, j as vi, v as vitest, w as withCallback } from './chunk-runtime-chain.6292a3de.js';
|
|
2
2
|
export { assert, default as chai, should } from 'chai';
|
|
3
3
|
import './vendor-_commonjsHelpers.addc3445.js';
|
|
4
|
-
import './chunk-runtime-rpc.
|
|
5
|
-
import './chunk-utils-global.
|
|
4
|
+
import './chunk-runtime-rpc.8e14ae4f.js';
|
|
5
|
+
import './chunk-utils-global.9b434e81.js';
|
|
6
6
|
import 'tty';
|
|
7
7
|
import 'local-pkg';
|
|
8
8
|
import 'path';
|
|
9
9
|
import 'fs';
|
|
10
|
-
import './chunk-utils-timers.
|
|
10
|
+
import './chunk-utils-timers.c50fec92.js';
|
|
11
11
|
import './chunk-integrations-spy.f036df6f.js';
|
|
12
12
|
import 'tinyspy';
|
|
13
13
|
import 'util';
|
package/dist/node.d.ts
CHANGED
|
@@ -220,7 +220,7 @@ declare abstract class BaseReporter implements Reporter {
|
|
|
220
220
|
constructor();
|
|
221
221
|
onInit(ctx: Vitest): void;
|
|
222
222
|
relative(path: string): string;
|
|
223
|
-
onFinished(files?: File[]): Promise<void>;
|
|
223
|
+
onFinished(files?: File[], errors?: unknown[]): Promise<void>;
|
|
224
224
|
onTaskUpdate(packs: TaskResultPack[]): void;
|
|
225
225
|
onWatcherStart(): Promise<void>;
|
|
226
226
|
onWatcherRerun(files: string[], trigger?: string): Promise<void>;
|
|
@@ -247,7 +247,7 @@ declare class DefaultReporter extends BaseReporter {
|
|
|
247
247
|
rendererOptions: ListRendererOptions;
|
|
248
248
|
onTestRemoved(trigger?: string): Promise<void>;
|
|
249
249
|
onCollected(): void;
|
|
250
|
-
onFinished(files?: File[]): Promise<void>;
|
|
250
|
+
onFinished(files?: File[], errors?: unknown[]): Promise<void>;
|
|
251
251
|
onWatcherStart(): Promise<void>;
|
|
252
252
|
stopListRender(): Promise<void>;
|
|
253
253
|
onWatcherRerun(files: string[], trigger?: string): Promise<void>;
|
|
@@ -257,7 +257,7 @@ declare class DefaultReporter extends BaseReporter {
|
|
|
257
257
|
declare class DotReporter extends BaseReporter {
|
|
258
258
|
renderer?: ReturnType<typeof createListRenderer>;
|
|
259
259
|
onCollected(): void;
|
|
260
|
-
onFinished(files?: File[]): Promise<void>;
|
|
260
|
+
onFinished(files?: File[], errors?: unknown[]): Promise<void>;
|
|
261
261
|
onWatcherStart(): Promise<void>;
|
|
262
262
|
stopListRender(): Promise<void>;
|
|
263
263
|
onWatcherRerun(files: string[], trigger?: string): Promise<void>;
|
|
@@ -354,6 +354,7 @@ interface ErrorWithDiff extends Error {
|
|
|
354
354
|
actual?: any;
|
|
355
355
|
expected?: any;
|
|
356
356
|
operator?: string;
|
|
357
|
+
type?: string;
|
|
357
358
|
}
|
|
358
359
|
|
|
359
360
|
declare type CoverageReporter = 'clover' | 'cobertura' | 'html-spa' | 'html' | 'json-summary' | 'json' | 'lcov' | 'lcovonly' | 'none' | 'teamcity' | 'text-lcov' | 'text-summary' | 'text';
|
|
@@ -555,7 +556,7 @@ interface TestContext {
|
|
|
555
556
|
interface Reporter {
|
|
556
557
|
onInit?(ctx: Vitest): void;
|
|
557
558
|
onCollected?: (files?: File[]) => Awaitable<void>;
|
|
558
|
-
onFinished?: (files?: File[]) => Awaitable<void>;
|
|
559
|
+
onFinished?: (files?: File[], errors?: unknown[]) => Awaitable<void>;
|
|
559
560
|
onTaskUpdate?: (packs: TaskResultPack[]) => Awaitable<void>;
|
|
560
561
|
onTestRemoved?: (trigger?: string) => Awaitable<void>;
|
|
561
562
|
onWatcherStart?: () => Awaitable<void>;
|
|
@@ -709,7 +710,7 @@ interface InlineConfig {
|
|
|
709
710
|
* Custom reporter for output. Can contain one or more built-in report names, reporter instances,
|
|
710
711
|
* and/or paths to custom reporters
|
|
711
712
|
*/
|
|
712
|
-
reporters?: Arrayable<BuiltinReporters | Reporter | string
|
|
713
|
+
reporters?: Arrayable<BuiltinReporters | Reporter | Omit<string, BuiltinReporters>>;
|
|
713
714
|
/**
|
|
714
715
|
* diff output length
|
|
715
716
|
*/
|
|
@@ -927,6 +928,10 @@ declare class StateManager {
|
|
|
927
928
|
filesMap: Map<string, File>;
|
|
928
929
|
idMap: Map<string, Task>;
|
|
929
930
|
taskFileMap: WeakMap<Task, File>;
|
|
931
|
+
errorsSet: Set<unknown>;
|
|
932
|
+
catchError(err: unknown, type: string): void;
|
|
933
|
+
clearErrors(): void;
|
|
934
|
+
getUnhandledErrors(): unknown[];
|
|
930
935
|
getFiles(keys?: string[]): File[];
|
|
931
936
|
getFilepaths(): string[];
|
|
932
937
|
getFailedFilepaths(): string[];
|
|
@@ -988,7 +993,7 @@ declare class Vitest {
|
|
|
988
993
|
globTestFiles(filters?: string[]): Promise<string[]>;
|
|
989
994
|
isTargetFile(id: string, source?: string): Promise<boolean>;
|
|
990
995
|
isInSourceTestFile(code: string): boolean;
|
|
991
|
-
printError(err: unknown): Promise<void>;
|
|
996
|
+
printError(err: unknown, fullStack?: boolean, type?: string): Promise<void>;
|
|
992
997
|
onServerRestarted(fn: () => void): void;
|
|
993
998
|
}
|
|
994
999
|
|
package/dist/node.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.
|
|
2
|
-
export { V as VitestRunner } from './chunk-runtime-mocker.
|
|
1
|
+
export { V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.4dd7260b.js';
|
|
2
|
+
export { V as VitestRunner } from './chunk-runtime-mocker.ca5ecf98.js';
|
|
3
3
|
import 'buffer';
|
|
4
4
|
import 'path';
|
|
5
5
|
import 'child_process';
|
|
@@ -13,19 +13,19 @@ import 'stream';
|
|
|
13
13
|
import 'util';
|
|
14
14
|
import 'url';
|
|
15
15
|
import 'os';
|
|
16
|
-
import './chunk-utils-global.
|
|
16
|
+
import './chunk-utils-global.9b434e81.js';
|
|
17
17
|
import 'tty';
|
|
18
18
|
import 'local-pkg';
|
|
19
19
|
import 'vite';
|
|
20
|
-
import './chunk-constants.
|
|
20
|
+
import './chunk-constants.90075174.js';
|
|
21
21
|
import 'readline';
|
|
22
|
-
import './chunk-vite-node-utils.
|
|
22
|
+
import './chunk-vite-node-utils.c160b239.js';
|
|
23
23
|
import 'module';
|
|
24
24
|
import 'vm';
|
|
25
|
-
import './chunk-defaults.
|
|
25
|
+
import './chunk-defaults.fd5b939d.js';
|
|
26
26
|
import 'worker_threads';
|
|
27
27
|
import 'tinypool';
|
|
28
28
|
import 'perf_hooks';
|
|
29
|
-
import './chunk-utils-timers.
|
|
29
|
+
import './chunk-utils-timers.c50fec92.js';
|
|
30
30
|
import './chunk-magic-string.d5e0e473.js';
|
|
31
31
|
import './vendor-index.405e58ef.js';
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { promises } from 'fs';
|
|
2
|
-
import { b as getWorkerState, t as toArray, m as relative,
|
|
2
|
+
import { b as getWorkerState, t as toArray, F as clone, D as getType, m as relative, G as partitionSuiteChildren, H as hasTests, u as hasFailed, q as getFullName, r as resetModules } from './chunk-utils-global.9b434e81.js';
|
|
3
3
|
import { Console } from 'console';
|
|
4
4
|
import { Writable } from 'stream';
|
|
5
5
|
import { importModule } from 'local-pkg';
|
|
6
|
-
import { s as suite, t as test, d as describe, i as it, r as runOnce, a as isFirstRun, b as beforeAll, c as afterAll, e as beforeEach, f as afterEach, w as withCallback, g as createExpect, h as expect, v as vitest, j as vi, k as getRunningMode, l as isWatchMode, m as resetRunOnceCounter, R as RealDate, n as clearCollectorContext, o as defaultSuite, p as setHooks, q as getHooks, u as collectorContext, x as getSnapshotClient, y as setState, z as getFn, A as getState } from './chunk-runtime-chain.
|
|
7
|
-
import chai, { assert, should } from 'chai';
|
|
8
|
-
import { r as rpc } from './chunk-runtime-rpc.
|
|
9
|
-
import { d as clearTimeout, c as setTimeout, s as stringify } from './chunk-utils-timers.
|
|
10
|
-
import { t as takeCoverage } from './chunk-defaults.
|
|
6
|
+
import { s as suite, t as test, d as describe, i as it, r as runOnce, a as isFirstRun, b as beforeAll, c as afterAll, e as beforeEach, f as afterEach, w as withCallback, g as createExpect, h as expect, v as vitest, j as vi, k as getRunningMode, l as isWatchMode, m as resetRunOnceCounter, R as RealDate, n as clearCollectorContext, o as defaultSuite, p as setHooks, q as getHooks, u as collectorContext, x as getSnapshotClient, y as setState, z as getFn, A as getState } from './chunk-runtime-chain.6292a3de.js';
|
|
7
|
+
import chai, { assert, should, util } from 'chai';
|
|
8
|
+
import { r as rpc } from './chunk-runtime-rpc.8e14ae4f.js';
|
|
9
|
+
import { d as clearTimeout, c as setTimeout, s as stringify } from './chunk-utils-timers.c50fec92.js';
|
|
10
|
+
import { t as takeCoverage } from './chunk-defaults.fd5b939d.js';
|
|
11
11
|
import { createHash } from 'crypto';
|
|
12
12
|
import { format } from 'util';
|
|
13
13
|
|
|
@@ -419,7 +419,7 @@ async function setupGlobalEnv(config) {
|
|
|
419
419
|
globalSetup = true;
|
|
420
420
|
setupConsoleLogSpy();
|
|
421
421
|
if (config.globals)
|
|
422
|
-
(await import('./chunk-integrations-globals.
|
|
422
|
+
(await import('./chunk-integrations-globals.a759742a.js')).registerApiGlobally();
|
|
423
423
|
}
|
|
424
424
|
function setupDefines(defines) {
|
|
425
425
|
for (const key in defines)
|
|
@@ -556,24 +556,24 @@ function serializeError(val, seen = /* @__PURE__ */ new WeakMap()) {
|
|
|
556
556
|
if (seen.has(val))
|
|
557
557
|
return seen.get(val);
|
|
558
558
|
if (Array.isArray(val)) {
|
|
559
|
-
const
|
|
560
|
-
seen.set(val,
|
|
559
|
+
const clone2 = new Array(val.length);
|
|
560
|
+
seen.set(val, clone2);
|
|
561
561
|
val.forEach((e, i) => {
|
|
562
|
-
|
|
562
|
+
clone2[i] = serializeError(e, seen);
|
|
563
563
|
});
|
|
564
|
-
return
|
|
564
|
+
return clone2;
|
|
565
565
|
} else {
|
|
566
|
-
const
|
|
567
|
-
seen.set(val,
|
|
566
|
+
const clone2 = /* @__PURE__ */ Object.create(null);
|
|
567
|
+
seen.set(val, clone2);
|
|
568
568
|
let obj = val;
|
|
569
569
|
while (obj && obj !== OBJECT_PROTO) {
|
|
570
570
|
Object.getOwnPropertyNames(obj).forEach((key) => {
|
|
571
|
-
if (!(key in
|
|
572
|
-
|
|
571
|
+
if (!(key in clone2))
|
|
572
|
+
clone2[key] = serializeError(obj[key], seen);
|
|
573
573
|
});
|
|
574
574
|
obj = Object.getPrototypeOf(obj);
|
|
575
575
|
}
|
|
576
|
-
return
|
|
576
|
+
return clone2;
|
|
577
577
|
}
|
|
578
578
|
}
|
|
579
579
|
function processError(err) {
|
|
@@ -583,6 +583,11 @@ function processError(err) {
|
|
|
583
583
|
err.stackStr = String(err.stack);
|
|
584
584
|
if (err.name)
|
|
585
585
|
err.nameStr = String(err.name);
|
|
586
|
+
const clonedActual = clone(err.actual);
|
|
587
|
+
const clonedExpected = clone(err.expected);
|
|
588
|
+
const { replacedActual, replacedExpected } = replaceAsymmetricMatcher(clonedActual, clonedExpected);
|
|
589
|
+
err.actual = replacedActual;
|
|
590
|
+
err.expected = replacedExpected;
|
|
586
591
|
if (typeof err.expected !== "string")
|
|
587
592
|
err.expected = stringify(err.expected);
|
|
588
593
|
if (typeof err.actual !== "string")
|
|
@@ -594,6 +599,38 @@ function processError(err) {
|
|
|
594
599
|
Inner error message: ${err == null ? void 0 : err.message}`));
|
|
595
600
|
}
|
|
596
601
|
}
|
|
602
|
+
function isAsymmetricMatcher(data) {
|
|
603
|
+
const type = getType(data);
|
|
604
|
+
return type === "Object" && typeof data.asymmetricMatch === "function";
|
|
605
|
+
}
|
|
606
|
+
function isReplaceable(obj1, obj2) {
|
|
607
|
+
const obj1Type = getType(obj1);
|
|
608
|
+
const obj2Type = getType(obj2);
|
|
609
|
+
return obj1Type === obj2Type && obj1Type === "Object";
|
|
610
|
+
}
|
|
611
|
+
function replaceAsymmetricMatcher(actual, expected) {
|
|
612
|
+
if (!isReplaceable(actual, expected))
|
|
613
|
+
return { replacedActual: actual, replacedExpected: expected };
|
|
614
|
+
util.getOwnEnumerableProperties(expected).forEach((key) => {
|
|
615
|
+
const expectedValue = expected[key];
|
|
616
|
+
const actualValue = actual[key];
|
|
617
|
+
if (isAsymmetricMatcher(expectedValue)) {
|
|
618
|
+
if (expectedValue.asymmetricMatch(actualValue))
|
|
619
|
+
actual[key] = expectedValue;
|
|
620
|
+
} else if (isAsymmetricMatcher(actualValue)) {
|
|
621
|
+
if (actualValue.asymmetricMatch(expectedValue))
|
|
622
|
+
expected[key] = actualValue;
|
|
623
|
+
} else if (isReplaceable(actualValue, expectedValue)) {
|
|
624
|
+
const replaced = replaceAsymmetricMatcher(actualValue, expectedValue);
|
|
625
|
+
actual[key] = replaced.replacedActual;
|
|
626
|
+
expected[key] = replaced.replacedExpected;
|
|
627
|
+
}
|
|
628
|
+
});
|
|
629
|
+
return {
|
|
630
|
+
replacedActual: actual,
|
|
631
|
+
replacedExpected: expected
|
|
632
|
+
};
|
|
633
|
+
}
|
|
597
634
|
|
|
598
635
|
const now$1 = Date.now;
|
|
599
636
|
function hash(str, length = 10) {
|
package/dist/worker.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { k as resolve, b as getWorkerState } from './chunk-utils-global.
|
|
2
|
-
import { c as createBirpc, M as ModuleCacheMap } from './chunk-vite-node-utils.
|
|
3
|
-
import { d as distDir } from './chunk-constants.
|
|
4
|
-
import { e as executeInViteNode } from './chunk-runtime-mocker.
|
|
5
|
-
import { r as rpc } from './chunk-runtime-rpc.
|
|
1
|
+
import { k as resolve, b as getWorkerState } from './chunk-utils-global.9b434e81.js';
|
|
2
|
+
import { c as createBirpc, M as ModuleCacheMap } from './chunk-vite-node-utils.c160b239.js';
|
|
3
|
+
import { d as distDir } from './chunk-constants.90075174.js';
|
|
4
|
+
import { e as executeInViteNode } from './chunk-runtime-mocker.ca5ecf98.js';
|
|
5
|
+
import { r as rpc } from './chunk-runtime-rpc.8e14ae4f.js';
|
|
6
6
|
import 'tty';
|
|
7
7
|
import 'local-pkg';
|
|
8
8
|
import 'path';
|
|
@@ -28,6 +28,9 @@ async function startViteNode(ctx) {
|
|
|
28
28
|
rpc().onWorkerExit(code);
|
|
29
29
|
return processExit(code);
|
|
30
30
|
};
|
|
31
|
+
process.on("unhandledRejection", (err) => {
|
|
32
|
+
rpc().onUnhandledRejection(err);
|
|
33
|
+
});
|
|
31
34
|
const { config } = ctx;
|
|
32
35
|
const { run: run2, collect: collect2 } = (await executeInViteNode({
|
|
33
36
|
files: [
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.10.
|
|
4
|
+
"version": "0.10.1",
|
|
5
5
|
"description": "A blazing fast unit test framework powered by Vite",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"vite",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"@types/chai-subset": "^1.3.3",
|
|
80
80
|
"chai": "^4.3.6",
|
|
81
81
|
"local-pkg": "^0.4.1",
|
|
82
|
-
"tinypool": "^0.1.
|
|
82
|
+
"tinypool": "^0.1.3",
|
|
83
83
|
"tinyspy": "^0.3.2",
|
|
84
84
|
"vite": "^2.9.5"
|
|
85
85
|
},
|
|
@@ -90,10 +90,10 @@
|
|
|
90
90
|
"@types/jsdom": "^16.2.14",
|
|
91
91
|
"@types/micromatch": "^4.0.2",
|
|
92
92
|
"@types/natural-compare": "^1.4.1",
|
|
93
|
-
"@types/node": "^17.0.
|
|
93
|
+
"@types/node": "^17.0.31",
|
|
94
94
|
"@types/prompts": "^2.4.0",
|
|
95
95
|
"@types/sinonjs__fake-timers": "^8.1.2",
|
|
96
|
-
"@vitest/ui": "0.10.
|
|
96
|
+
"@vitest/ui": "0.10.1",
|
|
97
97
|
"birpc": "^0.2.2",
|
|
98
98
|
"c8": "^7.11.2",
|
|
99
99
|
"cac": "^6.7.12",
|
|
@@ -116,12 +116,12 @@
|
|
|
116
116
|
"pkg-types": "^0.3.2",
|
|
117
117
|
"pretty-format": "^27.5.1",
|
|
118
118
|
"prompts": "^2.4.2",
|
|
119
|
-
"rollup": "^2.
|
|
119
|
+
"rollup": "^2.71.1",
|
|
120
120
|
"source-map-js": "^1.0.2",
|
|
121
121
|
"strip-ansi": "^7.0.1",
|
|
122
|
-
"typescript": "^4.6.
|
|
123
|
-
"vite-node": "0.10.
|
|
124
|
-
"ws": "^8.
|
|
122
|
+
"typescript": "^4.6.4",
|
|
123
|
+
"vite-node": "0.10.1",
|
|
124
|
+
"ws": "^8.6.0"
|
|
125
125
|
},
|
|
126
126
|
"engines": {
|
|
127
127
|
"node": ">=v14.16.0"
|
|
@@ -129,6 +129,5 @@
|
|
|
129
129
|
"scripts": {
|
|
130
130
|
"build": "rimraf dist && rollup -c",
|
|
131
131
|
"dev": "rollup -c --watch -m inline"
|
|
132
|
-
}
|
|
133
|
-
"readme": "# vitest\n\n[](https://www.npmjs.com/package/vitest)\n\nA blazing fast unit test framework powered by Vite.\n\n[GitHub](https://github.com/vitest-dev/vitest) | [Documentation](https://vitest.dev/)\n"
|
|
132
|
+
}
|
|
134
133
|
}
|
package/vitest.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
2
|
+
import './dist/cli.js'
|