vitest 0.14.2 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-api-setup.aa092488.mjs → chunk-api-setup.ff687d0e.mjs} +44 -37
- package/dist/{chunk-constants.da1921b9.mjs → chunk-constants.7b9cfc82.mjs} +1 -1
- package/dist/{chunk-defaults.45dc5e3d.mjs → chunk-defaults.dc6dc23d.mjs} +142 -3
- package/dist/{chunk-integrations-globals.edcc399b.mjs → chunk-integrations-globals.df0878f4.mjs} +7 -7
- package/dist/{chunk-runtime-chain.52571387.mjs → chunk-runtime-chain.ce7f4b92.mjs} +80 -60
- package/dist/{chunk-runtime-mocker.292c0e16.mjs → chunk-runtime-mocker.2f3cbfe5.mjs} +3 -3
- package/dist/{chunk-runtime-rpc.bcd3613c.mjs → chunk-runtime-rpc.5e78af38.mjs} +1 -1
- package/dist/{chunk-utils-global.2684ee9f.mjs → chunk-utils-global.79a8b1cc.mjs} +1 -1
- package/dist/{chunk-utils-source-map.790e5c11.mjs → chunk-utils-source-map.2556cba8.mjs} +1 -1
- package/dist/{chunk-vite-node-externalize.6b27b039.mjs → chunk-vite-node-externalize.db158bfb.mjs} +90 -157
- package/dist/{chunk-vite-node-utils.b9738a10.mjs → chunk-vite-node-utils.c0a0e1b3.mjs} +4 -4
- package/dist/cli.mjs +10 -9
- package/dist/config.cjs +5 -1
- package/dist/config.d.ts +4 -0
- package/dist/config.mjs +5 -1
- package/dist/entry.mjs +6 -6
- package/dist/index.d.ts +32 -4
- package/dist/index.mjs +4 -4
- package/dist/node.d.ts +28 -1
- package/dist/node.mjs +9 -8
- package/dist/{vendor-entry.ba490394.mjs → vendor-entry.7ec02ea2.mjs} +20 -12
- package/dist/worker.mjs +8 -7
- package/package.json +9 -8
|
@@ -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.c0a0e1b3.mjs';
|
|
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 { j as interpretSourcePos, b as parseStacktrace } from './chunk-utils-source-map.
|
|
12
|
+
import { A as API_PATH } from './chunk-constants.7b9cfc82.mjs';
|
|
13
|
+
import { j as interpretSourcePos, b as parseStacktrace } from './chunk-utils-source-map.2556cba8.mjs';
|
|
14
14
|
import 'module';
|
|
15
15
|
import 'vm';
|
|
16
|
-
import './chunk-utils-global.
|
|
16
|
+
import './chunk-utils-global.79a8b1cc.mjs';
|
|
17
17
|
import 'tty';
|
|
18
18
|
import 'local-pkg';
|
|
19
19
|
import 'path';
|
|
@@ -126,6 +126,9 @@ var constants = {
|
|
|
126
126
|
NOOP: () => {}
|
|
127
127
|
};
|
|
128
128
|
|
|
129
|
+
var unmask$1;
|
|
130
|
+
var mask;
|
|
131
|
+
|
|
129
132
|
const { EMPTY_BUFFER: EMPTY_BUFFER$3 } = constants;
|
|
130
133
|
|
|
131
134
|
/**
|
|
@@ -225,30 +228,31 @@ function toBuffer$2(data) {
|
|
|
225
228
|
return buf;
|
|
226
229
|
}
|
|
227
230
|
|
|
228
|
-
|
|
229
|
-
|
|
231
|
+
bufferUtil$1.exports = {
|
|
232
|
+
concat: concat$1,
|
|
233
|
+
mask: _mask,
|
|
234
|
+
toArrayBuffer: toArrayBuffer$1,
|
|
235
|
+
toBuffer: toBuffer$2,
|
|
236
|
+
unmask: _unmask
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
/* istanbul ignore else */
|
|
240
|
+
if (!process.env.WS_NO_BUFFER_UTIL) {
|
|
241
|
+
try {
|
|
242
|
+
const bufferUtil = require('bufferutil');
|
|
230
243
|
|
|
231
|
-
|
|
232
|
-
concat: concat$1,
|
|
233
|
-
mask(source, mask, output, offset, length) {
|
|
244
|
+
mask = bufferUtil$1.exports.mask = function (source, mask, output, offset, length) {
|
|
234
245
|
if (length < 48) _mask(source, mask, output, offset, length);
|
|
235
246
|
else bufferUtil.mask(source, mask, output, offset, length);
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
unmask(buffer, mask) {
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
unmask$1 = bufferUtil$1.exports.unmask = function (buffer, mask) {
|
|
240
250
|
if (buffer.length < 32) _unmask(buffer, mask);
|
|
241
251
|
else bufferUtil.unmask(buffer, mask);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
concat: concat$1,
|
|
247
|
-
mask: _mask,
|
|
248
|
-
toArrayBuffer: toArrayBuffer$1,
|
|
249
|
-
toBuffer: toBuffer$2,
|
|
250
|
-
unmask: _unmask
|
|
251
|
-
};
|
|
252
|
+
};
|
|
253
|
+
} catch (e) {
|
|
254
|
+
// Continue regardless of the error.
|
|
255
|
+
}
|
|
252
256
|
}
|
|
253
257
|
|
|
254
258
|
const kDone = Symbol('kDone');
|
|
@@ -817,6 +821,8 @@ function inflateOnError(err) {
|
|
|
817
821
|
|
|
818
822
|
var validation = {exports: {}};
|
|
819
823
|
|
|
824
|
+
var isValidUTF8_1;
|
|
825
|
+
|
|
820
826
|
//
|
|
821
827
|
// Allowed token characters:
|
|
822
828
|
//
|
|
@@ -922,22 +928,23 @@ function _isValidUTF8(buf) {
|
|
|
922
928
|
return true;
|
|
923
929
|
}
|
|
924
930
|
|
|
925
|
-
|
|
926
|
-
|
|
931
|
+
validation.exports = {
|
|
932
|
+
isValidStatusCode: isValidStatusCode$2,
|
|
933
|
+
isValidUTF8: _isValidUTF8,
|
|
934
|
+
tokenChars: tokenChars$2
|
|
935
|
+
};
|
|
927
936
|
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
937
|
+
/* istanbul ignore else */
|
|
938
|
+
if (!process.env.WS_NO_UTF_8_VALIDATE) {
|
|
939
|
+
try {
|
|
940
|
+
const isValidUTF8 = require('utf-8-validate');
|
|
941
|
+
|
|
942
|
+
isValidUTF8_1 = validation.exports.isValidUTF8 = function (buf) {
|
|
931
943
|
return buf.length < 150 ? _isValidUTF8(buf) : isValidUTF8(buf);
|
|
932
|
-
}
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
}
|
|
936
|
-
validation.exports = {
|
|
937
|
-
isValidStatusCode: isValidStatusCode$2,
|
|
938
|
-
isValidUTF8: _isValidUTF8,
|
|
939
|
-
tokenChars: tokenChars$2
|
|
940
|
-
};
|
|
944
|
+
};
|
|
945
|
+
} catch (e) {
|
|
946
|
+
// Continue regardless of the error.
|
|
947
|
+
}
|
|
941
948
|
}
|
|
942
949
|
|
|
943
950
|
const { Writable } = require$$0$1;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { fileURLToPath } from 'url';
|
|
2
|
-
import {
|
|
2
|
+
import { m as resolve } from './chunk-utils-global.79a8b1cc.mjs';
|
|
3
3
|
|
|
4
4
|
const distDir = resolve(fileURLToPath(import.meta.url), "../../dist");
|
|
5
5
|
const defaultPort = 51204;
|
|
@@ -1,7 +1,142 @@
|
|
|
1
1
|
import { existsSync, promises } from 'fs';
|
|
2
2
|
import { createRequire } from 'module';
|
|
3
3
|
import { pathToFileURL } from 'url';
|
|
4
|
-
import {
|
|
4
|
+
import { C as toArray, m as resolve } from './chunk-utils-global.79a8b1cc.mjs';
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
How it works:
|
|
8
|
+
`this.#head` is an instance of `Node` which keeps track of its current value and nests another instance of `Node` that keeps the value that comes after it. When a value is provided to `.enqueue()`, the code needs to iterate through `this.#head`, going deeper and deeper to find the last value. However, iterating through every single item is slow. This problem is solved by saving a reference to the last value as `this.#tail` so that it can reference it to add a new value.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
class Node {
|
|
12
|
+
value;
|
|
13
|
+
next;
|
|
14
|
+
|
|
15
|
+
constructor(value) {
|
|
16
|
+
this.value = value;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
class Queue {
|
|
21
|
+
#head;
|
|
22
|
+
#tail;
|
|
23
|
+
#size;
|
|
24
|
+
|
|
25
|
+
constructor() {
|
|
26
|
+
this.clear();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
enqueue(value) {
|
|
30
|
+
const node = new Node(value);
|
|
31
|
+
|
|
32
|
+
if (this.#head) {
|
|
33
|
+
this.#tail.next = node;
|
|
34
|
+
this.#tail = node;
|
|
35
|
+
} else {
|
|
36
|
+
this.#head = node;
|
|
37
|
+
this.#tail = node;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
this.#size++;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
dequeue() {
|
|
44
|
+
const current = this.#head;
|
|
45
|
+
if (!current) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
this.#head = this.#head.next;
|
|
50
|
+
this.#size--;
|
|
51
|
+
return current.value;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
clear() {
|
|
55
|
+
this.#head = undefined;
|
|
56
|
+
this.#tail = undefined;
|
|
57
|
+
this.#size = 0;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
get size() {
|
|
61
|
+
return this.#size;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
* [Symbol.iterator]() {
|
|
65
|
+
let current = this.#head;
|
|
66
|
+
|
|
67
|
+
while (current) {
|
|
68
|
+
yield current.value;
|
|
69
|
+
current = current.next;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function pLimit(concurrency) {
|
|
75
|
+
if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
|
|
76
|
+
throw new TypeError('Expected `concurrency` to be a number from 1 and up');
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const queue = new Queue();
|
|
80
|
+
let activeCount = 0;
|
|
81
|
+
|
|
82
|
+
const next = () => {
|
|
83
|
+
activeCount--;
|
|
84
|
+
|
|
85
|
+
if (queue.size > 0) {
|
|
86
|
+
queue.dequeue()();
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const run = async (fn, resolve, args) => {
|
|
91
|
+
activeCount++;
|
|
92
|
+
|
|
93
|
+
const result = (async () => fn(...args))();
|
|
94
|
+
|
|
95
|
+
resolve(result);
|
|
96
|
+
|
|
97
|
+
try {
|
|
98
|
+
await result;
|
|
99
|
+
} catch {}
|
|
100
|
+
|
|
101
|
+
next();
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const enqueue = (fn, resolve, args) => {
|
|
105
|
+
queue.enqueue(run.bind(undefined, fn, resolve, args));
|
|
106
|
+
|
|
107
|
+
(async () => {
|
|
108
|
+
// This function needs to wait until the next microtask before comparing
|
|
109
|
+
// `activeCount` to `concurrency`, because `activeCount` is updated asynchronously
|
|
110
|
+
// when the run function is dequeued and called. The comparison in the if-statement
|
|
111
|
+
// needs to happen asynchronously as well to get an up-to-date value for `activeCount`.
|
|
112
|
+
await Promise.resolve();
|
|
113
|
+
|
|
114
|
+
if (activeCount < concurrency && queue.size > 0) {
|
|
115
|
+
queue.dequeue()();
|
|
116
|
+
}
|
|
117
|
+
})();
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
const generator = (fn, ...args) => new Promise(resolve => {
|
|
121
|
+
enqueue(fn, resolve, args);
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
Object.defineProperties(generator, {
|
|
125
|
+
activeCount: {
|
|
126
|
+
get: () => activeCount,
|
|
127
|
+
},
|
|
128
|
+
pendingCount: {
|
|
129
|
+
get: () => queue.size,
|
|
130
|
+
},
|
|
131
|
+
clearQueue: {
|
|
132
|
+
value: () => {
|
|
133
|
+
queue.clear();
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
return generator;
|
|
139
|
+
}
|
|
5
140
|
|
|
6
141
|
const defaultInclude = ["**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"];
|
|
7
142
|
const defaultExclude = ["**/node_modules/**", "**/dist/**", "**/cypress/**", "**/.{idea,git,cache,output,temp}/**"];
|
|
@@ -64,8 +199,12 @@ const config = {
|
|
|
64
199
|
ui: false,
|
|
65
200
|
uiBase: "/__vitest__/",
|
|
66
201
|
open: true,
|
|
202
|
+
css: {
|
|
203
|
+
include: [/\.module\./]
|
|
204
|
+
},
|
|
67
205
|
coverage: coverageConfigDefaults,
|
|
68
|
-
fakeTimers: fakeTimersDefaults
|
|
206
|
+
fakeTimers: fakeTimersDefaults,
|
|
207
|
+
maxConcurrency: 5
|
|
69
208
|
};
|
|
70
209
|
const configDefaults = Object.freeze(config);
|
|
71
210
|
|
|
@@ -160,4 +299,4 @@ async function reportCoverage(ctx) {
|
|
|
160
299
|
}
|
|
161
300
|
}
|
|
162
301
|
|
|
163
|
-
export { cleanCoverage as a, reportCoverage as b, configDefaults as c, resolveC8Options as r, takeCoverage as t };
|
|
302
|
+
export { cleanCoverage as a, reportCoverage as b, configDefaults as c, pLimit as p, resolveC8Options as r, takeCoverage as t };
|
package/dist/{chunk-integrations-globals.edcc399b.mjs → chunk-integrations-globals.df0878f4.mjs}
RENAMED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { g as globalApis } from './chunk-constants.
|
|
2
|
-
import { i as index } from './vendor-entry.
|
|
1
|
+
import { g as globalApis } from './chunk-constants.7b9cfc82.mjs';
|
|
2
|
+
import { i as index } from './vendor-entry.7ec02ea2.mjs';
|
|
3
3
|
import 'url';
|
|
4
|
-
import './chunk-utils-global.
|
|
4
|
+
import './chunk-utils-global.79a8b1cc.mjs';
|
|
5
5
|
import 'tty';
|
|
6
6
|
import 'local-pkg';
|
|
7
7
|
import 'path';
|
|
8
8
|
import 'fs';
|
|
9
|
-
import './chunk-runtime-chain.
|
|
9
|
+
import './chunk-runtime-chain.ce7f4b92.mjs';
|
|
10
10
|
import 'chai';
|
|
11
11
|
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
12
|
-
import './chunk-runtime-rpc.
|
|
13
|
-
import './chunk-utils-source-map.
|
|
12
|
+
import './chunk-runtime-rpc.5e78af38.mjs';
|
|
13
|
+
import './chunk-utils-source-map.2556cba8.mjs';
|
|
14
14
|
import './chunk-integrations-spy.674b628e.mjs';
|
|
15
15
|
import 'tinyspy';
|
|
16
16
|
import 'util';
|
|
17
|
-
import './chunk-defaults.
|
|
17
|
+
import './chunk-defaults.dc6dc23d.mjs';
|
|
18
18
|
import 'module';
|
|
19
19
|
|
|
20
20
|
function registerApiGlobally() {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import chai$1, { expect
|
|
1
|
+
import chai$1, { expect, AssertionError, util } from 'chai';
|
|
2
2
|
import { c as commonjsGlobal } from './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
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, e as
|
|
3
|
+
import { r as rpc } from './chunk-runtime-rpc.5e78af38.mjs';
|
|
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, e as getFullName, f as safeSetTimeout, h as safeClearTimeout, n as noop, r as resetModules } from './chunk-utils-global.79a8b1cc.mjs';
|
|
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 } from './chunk-utils-source-map.
|
|
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 } from './chunk-utils-source-map.2556cba8.mjs';
|
|
7
7
|
import { i as isMockFunction, s as spyOn, f as fn, a as spies } from './chunk-integrations-spy.674b628e.mjs';
|
|
8
8
|
import require$$0, { format } from 'util';
|
|
9
9
|
|
|
@@ -940,7 +940,7 @@ class SnapshotClient {
|
|
|
940
940
|
try {
|
|
941
941
|
const pass2 = equals(received, properties, [iterableEquality, subsetEquality]);
|
|
942
942
|
if (!pass2)
|
|
943
|
-
expect
|
|
943
|
+
expect(received).equals(properties);
|
|
944
944
|
else
|
|
945
945
|
received = deepMergeSnapshot(received, properties);
|
|
946
946
|
} catch (err) {
|
|
@@ -962,7 +962,7 @@ class SnapshotClient {
|
|
|
962
962
|
});
|
|
963
963
|
if (!pass) {
|
|
964
964
|
try {
|
|
965
|
-
expect
|
|
965
|
+
expect(actual.trim()).equals(expected ? expected.trim() : "");
|
|
966
966
|
} catch (error2) {
|
|
967
967
|
error2.message = errorMessage || `Snapshot \`${key || "unknown"}\` mismatched`;
|
|
968
968
|
throw error2;
|
|
@@ -1068,24 +1068,20 @@ const SnapshotPlugin = (chai, utils) => {
|
|
|
1068
1068
|
});
|
|
1069
1069
|
};
|
|
1070
1070
|
|
|
1071
|
+
const GLOBAL_EXPECT = Symbol.for("expect-global");
|
|
1071
1072
|
const MATCHERS_OBJECT = Symbol.for("matchers-object");
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
assertionCalls: 0,
|
|
1075
|
-
isExpectingAssertions: false,
|
|
1076
|
-
isExpectingAssertionsError: null,
|
|
1077
|
-
expectedAssertionsNumber: null,
|
|
1078
|
-
expectedAssertionsNumberErrorGen: null
|
|
1079
|
-
};
|
|
1073
|
+
|
|
1074
|
+
if (!Object.prototype.hasOwnProperty.call(globalThis, MATCHERS_OBJECT)) {
|
|
1080
1075
|
Object.defineProperty(globalThis, MATCHERS_OBJECT, {
|
|
1081
|
-
value:
|
|
1082
|
-
state: defaultState
|
|
1083
|
-
}
|
|
1076
|
+
value: /* @__PURE__ */ new WeakMap()
|
|
1084
1077
|
});
|
|
1085
1078
|
}
|
|
1086
|
-
const getState = () => globalThis[MATCHERS_OBJECT].
|
|
1087
|
-
const setState = (state) => {
|
|
1088
|
-
|
|
1079
|
+
const getState = (expect) => globalThis[MATCHERS_OBJECT].get(expect);
|
|
1080
|
+
const setState = (state, expect) => {
|
|
1081
|
+
const map = globalThis[MATCHERS_OBJECT];
|
|
1082
|
+
const current = map.get(expect) || {};
|
|
1083
|
+
Object.assign(current, state);
|
|
1084
|
+
map.set(expect, current);
|
|
1089
1085
|
};
|
|
1090
1086
|
const JestChaiExpect = (chai, utils) => {
|
|
1091
1087
|
function def(name, fn) {
|
|
@@ -1489,24 +1485,6 @@ Number of calls: ${picocolors.exports.bold(spy.mock.calls.length)}
|
|
|
1489
1485
|
});
|
|
1490
1486
|
return proxy;
|
|
1491
1487
|
});
|
|
1492
|
-
utils.addMethod(chai.expect, "assertions", function assertions(expected) {
|
|
1493
|
-
const errorGen = () => new Error(`expected number of assertions to be ${expected}, but got ${getState().assertionCalls}`);
|
|
1494
|
-
if (Error.captureStackTrace)
|
|
1495
|
-
Error.captureStackTrace(errorGen(), assertions);
|
|
1496
|
-
setState({
|
|
1497
|
-
expectedAssertionsNumber: expected,
|
|
1498
|
-
expectedAssertionsNumberErrorGen: errorGen
|
|
1499
|
-
});
|
|
1500
|
-
});
|
|
1501
|
-
utils.addMethod(chai.expect, "hasAssertions", function hasAssertions() {
|
|
1502
|
-
const error = new Error("expected any number of assertion, but got none");
|
|
1503
|
-
if (Error.captureStackTrace)
|
|
1504
|
-
Error.captureStackTrace(error, hasAssertions);
|
|
1505
|
-
setState({
|
|
1506
|
-
isExpectingAssertions: true,
|
|
1507
|
-
isExpectingAssertionsError: error
|
|
1508
|
-
});
|
|
1509
|
-
});
|
|
1510
1488
|
utils.addMethod(chai.expect, "addSnapshotSerializer", addSerializer);
|
|
1511
1489
|
};
|
|
1512
1490
|
function toString(value) {
|
|
@@ -1542,8 +1520,8 @@ class AsymmetricMatcher {
|
|
|
1542
1520
|
this.inverse = inverse;
|
|
1543
1521
|
this.$$typeof = Symbol.for("jest.asymmetricMatcher");
|
|
1544
1522
|
}
|
|
1545
|
-
getMatcherContext() {
|
|
1546
|
-
return __spreadProps$1(__spreadValues$2({}, getState()), {
|
|
1523
|
+
getMatcherContext(expect) {
|
|
1524
|
+
return __spreadProps$1(__spreadValues$2({}, getState(expect || globalThis[GLOBAL_EXPECT])), {
|
|
1547
1525
|
equals,
|
|
1548
1526
|
isNot: this.inverse,
|
|
1549
1527
|
utils: matcherUtils
|
|
@@ -1737,7 +1715,7 @@ var __spreadValues$1 = (a, b) => {
|
|
|
1737
1715
|
};
|
|
1738
1716
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
1739
1717
|
const isAsyncFunction = (fn) => typeof fn === "function" && fn[Symbol.toStringTag] === "AsyncFunction";
|
|
1740
|
-
const getMatcherState = (assertion) => {
|
|
1718
|
+
const getMatcherState = (assertion, expect) => {
|
|
1741
1719
|
const obj = assertion._obj;
|
|
1742
1720
|
const isNot = util.flag(assertion, "negate");
|
|
1743
1721
|
const promise = util.flag(assertion, "promise") || "";
|
|
@@ -1745,7 +1723,7 @@ const getMatcherState = (assertion) => {
|
|
|
1745
1723
|
iterableEquality,
|
|
1746
1724
|
subsetEquality
|
|
1747
1725
|
});
|
|
1748
|
-
const matcherState = __spreadProps(__spreadValues$1({}, getState()), {
|
|
1726
|
+
const matcherState = __spreadProps(__spreadValues$1({}, getState(expect)), {
|
|
1749
1727
|
isNot,
|
|
1750
1728
|
utils: jestUtils,
|
|
1751
1729
|
promise,
|
|
@@ -1770,13 +1748,13 @@ function JestExtendPlugin(expect, matchers) {
|
|
|
1770
1748
|
return (c, utils) => {
|
|
1771
1749
|
Object.entries(matchers).forEach(([expectAssertionName, expectAssertion]) => {
|
|
1772
1750
|
function expectSyncWrapper(...args) {
|
|
1773
|
-
const { state, isNot, obj } = getMatcherState(this);
|
|
1751
|
+
const { state, isNot, obj } = getMatcherState(this, expect);
|
|
1774
1752
|
const { pass, message, actual, expected } = expectAssertion.call(state, obj, ...args);
|
|
1775
1753
|
if (pass && isNot || !pass && !isNot)
|
|
1776
1754
|
throw new JestExtendError(message(), actual, expected);
|
|
1777
1755
|
}
|
|
1778
1756
|
async function expectAsyncWrapper(...args) {
|
|
1779
|
-
const { state, isNot, obj } = getMatcherState(this);
|
|
1757
|
+
const { state, isNot, obj } = getMatcherState(this, expect);
|
|
1780
1758
|
const { pass, message, actual, expected } = await expectAssertion.call(state, obj, ...args);
|
|
1781
1759
|
if (pass && isNot || !pass && !isNot)
|
|
1782
1760
|
throw new JestExtendError(message(), actual, expected);
|
|
@@ -1788,7 +1766,7 @@ function JestExtendPlugin(expect, matchers) {
|
|
|
1788
1766
|
super(sample, inverse);
|
|
1789
1767
|
}
|
|
1790
1768
|
asymmetricMatch(other) {
|
|
1791
|
-
const { pass } = expectAssertion.call(this.getMatcherContext(), other, ...this.sample);
|
|
1769
|
+
const { pass } = expectAssertion.call(this.getMatcherContext(expect), other, ...this.sample);
|
|
1792
1770
|
return this.inverse ? !pass : pass;
|
|
1793
1771
|
}
|
|
1794
1772
|
toString() {
|
|
@@ -1829,22 +1807,55 @@ chai$1.use(SnapshotPlugin);
|
|
|
1829
1807
|
chai$1.use(JestAsymmetricMatchers);
|
|
1830
1808
|
|
|
1831
1809
|
function createExpect(test) {
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1810
|
+
var _a;
|
|
1811
|
+
const expect = (value, message) => {
|
|
1812
|
+
const { assertionCalls } = getState(expect);
|
|
1813
|
+
setState({ assertionCalls: assertionCalls + 1 }, expect);
|
|
1835
1814
|
const assert2 = chai$1.expect(value, message);
|
|
1836
1815
|
if (test)
|
|
1837
1816
|
return assert2.withTest(test);
|
|
1838
1817
|
else
|
|
1839
1818
|
return assert2;
|
|
1840
1819
|
};
|
|
1841
|
-
Object.assign(
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1820
|
+
Object.assign(expect, chai$1.expect);
|
|
1821
|
+
expect.getState = () => getState(expect);
|
|
1822
|
+
expect.setState = (state) => setState(state, expect);
|
|
1823
|
+
setState({
|
|
1824
|
+
assertionCalls: 0,
|
|
1825
|
+
isExpectingAssertions: false,
|
|
1826
|
+
isExpectingAssertionsError: null,
|
|
1827
|
+
expectedAssertionsNumber: null,
|
|
1828
|
+
expectedAssertionsNumberErrorGen: null,
|
|
1829
|
+
testPath: (_a = test == null ? void 0 : test.suite.file) == null ? void 0 : _a.filepath,
|
|
1830
|
+
currentTestName: test ? getFullName(test) : void 0
|
|
1831
|
+
}, expect);
|
|
1832
|
+
expect.extend = (matchers) => chai$1.expect.extend(expect, matchers);
|
|
1833
|
+
function assertions(expected) {
|
|
1834
|
+
const errorGen = () => new Error(`expected number of assertions to be ${expected}, but got ${expect.getState().assertionCalls}`);
|
|
1835
|
+
if (Error.captureStackTrace)
|
|
1836
|
+
Error.captureStackTrace(errorGen(), assertions);
|
|
1837
|
+
expect.setState({
|
|
1838
|
+
expectedAssertionsNumber: expected,
|
|
1839
|
+
expectedAssertionsNumberErrorGen: errorGen
|
|
1840
|
+
});
|
|
1841
|
+
}
|
|
1842
|
+
function hasAssertions() {
|
|
1843
|
+
const error = new Error("expected any number of assertion, but got none");
|
|
1844
|
+
if (Error.captureStackTrace)
|
|
1845
|
+
Error.captureStackTrace(error, hasAssertions);
|
|
1846
|
+
expect.setState({
|
|
1847
|
+
isExpectingAssertions: true,
|
|
1848
|
+
isExpectingAssertionsError: error
|
|
1849
|
+
});
|
|
1850
|
+
}
|
|
1851
|
+
util.addMethod(expect, "assertions", assertions);
|
|
1852
|
+
util.addMethod(expect, "hasAssertions", hasAssertions);
|
|
1853
|
+
return expect;
|
|
1846
1854
|
}
|
|
1847
|
-
const
|
|
1855
|
+
const globalExpect = createExpect();
|
|
1856
|
+
Object.defineProperty(globalThis, GLOBAL_EXPECT, {
|
|
1857
|
+
value: globalExpect
|
|
1858
|
+
});
|
|
1848
1859
|
|
|
1849
1860
|
const collectorContext = {
|
|
1850
1861
|
tasks: [],
|
|
@@ -1893,6 +1904,11 @@ function createTestContext(test) {
|
|
|
1893
1904
|
return _expect;
|
|
1894
1905
|
}
|
|
1895
1906
|
});
|
|
1907
|
+
Object.defineProperty(context, "_local", {
|
|
1908
|
+
get() {
|
|
1909
|
+
return _expect != null;
|
|
1910
|
+
}
|
|
1911
|
+
});
|
|
1896
1912
|
return context;
|
|
1897
1913
|
}
|
|
1898
1914
|
function makeTimeoutMsg(isHook, timeout) {
|
|
@@ -2032,7 +2048,7 @@ function createSuite() {
|
|
|
2032
2048
|
suite2.each = (cases) => {
|
|
2033
2049
|
return (name, fn) => {
|
|
2034
2050
|
cases.forEach((i, idx) => {
|
|
2035
|
-
const items =
|
|
2051
|
+
const items = Array.isArray(i) ? i : [i];
|
|
2036
2052
|
suite2(formatTitle(name, items, idx), () => fn(...items));
|
|
2037
2053
|
});
|
|
2038
2054
|
};
|
|
@@ -2046,7 +2062,7 @@ function createTest(fn) {
|
|
|
2046
2062
|
test2.each = (cases) => {
|
|
2047
2063
|
return (name, fn2) => {
|
|
2048
2064
|
cases.forEach((i, idx) => {
|
|
2049
|
-
const items =
|
|
2065
|
+
const items = Array.isArray(i) ? i : [i];
|
|
2050
2066
|
test2(formatTitle(name, items, idx), () => fn2(...items));
|
|
2051
2067
|
});
|
|
2052
2068
|
};
|
|
@@ -2113,7 +2129,7 @@ if (typeof commonjsGlobal !== "undefined") {
|
|
|
2113
2129
|
globalObject$1 = self;
|
|
2114
2130
|
}
|
|
2115
2131
|
|
|
2116
|
-
var global
|
|
2132
|
+
var global = globalObject$1;
|
|
2117
2133
|
|
|
2118
2134
|
var call = Function.call;
|
|
2119
2135
|
|
|
@@ -2821,7 +2837,7 @@ function valueToString(value) {
|
|
|
2821
2837
|
var valueToString_1 = valueToString;
|
|
2822
2838
|
|
|
2823
2839
|
var lib = {
|
|
2824
|
-
global: global
|
|
2840
|
+
global: global,
|
|
2825
2841
|
calledInOrder: calledInOrder_1,
|
|
2826
2842
|
className: className_1,
|
|
2827
2843
|
deprecated: deprecated,
|
|
@@ -4591,7 +4607,11 @@ function withGlobal(_global) {
|
|
|
4591
4607
|
/* eslint-enable complexity */
|
|
4592
4608
|
|
|
4593
4609
|
/** @type {FakeTimers} */
|
|
4594
|
-
withGlobal(globalObject);
|
|
4610
|
+
const defaultImplementation = withGlobal(globalObject);
|
|
4611
|
+
|
|
4612
|
+
defaultImplementation.timers;
|
|
4613
|
+
defaultImplementation.createClock;
|
|
4614
|
+
defaultImplementation.install;
|
|
4595
4615
|
var withGlobal_1 = withGlobal;
|
|
4596
4616
|
|
|
4597
4617
|
const RealDate = Date;
|
|
@@ -4905,4 +4925,4 @@ function isWatchMode() {
|
|
|
4905
4925
|
return getRunningMode() === "watch";
|
|
4906
4926
|
}
|
|
4907
4927
|
|
|
4908
|
-
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,
|
|
4928
|
+
export { getState as A, GLOBAL_EXPECT as G, RealDate as R, isFirstRun as a, beforeAll as b, afterAll as c, describe as d, beforeEach as e, afterEach as f, createExpect as g, globalExpect 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 };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as normalizeRequestId, i as isNodeBuiltin, b as toFilePath, V as ViteNodeRunner } from './chunk-vite-node-utils.
|
|
1
|
+
import { n as normalizeRequestId, i as isNodeBuiltin, b as toFilePath, V as ViteNodeRunner } from './chunk-vite-node-utils.c0a0e1b3.mjs';
|
|
2
2
|
import { normalizePath } from 'vite';
|
|
3
|
-
import { a as getWorkerState, J as isWindows, K as mergeSlashes, d as dirname,
|
|
3
|
+
import { a as getWorkerState, J as isWindows, K as mergeSlashes, d as dirname, m as resolve, l as basename, L as getType, M as getAllProperties, s as slash } from './chunk-utils-global.79a8b1cc.mjs';
|
|
4
4
|
import { existsSync, readdirSync } from 'fs';
|
|
5
|
-
import { d as distDir } from './chunk-constants.
|
|
5
|
+
import { d as distDir } from './chunk-constants.7b9cfc82.mjs';
|
|
6
6
|
|
|
7
7
|
var __defProp = Object.defineProperty;
|
|
8
8
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
@@ -510,4 +510,4 @@ class AggregateErrorPonyfill extends Error {
|
|
|
510
510
|
}
|
|
511
511
|
}
|
|
512
512
|
|
|
513
|
-
export { AggregateErrorPonyfill as A,
|
|
513
|
+
export { AggregateErrorPonyfill as A, safeClearInterval as B, toArray as C, normalize as D, deepMerge as E, toNamespacedPath as F, ensurePackageInstalled as G, stdout as H, extname as I, isWindows as J, mergeSlashes as K, getType as L, getAllProperties as M, deepClone as N, partitionSuiteChildren as O, hasTests as P, getWorkerState as a, getNames as b, assertTypes as c, dirname as d, getFullName as e, safeSetTimeout as f, getCallLastIndex as g, safeClearTimeout as h, isObject as i, join as j, notNullish as k, basename as l, resolve as m, noop as n, isAbsolute as o, picocolors as p, relative as q, resetModules as r, slash as s, isNode as t, getTests as u, hasFailed as v, withSafeTimers as w, hasFailedSnapshot as x, getSuites as y, safeSetInterval as z };
|