vitest 0.12.3 → 0.12.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +72 -0
- package/dist/{chunk-api-setup.ed61899f.js → chunk-api-setup.02588d9f.js} +4 -4
- package/dist/{chunk-constants.0567483c.js → chunk-constants.7180775c.js} +1 -1
- package/dist/{chunk-defaults.ecb46baf.js → chunk-defaults.9e0c233e.js} +1 -1
- package/dist/{chunk-install-pkg.73b84ae1.js → chunk-install-pkg.078f5345.js} +11 -9
- package/dist/chunk-integrations-globals.cf24723d.js +25 -0
- package/dist/{chunk-runtime-chain.221b8dcb.js → chunk-runtime-chain.5cae775c.js} +57 -21
- package/dist/{chunk-runtime-mocker.acd615bd.js → chunk-runtime-mocker.43db6608.js} +7 -6
- package/dist/{chunk-runtime-rpc.63398738.js → chunk-runtime-rpc.ad208eea.js} +1 -1
- package/dist/{chunk-utils-global.a5a8641f.js → chunk-utils-global.29e8a0a3.js} +29 -9
- package/dist/{chunk-utils-timers.f25e8f44.js → chunk-utils-timers.64f2cbe8.js} +3 -2
- package/dist/{chunk-vite-node-externalize.6124d286.js → chunk-vite-node-externalize.35ad761d.js} +90 -71
- package/dist/{chunk-vite-node-utils.1536f168.js → chunk-vite-node-utils.26c328fa.js} +1067 -3
- package/dist/cli.js +7 -8
- package/dist/entry.js +6 -10
- package/dist/index.d.ts +11 -3
- package/dist/index.js +4 -5
- package/dist/node.d.ts +9 -2
- package/dist/node.js +10 -11
- package/dist/{vendor-entry.3adaf0b2.js → vendor-entry.5c1e6d94.js} +23 -14
- package/dist/{vendor-index.40be925a.js → vendor-index.3ff91c47.js} +5 -5
- package/dist/worker.js +5 -5
- package/package.json +3 -3
- package/dist/chunk-integrations-globals.60fc66ef.js +0 -29
- package/dist/vendor-_commonjsHelpers.addc3445.js +0 -3
package/LICENSE.md
CHANGED
|
@@ -427,6 +427,33 @@ Repository: git@github.com:moxystudio/node-cross-spawn.git
|
|
|
427
427
|
|
|
428
428
|
---------------------------------------
|
|
429
429
|
|
|
430
|
+
## debug
|
|
431
|
+
License: MIT
|
|
432
|
+
By: Josh Junon, TJ Holowaychuk, Nathan Rajlich, Andrew Rhyne
|
|
433
|
+
Repository: git://github.com/debug-js/debug.git
|
|
434
|
+
|
|
435
|
+
> (The MIT License)
|
|
436
|
+
>
|
|
437
|
+
> Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca>
|
|
438
|
+
> Copyright (c) 2018-2021 Josh Junon
|
|
439
|
+
>
|
|
440
|
+
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
|
441
|
+
> and associated documentation files (the 'Software'), to deal in the Software without restriction,
|
|
442
|
+
> including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
443
|
+
> and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
444
|
+
> subject to the following conditions:
|
|
445
|
+
>
|
|
446
|
+
> The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
447
|
+
> portions of the Software.
|
|
448
|
+
>
|
|
449
|
+
> THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
|
450
|
+
> LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
451
|
+
> IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
452
|
+
> WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
453
|
+
> SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
454
|
+
|
|
455
|
+
---------------------------------------
|
|
456
|
+
|
|
430
457
|
## diff
|
|
431
458
|
License: BSD-3-Clause
|
|
432
459
|
Repository: git://github.com/kpdecker/jsdiff.git
|
|
@@ -1267,6 +1294,34 @@ Repository: unjs/mlly
|
|
|
1267
1294
|
|
|
1268
1295
|
---------------------------------------
|
|
1269
1296
|
|
|
1297
|
+
## ms
|
|
1298
|
+
License: MIT
|
|
1299
|
+
Repository: zeit/ms
|
|
1300
|
+
|
|
1301
|
+
> The MIT License (MIT)
|
|
1302
|
+
>
|
|
1303
|
+
> Copyright (c) 2016 Zeit, Inc.
|
|
1304
|
+
>
|
|
1305
|
+
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1306
|
+
> of this software and associated documentation files (the "Software"), to deal
|
|
1307
|
+
> in the Software without restriction, including without limitation the rights
|
|
1308
|
+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1309
|
+
> copies of the Software, and to permit persons to whom the Software is
|
|
1310
|
+
> furnished to do so, subject to the following conditions:
|
|
1311
|
+
>
|
|
1312
|
+
> The above copyright notice and this permission notice shall be included in all
|
|
1313
|
+
> copies or substantial portions of the Software.
|
|
1314
|
+
>
|
|
1315
|
+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1316
|
+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1317
|
+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1318
|
+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1319
|
+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1320
|
+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1321
|
+
> SOFTWARE.
|
|
1322
|
+
|
|
1323
|
+
---------------------------------------
|
|
1324
|
+
|
|
1270
1325
|
## natural-compare
|
|
1271
1326
|
License: MIT
|
|
1272
1327
|
By: Lauri Rooden
|
|
@@ -1892,6 +1947,23 @@ Repository: sindresorhus/strip-final-newline
|
|
|
1892
1947
|
|
|
1893
1948
|
---------------------------------------
|
|
1894
1949
|
|
|
1950
|
+
## supports-color
|
|
1951
|
+
License: MIT
|
|
1952
|
+
By: Sindre Sorhus
|
|
1953
|
+
Repository: chalk/supports-color
|
|
1954
|
+
|
|
1955
|
+
> MIT License
|
|
1956
|
+
>
|
|
1957
|
+
> Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
1958
|
+
>
|
|
1959
|
+
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
1960
|
+
>
|
|
1961
|
+
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
1962
|
+
>
|
|
1963
|
+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1964
|
+
|
|
1965
|
+
---------------------------------------
|
|
1966
|
+
|
|
1895
1967
|
## to-regex-range
|
|
1896
1968
|
License: MIT
|
|
1897
1969
|
By: Jon Schlinkert, Rouven Weßling
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { promises } from 'fs';
|
|
2
|
-
import {
|
|
2
|
+
import { b as createBirpc } from './chunk-vite-node-utils.26c328fa.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.7180775c.js';
|
|
13
|
+
import { r as interpretSourcePos, b as parseStacktrace } from './chunk-utils-timers.64f2cbe8.js';
|
|
14
14
|
import 'module';
|
|
15
15
|
import 'vm';
|
|
16
|
-
import './chunk-utils-global.
|
|
16
|
+
import './chunk-utils-global.29e8a0a3.js';
|
|
17
17
|
import 'tty';
|
|
18
18
|
import 'local-pkg';
|
|
19
19
|
import 'path';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { fileURLToPath } from 'url';
|
|
2
|
-
import {
|
|
2
|
+
import { k as resolve } from './chunk-utils-global.29e8a0a3.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,
|
|
4
|
+
import { t as toArray, k as resolve } from './chunk-utils-global.29e8a0a3.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}/**"];
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import path$2 from 'path';
|
|
2
2
|
import fs$2 from 'fs';
|
|
3
|
-
import require$$
|
|
3
|
+
import require$$1 from 'util';
|
|
4
4
|
import childProcess$1 from 'child_process';
|
|
5
|
-
import { p as pathKey, s as signalExit, m as mergeStream$1, g as getStream$1, c as crossSpawn$1, o as onetime$1 } from './vendor-index.
|
|
6
|
-
import require$$0
|
|
7
|
-
import './
|
|
5
|
+
import { p as pathKey, s as signalExit, m as mergeStream$1, g as getStream$1, c as crossSpawn$1, o as onetime$1 } from './vendor-index.3ff91c47.js';
|
|
6
|
+
import require$$0 from 'os';
|
|
7
|
+
import './chunk-utils-global.29e8a0a3.js';
|
|
8
|
+
import 'tty';
|
|
9
|
+
import 'local-pkg';
|
|
8
10
|
import 'assert';
|
|
9
11
|
import 'events';
|
|
10
12
|
import 'buffer';
|
|
@@ -206,7 +208,7 @@ var pLocate_1 = pLocate$1;
|
|
|
206
208
|
|
|
207
209
|
const path$1 = path$2;
|
|
208
210
|
const fs$1 = fs$2;
|
|
209
|
-
const {promisify: promisify$1} = require$$
|
|
211
|
+
const {promisify: promisify$1} = require$$1;
|
|
210
212
|
const pLocate = pLocate_1;
|
|
211
213
|
|
|
212
214
|
const fsStat = promisify$1(fs$1.stat);
|
|
@@ -275,7 +277,7 @@ locatePath.exports.sync = (paths, options) => {
|
|
|
275
277
|
var pathExists = {exports: {}};
|
|
276
278
|
|
|
277
279
|
const fs = fs$2;
|
|
278
|
-
const {promisify} = require$$
|
|
280
|
+
const {promisify} = require$$1;
|
|
279
281
|
|
|
280
282
|
const pAccess = promisify(fs.access);
|
|
281
283
|
|
|
@@ -758,7 +760,7 @@ standard:"posix"};
|
|
|
758
760
|
const SIGRTMIN=34;
|
|
759
761
|
const SIGRTMAX=64;realtime.SIGRTMAX=SIGRTMAX;
|
|
760
762
|
|
|
761
|
-
Object.defineProperty(signals,"__esModule",{value:true});signals.getSignals=void 0;var _os$1=require$$0
|
|
763
|
+
Object.defineProperty(signals,"__esModule",{value:true});signals.getSignals=void 0;var _os$1=require$$0;
|
|
762
764
|
|
|
763
765
|
var _core=core;
|
|
764
766
|
var _realtime$1=realtime;
|
|
@@ -793,7 +795,7 @@ const number=supported?constantSignal:defaultNumber;
|
|
|
793
795
|
return {name,number,description,supported,action,forced,standard};
|
|
794
796
|
};
|
|
795
797
|
|
|
796
|
-
Object.defineProperty(main,"__esModule",{value:true});main.signalsByNumber=main.signalsByName=void 0;var _os=require$$0
|
|
798
|
+
Object.defineProperty(main,"__esModule",{value:true});main.signalsByNumber=main.signalsByName=void 0;var _os=require$$0;
|
|
797
799
|
|
|
798
800
|
var _signals=signals;
|
|
799
801
|
var _realtime=realtime;
|
|
@@ -1006,7 +1008,7 @@ stdio.exports.node = options => {
|
|
|
1006
1008
|
return [...stdio, 'ipc'];
|
|
1007
1009
|
};
|
|
1008
1010
|
|
|
1009
|
-
const os = require$$0
|
|
1011
|
+
const os = require$$0;
|
|
1010
1012
|
const onExit = signalExit.exports;
|
|
1011
1013
|
|
|
1012
1014
|
const DEFAULT_FORCE_KILL_TIMEOUT = 1000 * 5;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { g as globalApis } from './chunk-constants.7180775c.js';
|
|
2
|
+
import { i as index } from './vendor-entry.5c1e6d94.js';
|
|
3
|
+
import 'url';
|
|
4
|
+
import './chunk-utils-global.29e8a0a3.js';
|
|
5
|
+
import 'tty';
|
|
6
|
+
import 'local-pkg';
|
|
7
|
+
import 'path';
|
|
8
|
+
import 'fs';
|
|
9
|
+
import './chunk-runtime-chain.5cae775c.js';
|
|
10
|
+
import 'chai';
|
|
11
|
+
import './chunk-runtime-rpc.ad208eea.js';
|
|
12
|
+
import './chunk-utils-timers.64f2cbe8.js';
|
|
13
|
+
import './chunk-integrations-spy.bee66426.js';
|
|
14
|
+
import 'tinyspy';
|
|
15
|
+
import 'util';
|
|
16
|
+
import './chunk-defaults.9e0c233e.js';
|
|
17
|
+
import 'module';
|
|
18
|
+
|
|
19
|
+
function registerApiGlobally() {
|
|
20
|
+
globalApis.forEach((api) => {
|
|
21
|
+
globalThis[api] = index[api];
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { registerApiGlobally };
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import chai$1, { expect as expect$1, util } from 'chai';
|
|
2
|
-
import { c as commonjsGlobal } from './
|
|
3
|
-
import { r as rpc } from './chunk-runtime-rpc.
|
|
4
|
-
import { i as isObject, j as join, d as dirname, g as getCallLastIndex, s as slash, a as getWorkerState, b as getNames, c as assertTypes, p as picocolors, n as noop, t as toArray, r as resetModules } from './chunk-utils-global.a5a8641f.js';
|
|
1
|
+
import chai$1, { expect as expect$1, AssertionError, util } from 'chai';
|
|
2
|
+
import { c as commonjsGlobal, i as isObject, j as join, d as dirname, g as getCallLastIndex, s as slash, a as getWorkerState, b as getNames, e as assertTypes, p as picocolors, n as noop, t as toArray, r as resetModules } from './chunk-utils-global.29e8a0a3.js';
|
|
3
|
+
import { r as rpc } from './chunk-runtime-rpc.ad208eea.js';
|
|
5
4
|
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.
|
|
5
|
+
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.64f2cbe8.js';
|
|
7
6
|
import { i as isMockFunction, s as spyOn, f as fn, a as spies } from './chunk-integrations-spy.bee66426.js';
|
|
8
|
-
import require$$
|
|
7
|
+
import require$$1, { format } from 'util';
|
|
9
8
|
|
|
10
9
|
var __defProp$5 = Object.defineProperty;
|
|
11
10
|
var __defProps$2 = Object.defineProperties;
|
|
@@ -624,8 +623,11 @@ function prepareSnapString(snap, source, index) {
|
|
|
624
623
|
const lines = snap.trim().replace(/\\/g, "\\\\").replace(/\$/g, "\\$").split(/\n/g);
|
|
625
624
|
const isOneline = lines.length <= 1;
|
|
626
625
|
const quote = isOneline ? "'" : "`";
|
|
627
|
-
|
|
628
|
-
${lines.
|
|
626
|
+
if (isOneline)
|
|
627
|
+
return `'${lines.join("\n").replace(/'/g, "\\'")}'`;
|
|
628
|
+
else
|
|
629
|
+
return `${quote}
|
|
630
|
+
${lines.map((i) => i ? indentNext + i : "").join("\n").replace(/`/g, "\\`")}
|
|
629
631
|
${indent}${quote}`;
|
|
630
632
|
}
|
|
631
633
|
const startRegex = /(?:toMatchInlineSnapshot|toThrowErrorMatchingInlineSnapshot)\s*\(\s*[\w_$]*(['"`\)])/m;
|
|
@@ -1049,6 +1051,20 @@ const SnapshotPlugin = (chai, utils) => {
|
|
|
1049
1051
|
});
|
|
1050
1052
|
};
|
|
1051
1053
|
|
|
1054
|
+
function getRunningMode() {
|
|
1055
|
+
return process.env.VITEST_MODE === "WATCH" ? "watch" : "run";
|
|
1056
|
+
}
|
|
1057
|
+
function isWatchMode() {
|
|
1058
|
+
return getRunningMode() === "watch";
|
|
1059
|
+
}
|
|
1060
|
+
function toString(value) {
|
|
1061
|
+
try {
|
|
1062
|
+
return `${value}`;
|
|
1063
|
+
} catch (_error) {
|
|
1064
|
+
return "unknown";
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1052
1068
|
const MATCHERS_OBJECT = Symbol.for("matchers-object");
|
|
1053
1069
|
if (!Object.prototype.hasOwnProperty.call(global, MATCHERS_OBJECT)) {
|
|
1054
1070
|
const defaultState = {
|
|
@@ -1083,10 +1099,21 @@ const JestChaiExpect = (chai, utils) => {
|
|
|
1083
1099
|
return function(...args) {
|
|
1084
1100
|
const promise = utils.flag(this, "promise");
|
|
1085
1101
|
const object = utils.flag(this, "object");
|
|
1102
|
+
const isNot = utils.flag(this, "negate");
|
|
1086
1103
|
if (promise === "rejects") {
|
|
1087
1104
|
utils.flag(this, "object", () => {
|
|
1088
1105
|
throw object;
|
|
1089
1106
|
});
|
|
1107
|
+
} else if (promise === "resolves" && typeof object !== "function") {
|
|
1108
|
+
if (!isNot) {
|
|
1109
|
+
const message = utils.flag(this, "message") || "expected promise to throw an error, but it didn't";
|
|
1110
|
+
const error = {
|
|
1111
|
+
showDiff: false
|
|
1112
|
+
};
|
|
1113
|
+
throw new AssertionError(message, error, utils.flag(this, "ssfi"));
|
|
1114
|
+
} else {
|
|
1115
|
+
return;
|
|
1116
|
+
}
|
|
1090
1117
|
}
|
|
1091
1118
|
_super.apply(this, args);
|
|
1092
1119
|
};
|
|
@@ -1322,9 +1349,20 @@ Number of calls: ${picocolors.exports.bold(spy.mock.calls.length)}
|
|
|
1322
1349
|
return this.throws(expected);
|
|
1323
1350
|
const obj = this._obj;
|
|
1324
1351
|
const promise = utils.flag(this, "promise");
|
|
1352
|
+
const isNot = utils.flag(this, "negate");
|
|
1325
1353
|
let thrown = null;
|
|
1326
|
-
if (promise) {
|
|
1354
|
+
if (promise === "rejects") {
|
|
1327
1355
|
thrown = obj;
|
|
1356
|
+
} else if (promise === "resolves" && typeof obj !== "function") {
|
|
1357
|
+
if (!isNot) {
|
|
1358
|
+
const message = utils.flag(this, "message") || "expected promise to throw an error, but it didn't";
|
|
1359
|
+
const error = {
|
|
1360
|
+
showDiff: false
|
|
1361
|
+
};
|
|
1362
|
+
throw new AssertionError(message, error, utils.flag(this, "ssfi"));
|
|
1363
|
+
} else {
|
|
1364
|
+
return;
|
|
1365
|
+
}
|
|
1328
1366
|
} else {
|
|
1329
1367
|
try {
|
|
1330
1368
|
obj();
|
|
@@ -1388,6 +1426,8 @@ Number of calls: ${picocolors.exports.bold(spy.mock.calls.length)}
|
|
|
1388
1426
|
utils.flag(this, "promise", "resolves");
|
|
1389
1427
|
utils.flag(this, "error", new Error("resolves"));
|
|
1390
1428
|
const obj = utils.flag(this, "object");
|
|
1429
|
+
if (typeof (obj == null ? void 0 : obj.then) !== "function")
|
|
1430
|
+
throw new TypeError(`You must provide a Promise to expect() when using .resolves, not '${typeof obj}'.`);
|
|
1391
1431
|
const proxy = new Proxy(this, {
|
|
1392
1432
|
get: (target, key, receiver) => {
|
|
1393
1433
|
const result = Reflect.get(target, key, receiver);
|
|
@@ -1398,7 +1438,7 @@ Number of calls: ${picocolors.exports.bold(spy.mock.calls.length)}
|
|
|
1398
1438
|
utils.flag(this, "object", value);
|
|
1399
1439
|
return result.call(this, ...args);
|
|
1400
1440
|
}, (err) => {
|
|
1401
|
-
throw new Error(`promise rejected "${err}" instead of resolving`);
|
|
1441
|
+
throw new Error(`promise rejected "${toString(err)}" instead of resolving`);
|
|
1402
1442
|
});
|
|
1403
1443
|
};
|
|
1404
1444
|
}
|
|
@@ -1410,6 +1450,8 @@ Number of calls: ${picocolors.exports.bold(spy.mock.calls.length)}
|
|
|
1410
1450
|
utils.flag(this, "error", new Error("rejects"));
|
|
1411
1451
|
const obj = utils.flag(this, "object");
|
|
1412
1452
|
const wrapper = typeof obj === "function" ? obj() : obj;
|
|
1453
|
+
if (typeof (wrapper == null ? void 0 : wrapper.then) !== "function")
|
|
1454
|
+
throw new TypeError(`You must provide a Promise to expect() when using .rejects, not '${typeof wrapper}'.`);
|
|
1413
1455
|
const proxy = new Proxy(this, {
|
|
1414
1456
|
get: (target, key, receiver) => {
|
|
1415
1457
|
const result = Reflect.get(target, key, receiver);
|
|
@@ -1417,7 +1459,7 @@ Number of calls: ${picocolors.exports.bold(spy.mock.calls.length)}
|
|
|
1417
1459
|
return result instanceof chai.Assertion ? proxy : result;
|
|
1418
1460
|
return async (...args) => {
|
|
1419
1461
|
return wrapper.then((value) => {
|
|
1420
|
-
throw new Error(`promise resolved "${value}" instead of rejecting`);
|
|
1462
|
+
throw new Error(`promise resolved "${toString(value)}" instead of rejecting`);
|
|
1421
1463
|
}, (err) => {
|
|
1422
1464
|
utils.flag(this, "object", err);
|
|
1423
1465
|
return result.call(this, ...args);
|
|
@@ -1801,11 +1843,12 @@ function withTimeout(fn, timeout = getDefaultTestTimeout(), isHook = false) {
|
|
|
1801
1843
|
return fn;
|
|
1802
1844
|
return (...args) => {
|
|
1803
1845
|
return Promise.race([fn(...args), new Promise((resolve, reject) => {
|
|
1846
|
+
var _a;
|
|
1804
1847
|
const timer = setTimeout(() => {
|
|
1805
1848
|
clearTimeout(timer);
|
|
1806
1849
|
reject(new Error(makeTimeoutMsg(isHook, timeout)));
|
|
1807
1850
|
}, timeout);
|
|
1808
|
-
timer.unref();
|
|
1851
|
+
(_a = timer.unref) == null ? void 0 : _a.call(timer);
|
|
1809
1852
|
})]);
|
|
1810
1853
|
};
|
|
1811
1854
|
}
|
|
@@ -2913,7 +2956,7 @@ function withGlobal(_global) {
|
|
|
2913
2956
|
hrtimePresent && typeof _global.process.hrtime.bigint === "function";
|
|
2914
2957
|
const nextTickPresent =
|
|
2915
2958
|
_global.process && typeof _global.process.nextTick === "function";
|
|
2916
|
-
const utilPromisify = _global.process && require$$
|
|
2959
|
+
const utilPromisify = _global.process && require$$1.promisify;
|
|
2917
2960
|
const performancePresent =
|
|
2918
2961
|
_global.performance && typeof _global.performance.now === "function";
|
|
2919
2962
|
const hasPerformancePrototype =
|
|
@@ -4817,11 +4860,4 @@ class VitestUtils {
|
|
|
4817
4860
|
const vitest = new VitestUtils();
|
|
4818
4861
|
const vi = vitest;
|
|
4819
4862
|
|
|
4820
|
-
|
|
4821
|
-
return process.env.VITEST_MODE === "WATCH" ? "watch" : "run";
|
|
4822
|
-
}
|
|
4823
|
-
function isWatchMode() {
|
|
4824
|
-
return getRunningMode() === "watch";
|
|
4825
|
-
}
|
|
4826
|
-
|
|
4827
|
-
export { getState as A, RealDate as R, isFirstRun as a, beforeAll as b, afterAll as c, describe as d, beforeEach as e, afterEach as f, createExpect as g, expect as h, it as i, vi as j, getRunningMode as k, isWatchMode as l, resetRunOnceCounter as m, clearCollectorContext as n, defaultSuite as o, setHooks as p, getHooks as q, runOnce as r, suite as s, test as t, collectorContext as u, vitest as v, withCallback as w, getSnapshotClient as x, setState as y, getFn as z };
|
|
4863
|
+
export { getFn as A, getState as B, RealDate as R, isFirstRun as a, beforeAll as b, afterAll as c, describe as d, beforeEach as e, afterEach as f, createExpect as g, expect as h, it as i, vi as j, getRunningMode as k, isWatchMode as l, toString as m, resetRunOnceCounter as n, clearCollectorContext as o, defaultSuite as p, setHooks as q, runOnce as r, suite as s, test as t, getHooks as u, vitest as v, withCallback as w, collectorContext as x, getSnapshotClient as y, setState as z };
|
|
@@ -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.26c328fa.js';
|
|
2
2
|
import { normalizePath } from 'vite';
|
|
3
|
-
import { a as getWorkerState,
|
|
3
|
+
import { a as getWorkerState, F as isWindows, G as mergeSlashes, d as dirname, k as resolve, h as basename, H as getType, I as getAllProperties, s as slash } from './chunk-utils-global.29e8a0a3.js';
|
|
4
4
|
import { existsSync, readdirSync } from 'fs';
|
|
5
|
-
import { d as distDir } from './chunk-constants.
|
|
5
|
+
import { d as distDir } from './chunk-constants.7180775c.js';
|
|
6
6
|
|
|
7
7
|
var __defProp = Object.defineProperty;
|
|
8
8
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
@@ -50,9 +50,10 @@ const _VitestMocker = class {
|
|
|
50
50
|
}
|
|
51
51
|
async resolvePath(id, importer) {
|
|
52
52
|
const path = await this.options.resolveId(id, importer);
|
|
53
|
+
const external = path == null || path.id.includes("/node_modules/") ? id : null;
|
|
53
54
|
return {
|
|
54
55
|
path: normalizeRequestId((path == null ? void 0 : path.id) || id),
|
|
55
|
-
external
|
|
56
|
+
external
|
|
56
57
|
};
|
|
57
58
|
}
|
|
58
59
|
async resolveMocks() {
|
|
@@ -91,13 +92,13 @@ const _VitestMocker = class {
|
|
|
91
92
|
}
|
|
92
93
|
resolveMockPath(mockPath, external) {
|
|
93
94
|
const path = normalizeRequestId(external || mockPath);
|
|
94
|
-
if (external || isNodeBuiltin(mockPath)) {
|
|
95
|
+
if (external || isNodeBuiltin(mockPath) || !existsSync(mockPath)) {
|
|
95
96
|
const mockDirname = dirname(path);
|
|
96
|
-
const baseFilename = basename(path);
|
|
97
97
|
const mockFolder = resolve(this.root, "__mocks__", mockDirname);
|
|
98
98
|
if (!existsSync(mockFolder))
|
|
99
99
|
return null;
|
|
100
100
|
const files = readdirSync(mockFolder);
|
|
101
|
+
const baseFilename = basename(path);
|
|
101
102
|
for (const file of files) {
|
|
102
103
|
const [basename2] = file.split(".");
|
|
103
104
|
if (basename2 === baseFilename)
|
|
@@ -2,6 +2,12 @@ import require$$0 from 'tty';
|
|
|
2
2
|
import { isPackageExists } from 'local-pkg';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
|
|
5
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
6
|
+
|
|
7
|
+
function getDefaultExportFromCjs (x) {
|
|
8
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
9
|
+
}
|
|
10
|
+
|
|
5
11
|
var picocolors = {exports: {}};
|
|
6
12
|
|
|
7
13
|
let tty = require$$0;
|
|
@@ -250,16 +256,22 @@ function getWorkerState() {
|
|
|
250
256
|
return globalThis.__vitest_worker__;
|
|
251
257
|
}
|
|
252
258
|
|
|
259
|
+
function isFinalObj(obj) {
|
|
260
|
+
return obj === Object.prototype || obj === Function.prototype || obj === RegExp.prototype;
|
|
261
|
+
}
|
|
262
|
+
function collectOwnProperties(obj, collector) {
|
|
263
|
+
const props = Object.getOwnPropertyNames(obj);
|
|
264
|
+
const symbs = Object.getOwnPropertySymbols(obj);
|
|
265
|
+
props.forEach((prop) => collector.add(prop));
|
|
266
|
+
symbs.forEach((symb) => collector.add(symb));
|
|
267
|
+
}
|
|
253
268
|
function getAllProperties(obj) {
|
|
254
269
|
const allProps = /* @__PURE__ */ new Set();
|
|
255
270
|
let curr = obj;
|
|
256
271
|
do {
|
|
257
|
-
if (curr
|
|
272
|
+
if (isFinalObj(curr))
|
|
258
273
|
break;
|
|
259
|
-
|
|
260
|
-
const symbs = Object.getOwnPropertySymbols(curr);
|
|
261
|
-
props.forEach((prop) => allProps.add(prop));
|
|
262
|
-
symbs.forEach((symb) => allProps.add(symb));
|
|
274
|
+
collectOwnProperties(curr, allProps);
|
|
263
275
|
} while (curr = Object.getPrototypeOf(curr));
|
|
264
276
|
return Array.from(allProps);
|
|
265
277
|
}
|
|
@@ -277,6 +289,13 @@ const noop = () => {
|
|
|
277
289
|
function getType(value) {
|
|
278
290
|
return Object.prototype.toString.apply(value).slice(8, -1);
|
|
279
291
|
}
|
|
292
|
+
function getOwnProperties(obj) {
|
|
293
|
+
const ownProps = /* @__PURE__ */ new Set();
|
|
294
|
+
if (isFinalObj(obj))
|
|
295
|
+
return [];
|
|
296
|
+
collectOwnProperties(obj, ownProps);
|
|
297
|
+
return Array.from(ownProps);
|
|
298
|
+
}
|
|
280
299
|
function clone(val) {
|
|
281
300
|
let k, out, tmp;
|
|
282
301
|
if (Array.isArray(val)) {
|
|
@@ -287,7 +306,7 @@ function clone(val) {
|
|
|
287
306
|
}
|
|
288
307
|
if (Object.prototype.toString.call(val) === "[object Object]") {
|
|
289
308
|
out = Object.create(Object.getPrototypeOf(val));
|
|
290
|
-
const props =
|
|
309
|
+
const props = getOwnProperties(val);
|
|
291
310
|
for (const k2 of props) {
|
|
292
311
|
out[k2] = (tmp = val[k2]) && typeof tmp === "object" ? clone(tmp) : tmp;
|
|
293
312
|
}
|
|
@@ -372,7 +391,8 @@ function getNames(task) {
|
|
|
372
391
|
return names;
|
|
373
392
|
}
|
|
374
393
|
|
|
375
|
-
const
|
|
394
|
+
const isNode = typeof process !== "undefined" && typeof process.platform !== "undefined";
|
|
395
|
+
const isWindows = isNode && process.platform === "win32";
|
|
376
396
|
function partitionSuiteChildren(suite) {
|
|
377
397
|
let tasksGroup = [];
|
|
378
398
|
const tasksGroups = [];
|
|
@@ -419,7 +439,7 @@ async function ensurePackageInstalled(dependency, promptInstall = !process.env.C
|
|
|
419
439
|
message: picocolors.exports.reset(`Do you want to install ${picocolors.exports.green(dependency)}?`)
|
|
420
440
|
});
|
|
421
441
|
if (install) {
|
|
422
|
-
await (await import('./chunk-install-pkg.
|
|
442
|
+
await (await import('./chunk-install-pkg.078f5345.js')).installPackage(dependency, { dev: true });
|
|
423
443
|
process.stderr.write(picocolors.exports.yellow(`
|
|
424
444
|
Package ${dependency} installed, re-run the command to start.
|
|
425
445
|
`));
|
|
@@ -457,4 +477,4 @@ function getCallLastIndex(code) {
|
|
|
457
477
|
return null;
|
|
458
478
|
}
|
|
459
479
|
|
|
460
|
-
export {
|
|
480
|
+
export { toNamespacedPath as A, ensurePackageInstalled as B, stdout as C, extname as D, getDefaultExportFromCjs as E, isWindows as F, mergeSlashes as G, getType as H, getAllProperties as I, clone as J, partitionSuiteChildren as K, hasTests as L, getWorkerState as a, getNames as b, commonjsGlobal as c, dirname as d, assertTypes as e, notNullish as f, getCallLastIndex as g, basename as h, isObject as i, join as j, resolve as k, isAbsolute as l, relative as m, noop as n, isNode as o, picocolors as p, getTests as q, resetModules as r, slash as s, toArray as t, getFullName as u, hasFailed as v, hasFailedSnapshot as w, getSuites as x, normalize as y, deepMerge as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { s as slash,
|
|
1
|
+
import { s as slash, f as notNullish, p as picocolors } from './chunk-utils-global.29e8a0a3.js';
|
|
2
2
|
|
|
3
3
|
const setTimeout$1 = globalThis.setTimeout;
|
|
4
4
|
const setInterval = globalThis.setInterval;
|
|
@@ -7238,7 +7238,8 @@ function cliTruncate(text, columns, options) {
|
|
|
7238
7238
|
}
|
|
7239
7239
|
|
|
7240
7240
|
function formatLine(line, outputTruncateLength) {
|
|
7241
|
-
|
|
7241
|
+
var _a;
|
|
7242
|
+
return cliTruncate(line, (outputTruncateLength ?? (((_a = process.stdout) == null ? void 0 : _a.columns) || 80)) - 4);
|
|
7242
7243
|
}
|
|
7243
7244
|
function unifiedDiff(actual, expected, options = {}) {
|
|
7244
7245
|
if (actual === expected)
|