vitest 0.27.2 → 0.28.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/LICENSE.md +4 -93
- package/browser.d.ts +1 -1
- package/dist/browser.d.ts +11 -13
- package/dist/browser.js +10 -34
- package/dist/{chunk-api-setup.029198e3.js → chunk-api-setup.52751a38.js} +27 -12
- package/dist/chunk-constants.797d3ebf.js +42 -0
- package/dist/{chunk-env-node.787e9561.js → chunk-env-node.ffd1183b.js} +26 -0
- package/dist/{chunk-install-pkg.7b006b3e.js → chunk-install-pkg.cfd23146.js} +51 -11
- package/dist/chunk-integrations-coverage.48e6286b.js +3993 -0
- package/dist/chunk-integrations-globals.0d5f50f0.js +29 -0
- package/dist/chunk-integrations-run-once.38756e30.js +27 -0
- package/dist/chunk-integrations-utils.f1f6f1ed.js +118 -0
- package/dist/{chunk-node-git.125c9008.js → chunk-node-git.d9ad64ab.js} +6 -7
- package/dist/{chunk-snapshot-manager.ce714e21.js → chunk-node-pkg.dcdf4369.js} +12653 -9324
- package/dist/{chunk-runtime-mocker.58511c38.js → chunk-runtime-mocker.03017e8c.js} +14 -13
- package/dist/{chunk-runtime-rpc.d709e91b.js → chunk-runtime-rpc.9c0386cc.js} +3 -2
- package/dist/chunk-runtime-setup.d9302cfd.js +20 -0
- package/dist/chunk-snapshot-env.6457638e.js +11 -0
- package/dist/chunk-utils-base.977ae74f.js +77 -0
- package/dist/chunk-utils-env.860d90c2.js +6 -0
- package/dist/chunk-utils-global.442d1d33.js +73 -0
- package/dist/{chunk-utils-import.054ab315.js → chunk-utils-import.9911c99d.js} +3289 -169
- package/dist/chunk-utils-tasks.1b603032.js +103 -0
- package/dist/cli-wrapper.js +8 -6
- package/dist/cli.js +18 -15
- package/dist/config.cjs +10 -7
- package/dist/config.d.ts +22 -4
- package/dist/config.js +10 -8
- package/dist/entry.js +244 -28
- package/dist/env-afee91f0.d.ts +10 -0
- package/dist/environments.d.ts +7 -2
- package/dist/environments.js +1 -1
- package/dist/index.d.ts +160 -11
- package/dist/index.js +18 -18
- package/dist/loader.js +9 -8
- package/dist/node.d.ts +9 -7
- package/dist/node.js +20 -17
- package/dist/runners-chunk.js +215 -0
- package/dist/runners.d.ts +39 -0
- package/dist/runners.js +18 -0
- package/dist/spy.js +1 -2
- package/dist/suite.d.ts +2 -0
- package/dist/suite.js +2 -18
- package/dist/{types-d97c72c7.d.ts → types-c800444e.d.ts} +196 -437
- package/dist/{vendor-index.e6c27006.js → vendor-index.618ca5a1.js} +1078 -10
- package/dist/{vendor-index.b0346fe4.js → vendor-index.bdee400f.js} +1 -0
- package/dist/worker.js +17 -16
- package/package.json +22 -12
- package/runners.d.ts +1 -0
- package/suite.d.ts +1 -0
- package/dist/chunk-integrations-coverage.44413252.js +0 -240
- package/dist/chunk-integrations-globals.0024ce21.js +0 -27
- package/dist/chunk-mock-date.c543fa3e.js +0 -349
- package/dist/chunk-runtime-chain.2da9e75c.js +0 -2595
- package/dist/chunk-runtime-error.de671af0.js +0 -144
- package/dist/chunk-runtime-setup.35da9209.js +0 -649
- package/dist/chunk-utils-env.f4a39d2c.js +0 -228
- package/dist/chunk-utils-source-map.5f5d12cf.js +0 -408
- package/dist/chunk-utils-timers.52534f96.js +0 -3573
- package/dist/index-50755efe.d.ts +0 -258
- package/dist/vendor-index.451e37bc.js +0 -1071
- package/dist/vendor-index.723a074f.js +0 -102
- package/dist/vendor-index.9c919048.js +0 -61
- package/dist/vendor-index.9f20a9be.js +0 -6291
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { g as globalApis } from './chunk-constants.797d3ebf.js';
|
|
2
|
+
import { i as index } from './chunk-integrations-utils.f1f6f1ed.js';
|
|
3
|
+
import 'node:url';
|
|
4
|
+
import 'pathe';
|
|
5
|
+
import './chunk-utils-env.860d90c2.js';
|
|
6
|
+
import 'std-env';
|
|
7
|
+
import '@vitest/runner';
|
|
8
|
+
import './chunk-utils-import.9911c99d.js';
|
|
9
|
+
import '@vitest/runner/utils';
|
|
10
|
+
import '@vitest/utils';
|
|
11
|
+
import './chunk-utils-global.442d1d33.js';
|
|
12
|
+
import 'chai';
|
|
13
|
+
import './vendor-_commonjsHelpers.addc3445.js';
|
|
14
|
+
import '@vitest/expect';
|
|
15
|
+
import './chunk-runtime-rpc.9c0386cc.js';
|
|
16
|
+
import './chunk-snapshot-env.6457638e.js';
|
|
17
|
+
import './chunk-utils-base.977ae74f.js';
|
|
18
|
+
import './chunk-utils-tasks.1b603032.js';
|
|
19
|
+
import 'util';
|
|
20
|
+
import '@vitest/spy';
|
|
21
|
+
import './chunk-integrations-run-once.38756e30.js';
|
|
22
|
+
|
|
23
|
+
function registerApiGlobally() {
|
|
24
|
+
globalApis.forEach((api) => {
|
|
25
|
+
globalThis[api] = index[api];
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { registerApiGlobally };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { g as getWorkerState } from './chunk-utils-global.442d1d33.js';
|
|
2
|
+
|
|
3
|
+
const filesCount = /* @__PURE__ */ new Map();
|
|
4
|
+
const cache = /* @__PURE__ */ new Map();
|
|
5
|
+
function runOnce(fn, key) {
|
|
6
|
+
const filepath = getWorkerState().filepath || "__unknown_files__";
|
|
7
|
+
if (!key) {
|
|
8
|
+
filesCount.set(filepath, (filesCount.get(filepath) || 0) + 1);
|
|
9
|
+
key = String(filesCount.get(filepath));
|
|
10
|
+
}
|
|
11
|
+
const id = `${filepath}:${key}`;
|
|
12
|
+
if (!cache.has(id))
|
|
13
|
+
cache.set(id, fn());
|
|
14
|
+
return cache.get(id);
|
|
15
|
+
}
|
|
16
|
+
function isFirstRun() {
|
|
17
|
+
let firstRun = false;
|
|
18
|
+
runOnce(() => {
|
|
19
|
+
firstRun = true;
|
|
20
|
+
}, "__vitest_first_run__");
|
|
21
|
+
return firstRun;
|
|
22
|
+
}
|
|
23
|
+
function resetRunOnceCounter() {
|
|
24
|
+
filesCount.clear();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export { resetRunOnceCounter as a, isFirstRun as i, runOnce as r };
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { suite, test, describe, it, beforeAll, beforeEach, afterAll, afterEach, onTestFailed } from '@vitest/runner';
|
|
2
|
+
import { b as bench, c as createExpect, g as globalExpect, v as vitest, a as vi } from './chunk-utils-import.9911c99d.js';
|
|
3
|
+
import { r as runOnce, i as isFirstRun } from './chunk-integrations-run-once.38756e30.js';
|
|
4
|
+
import * as chai from 'chai';
|
|
5
|
+
import { assert, should } from 'chai';
|
|
6
|
+
|
|
7
|
+
function getRunningMode() {
|
|
8
|
+
return process.env.VITEST_MODE === "WATCH" ? "watch" : "run";
|
|
9
|
+
}
|
|
10
|
+
function isWatchMode() {
|
|
11
|
+
return getRunningMode() === "watch";
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
var dist = {};
|
|
15
|
+
|
|
16
|
+
(function (exports) {
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.expectTypeOf = void 0;
|
|
19
|
+
const fn = () => true;
|
|
20
|
+
/**
|
|
21
|
+
* Similar to Jest's `expect`, but with type-awareness.
|
|
22
|
+
* Gives you access to a number of type-matchers that let you make assertions about the
|
|
23
|
+
* form of a reference or generic type parameter.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* import {foo, bar} from '../foo'
|
|
27
|
+
* import {expectTypeOf} from 'expect-type'
|
|
28
|
+
*
|
|
29
|
+
* test('foo types', () => {
|
|
30
|
+
* // make sure `foo` has type {a: number}
|
|
31
|
+
* expectTypeOf(foo).toMatchTypeOf({a: 1})
|
|
32
|
+
* expectTypeOf(foo).toHaveProperty('a').toBeNumber()
|
|
33
|
+
*
|
|
34
|
+
* // make sure `bar` is a function taking a string:
|
|
35
|
+
* expectTypeOf(bar).parameter(0).toBeString()
|
|
36
|
+
* expectTypeOf(bar).returns.not.toBeAny()
|
|
37
|
+
* })
|
|
38
|
+
*
|
|
39
|
+
* @description
|
|
40
|
+
* See the [full docs](https://npmjs.com/package/expect-type#documentation) for lots more examples.
|
|
41
|
+
*/
|
|
42
|
+
const expectTypeOf = (_actual) => {
|
|
43
|
+
const nonFunctionProperties = [
|
|
44
|
+
'parameters',
|
|
45
|
+
'returns',
|
|
46
|
+
'resolves',
|
|
47
|
+
'not',
|
|
48
|
+
'items',
|
|
49
|
+
'constructorParameters',
|
|
50
|
+
'instance',
|
|
51
|
+
'guards',
|
|
52
|
+
'asserts',
|
|
53
|
+
];
|
|
54
|
+
const obj = {
|
|
55
|
+
/* eslint-disable mmkal/@typescript-eslint/no-unsafe-assignment */
|
|
56
|
+
toBeAny: fn,
|
|
57
|
+
toBeUnknown: fn,
|
|
58
|
+
toBeNever: fn,
|
|
59
|
+
toBeFunction: fn,
|
|
60
|
+
toBeObject: fn,
|
|
61
|
+
toBeArray: fn,
|
|
62
|
+
toBeString: fn,
|
|
63
|
+
toBeNumber: fn,
|
|
64
|
+
toBeBoolean: fn,
|
|
65
|
+
toBeVoid: fn,
|
|
66
|
+
toBeSymbol: fn,
|
|
67
|
+
toBeNull: fn,
|
|
68
|
+
toBeUndefined: fn,
|
|
69
|
+
toBeNullable: fn,
|
|
70
|
+
toMatchTypeOf: fn,
|
|
71
|
+
toEqualTypeOf: fn,
|
|
72
|
+
toBeCallableWith: fn,
|
|
73
|
+
toBeConstructibleWith: fn,
|
|
74
|
+
/* eslint-enable mmkal/@typescript-eslint/no-unsafe-assignment */
|
|
75
|
+
extract: exports.expectTypeOf,
|
|
76
|
+
exclude: exports.expectTypeOf,
|
|
77
|
+
toHaveProperty: exports.expectTypeOf,
|
|
78
|
+
parameter: exports.expectTypeOf,
|
|
79
|
+
};
|
|
80
|
+
const getterProperties = nonFunctionProperties;
|
|
81
|
+
getterProperties.forEach((prop) => Object.defineProperty(obj, prop, { get: () => (0, exports.expectTypeOf)({}) }));
|
|
82
|
+
return obj;
|
|
83
|
+
};
|
|
84
|
+
exports.expectTypeOf = expectTypeOf;
|
|
85
|
+
} (dist));
|
|
86
|
+
|
|
87
|
+
const noop = () => {
|
|
88
|
+
};
|
|
89
|
+
const assertType = noop;
|
|
90
|
+
|
|
91
|
+
var index = /*#__PURE__*/Object.freeze({
|
|
92
|
+
__proto__: null,
|
|
93
|
+
suite: suite,
|
|
94
|
+
test: test,
|
|
95
|
+
describe: describe,
|
|
96
|
+
it: it,
|
|
97
|
+
beforeAll: beforeAll,
|
|
98
|
+
beforeEach: beforeEach,
|
|
99
|
+
afterAll: afterAll,
|
|
100
|
+
afterEach: afterEach,
|
|
101
|
+
onTestFailed: onTestFailed,
|
|
102
|
+
bench: bench,
|
|
103
|
+
runOnce: runOnce,
|
|
104
|
+
isFirstRun: isFirstRun,
|
|
105
|
+
assert: assert,
|
|
106
|
+
should: should,
|
|
107
|
+
createExpect: createExpect,
|
|
108
|
+
chai: chai,
|
|
109
|
+
expect: globalExpect,
|
|
110
|
+
vitest: vitest,
|
|
111
|
+
vi: vi,
|
|
112
|
+
getRunningMode: getRunningMode,
|
|
113
|
+
isWatchMode: isWatchMode,
|
|
114
|
+
expectTypeOf: dist.expectTypeOf,
|
|
115
|
+
assertType: assertType
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
export { isWatchMode as a, assertType as b, dist as d, getRunningMode as g, index as i };
|
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { e as execa } from './vendor-index.
|
|
3
|
-
import 'node:url';
|
|
4
|
-
import 'path';
|
|
1
|
+
import { resolve } from 'pathe';
|
|
2
|
+
import { e as execa } from './vendor-index.618ca5a1.js';
|
|
5
3
|
import 'node:buffer';
|
|
6
4
|
import 'node:path';
|
|
7
5
|
import 'node:child_process';
|
|
8
6
|
import 'node:process';
|
|
9
|
-
import './vendor-index.e6c27006.js';
|
|
10
7
|
import 'child_process';
|
|
8
|
+
import 'path';
|
|
11
9
|
import './vendor-_commonjsHelpers.addc3445.js';
|
|
12
10
|
import 'fs';
|
|
11
|
+
import 'node:url';
|
|
12
|
+
import 'os';
|
|
13
|
+
import 'node:os';
|
|
13
14
|
import 'assert';
|
|
14
15
|
import 'events';
|
|
15
16
|
import 'buffer';
|
|
16
17
|
import 'stream';
|
|
17
18
|
import 'util';
|
|
18
|
-
import 'os';
|
|
19
|
-
import 'node:os';
|
|
20
19
|
|
|
21
20
|
class VitestGit {
|
|
22
21
|
constructor(cwd) {
|