vitest 0.31.4 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +2 -2
- package/dist/child.js +3 -3
- package/dist/{chunk-api-setup.3854747a.js → chunk-api-setup.05e3917b.js} +1 -1
- package/dist/{chunk-install-pkg.4f68b0aa.js → chunk-install-pkg.ce602c20.js} +3 -3
- package/dist/{chunk-integrations-globals.6a234998.js → chunk-integrations-globals.277730ba.js} +3 -2
- package/dist/cli.js +18 -7
- package/dist/config.cjs +8 -9
- package/dist/config.d.ts +5 -3
- package/dist/config.js +8 -9
- package/dist/coverage.d.ts +9 -1
- package/dist/coverage.js +31 -0
- package/dist/entry.js +5 -4
- package/dist/environments.d.ts +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -3
- package/dist/node.d.ts +6 -5
- package/dist/node.js +5 -4
- package/dist/runners.d.ts +1 -1
- package/dist/runners.js +2 -1
- package/dist/{types-dea83b3d.d.ts → types-2b1c412e.d.ts} +30 -10
- package/dist/{vendor-cli-api.8cf937e8.js → vendor-cli-api.897427d4.js} +120 -100
- package/dist/{vendor-coverage.c8fd34c3.js → vendor-coverage.de2180ed.js} +2 -1
- package/dist/{vendor-execute.132a3e09.js → vendor-execute.001ae440.js} +36 -8
- package/dist/{vendor-index.5037f2c0.js → vendor-index.87ab04c3.js} +2 -2
- package/dist/{vendor-index.f81f6285.js → vendor-index.b46c103a.js} +1 -1
- package/dist/{vendor-setup.common.823a1300.js → vendor-setup.common.a35ee78b.js} +1 -1
- package/dist/{vendor-vi.23b98fa1.js → vendor-vi.55d2bc52.js} +31 -4
- package/dist/worker.js +3 -3
- package/package.json +9 -9
|
@@ -4,8 +4,9 @@ import { getSafeTimers, noop, assertTypes, createSimpleStackTrace, parseSingleSt
|
|
|
4
4
|
import { d as isRunningInBenchmark, c as resetModules } from './vendor-index.fad2598b.js';
|
|
5
5
|
import * as chai$1 from 'chai';
|
|
6
6
|
import { c as commonjsGlobal } from './vendor-_commonjsHelpers.76cdd49e.js';
|
|
7
|
-
import { equals, iterableEquality, subsetEquality, JestExtend, JestChaiExpect, JestAsymmetricMatchers, GLOBAL_EXPECT, getState, setState } from '@vitest/expect';
|
|
7
|
+
import { equals, iterableEquality, subsetEquality, JestExtend, JestChaiExpect, JestAsymmetricMatchers, GLOBAL_EXPECT as GLOBAL_EXPECT$1, getState, setState } from '@vitest/expect';
|
|
8
8
|
import { SnapshotClient, stripSnapshotIndentation, addSerializer } from '@vitest/snapshot';
|
|
9
|
+
import '@vitest/utils/error';
|
|
9
10
|
import { g as getWorkerState, a as getCurrentEnvironment } from './vendor-global.6795f91f.js';
|
|
10
11
|
import { g as getFullName } from './vendor-tasks.f9d75aed.js';
|
|
11
12
|
import require$$0 from 'util';
|
|
@@ -151,6 +152,25 @@ var chaiSubset = {exports: {}};
|
|
|
151
152
|
|
|
152
153
|
var Subset = chaiSubset.exports;
|
|
153
154
|
|
|
155
|
+
const MATCHERS_OBJECT = Symbol.for("matchers-object");
|
|
156
|
+
const JEST_MATCHERS_OBJECT = Symbol.for("$$jest-matchers-object");
|
|
157
|
+
const GLOBAL_EXPECT = Symbol.for("expect-global");
|
|
158
|
+
|
|
159
|
+
if (!Object.prototype.hasOwnProperty.call(globalThis, MATCHERS_OBJECT)) {
|
|
160
|
+
const globalState = /* @__PURE__ */ new WeakMap();
|
|
161
|
+
const matchers = /* @__PURE__ */ Object.create(null);
|
|
162
|
+
Object.defineProperty(globalThis, MATCHERS_OBJECT, {
|
|
163
|
+
get: () => globalState
|
|
164
|
+
});
|
|
165
|
+
Object.defineProperty(globalThis, JEST_MATCHERS_OBJECT, {
|
|
166
|
+
configurable: true,
|
|
167
|
+
get: () => ({
|
|
168
|
+
state: globalState.get(globalThis[GLOBAL_EXPECT]),
|
|
169
|
+
matchers
|
|
170
|
+
})
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
|
|
154
174
|
function recordAsyncExpect(test, promise) {
|
|
155
175
|
if (test && promise instanceof Promise) {
|
|
156
176
|
promise = promise.finally(() => {
|
|
@@ -336,7 +356,7 @@ function createExpect(test) {
|
|
|
336
356
|
var _a;
|
|
337
357
|
const expect = (value, message) => {
|
|
338
358
|
const { assertionCalls } = getState(expect);
|
|
339
|
-
setState({ assertionCalls: assertionCalls + 1 }, expect);
|
|
359
|
+
setState({ assertionCalls: assertionCalls + 1, soft: false }, expect);
|
|
340
360
|
const assert2 = chai$1.expect(value, message);
|
|
341
361
|
const _test = test || getCurrentTest();
|
|
342
362
|
if (_test)
|
|
@@ -347,7 +367,7 @@ function createExpect(test) {
|
|
|
347
367
|
Object.assign(expect, chai$1.expect);
|
|
348
368
|
expect.getState = () => getState(expect);
|
|
349
369
|
expect.setState = (state) => setState(state, expect);
|
|
350
|
-
const globalState = getState(globalThis[GLOBAL_EXPECT]) || {};
|
|
370
|
+
const globalState = getState(globalThis[GLOBAL_EXPECT$1]) || {};
|
|
351
371
|
setState({
|
|
352
372
|
// this should also add "snapshotState" that is added conditionally
|
|
353
373
|
...globalState,
|
|
@@ -361,6 +381,13 @@ function createExpect(test) {
|
|
|
361
381
|
currentTestName: test ? getFullName(test) : globalState.currentTestName
|
|
362
382
|
}, expect);
|
|
363
383
|
expect.extend = (matchers) => chai$1.expect.extend(expect, matchers);
|
|
384
|
+
expect.soft = (...args) => {
|
|
385
|
+
const assert2 = expect(...args);
|
|
386
|
+
expect.setState({
|
|
387
|
+
soft: true
|
|
388
|
+
});
|
|
389
|
+
return assert2;
|
|
390
|
+
};
|
|
364
391
|
function assertions(expected) {
|
|
365
392
|
const errorGen = () => new Error(`expected number of assertions to be ${expected}, but got ${expect.getState().assertionCalls}`);
|
|
366
393
|
if (Error.captureStackTrace)
|
|
@@ -384,7 +411,7 @@ function createExpect(test) {
|
|
|
384
411
|
return expect;
|
|
385
412
|
}
|
|
386
413
|
const globalExpect = createExpect();
|
|
387
|
-
Object.defineProperty(globalThis, GLOBAL_EXPECT, {
|
|
414
|
+
Object.defineProperty(globalThis, GLOBAL_EXPECT$1, {
|
|
388
415
|
value: globalExpect,
|
|
389
416
|
writable: true,
|
|
390
417
|
configurable: true
|
package/dist/worker.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { performance } from 'node:perf_hooks';
|
|
2
|
-
import { c as createBirpc } from './vendor-index.
|
|
2
|
+
import { c as createBirpc } from './vendor-index.87ab04c3.js';
|
|
3
3
|
import { workerId } from 'tinypool';
|
|
4
4
|
import { g as getWorkerState } from './vendor-global.6795f91f.js';
|
|
5
|
-
import { s as startViteNode, m as moduleCache, a as mockMap } from './vendor-execute.
|
|
5
|
+
import { s as startViteNode, m as moduleCache, a as mockMap } from './vendor-execute.001ae440.js';
|
|
6
6
|
import { s as setupInspect } from './vendor-inspector.47fc8cbb.js';
|
|
7
7
|
import { a as rpcDone } from './vendor-rpc.4d3d7a54.js';
|
|
8
8
|
import '@vitest/utils';
|
|
@@ -10,7 +10,7 @@ import 'node:url';
|
|
|
10
10
|
import 'vite-node/client';
|
|
11
11
|
import 'vite-node/utils';
|
|
12
12
|
import 'pathe';
|
|
13
|
-
import '@vitest/
|
|
13
|
+
import '@vitest/utils/error';
|
|
14
14
|
import './vendor-paths.84fc7a99.js';
|
|
15
15
|
import 'node:fs';
|
|
16
16
|
import '@vitest/spy';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.32.0",
|
|
5
5
|
"description": "A blazing fast unit test framework powered by Vite",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -148,17 +148,17 @@
|
|
|
148
148
|
"tinypool": "^0.5.0",
|
|
149
149
|
"vite": "^3.0.0 || ^4.0.0",
|
|
150
150
|
"why-is-node-running": "^2.2.2",
|
|
151
|
-
"@vitest/
|
|
152
|
-
"@vitest/
|
|
153
|
-
"@vitest/
|
|
154
|
-
"@vitest/
|
|
155
|
-
"vite-node": "0.
|
|
156
|
-
"@vitest/
|
|
151
|
+
"@vitest/utils": "0.32.0",
|
|
152
|
+
"@vitest/spy": "0.32.0",
|
|
153
|
+
"@vitest/runner": "0.32.0",
|
|
154
|
+
"@vitest/snapshot": "0.32.0",
|
|
155
|
+
"vite-node": "0.32.0",
|
|
156
|
+
"@vitest/expect": "0.32.0"
|
|
157
157
|
},
|
|
158
158
|
"devDependencies": {
|
|
159
159
|
"@ampproject/remapping": "^2.2.1",
|
|
160
160
|
"@antfu/install-pkg": "^0.1.1",
|
|
161
|
-
"@edge-runtime/vm": "
|
|
161
|
+
"@edge-runtime/vm": "3.0.1",
|
|
162
162
|
"@jridgewell/trace-mapping": "^0.3.18",
|
|
163
163
|
"@sinonjs/fake-timers": "^10.0.2",
|
|
164
164
|
"@types/diff": "^5.0.3",
|
|
@@ -180,7 +180,7 @@
|
|
|
180
180
|
"flatted": "^3.2.7",
|
|
181
181
|
"get-tsconfig": "^4.5.0",
|
|
182
182
|
"happy-dom": "^9.10.7",
|
|
183
|
-
"jsdom": "^
|
|
183
|
+
"jsdom": "^22.1.0",
|
|
184
184
|
"log-update": "^5.0.1",
|
|
185
185
|
"micromatch": "^4.0.5",
|
|
186
186
|
"mlly": "^1.2.0",
|