vitest 0.22.1 → 0.23.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 +29 -29
- package/dist/browser.d.ts +5 -4
- package/dist/browser.mjs +11 -9
- package/dist/{chunk-api-setup.377c28aa.mjs → chunk-api-setup.5fc06d1d.mjs} +90 -87
- package/dist/{chunk-constants.71e8a211.mjs → chunk-constants.6196597b.mjs} +0 -0
- package/dist/{chunk-integrations-coverage.d205bd87.mjs → chunk-env-node.ceb43f1c.mjs} +31 -179
- package/dist/{chunk-install-pkg.3aa3eae6.mjs → chunk-install-pkg.e081fc1b.mjs} +3 -3
- package/dist/chunk-integrations-coverage.99c020eb.mjs +166 -0
- package/dist/{chunk-integrations-globals.60af7da3.mjs → chunk-integrations-globals.ef598c23.mjs} +6 -7
- package/dist/{chunk-magic-string.efe26975.mjs → chunk-magic-string.56b2b543.mjs} +30 -10
- package/dist/{chunk-mock-date.304e29b1.mjs → chunk-mock-date.0d86eaa5.mjs} +26 -5
- package/dist/{chunk-node-git.9a7e3153.mjs → chunk-node-git.6f289b0a.mjs} +18 -12
- package/dist/{chunk-runtime-chain.be610650.mjs → chunk-runtime-chain.2af36ddf.mjs} +507 -173
- package/dist/{chunk-runtime-error.1104e45a.mjs → chunk-runtime-error.ed9b4f70.mjs} +206 -75
- package/dist/{chunk-runtime-hooks.5d7073db.mjs → chunk-runtime-hooks.75ce0575.mjs} +18 -12
- package/dist/{chunk-runtime-mocker.49d21aa6.mjs → chunk-runtime-mocker.fc76f21d.mjs} +17 -10
- package/dist/{chunk-runtime-rpc.57586b73.mjs → chunk-runtime-rpc.3fe371e9.mjs} +1 -2
- package/dist/{chunk-utils-source-map.bbf3ad19.mjs → chunk-utils-source-map.70ee97e1.mjs} +11 -5
- package/dist/{chunk-vite-node-client.cddda63d.mjs → chunk-vite-node-client.74ebe3d5.mjs} +55 -13
- package/dist/{chunk-vite-node-debug.536c4c5b.mjs → chunk-vite-node-debug.2d8a1dc3.mjs} +1 -1
- package/dist/{chunk-vite-node-externalize.c843f497.mjs → chunk-vite-node-externalize.41bf722e.mjs} +483 -197
- package/dist/{chunk-vite-node-utils.b432150c.mjs → chunk-vite-node-utils.68573626.mjs} +24 -40
- package/dist/cli-wrapper.mjs +21 -17
- package/dist/cli.mjs +23 -15
- package/dist/config.cjs +2 -2
- package/dist/config.d.ts +4 -3
- package/dist/config.mjs +2 -2
- package/dist/entry.mjs +19 -14
- package/dist/environments.d.ts +23 -0
- package/dist/environments.mjs +3 -0
- package/dist/{global-fe52f84b.d.ts → global-ea084c9f.d.ts} +135 -19
- package/dist/{index-ea17aa0c.d.ts → index-5f09f4d0.d.ts} +3 -2
- package/dist/index.d.ts +6 -5
- package/dist/index.mjs +6 -7
- package/dist/loader.mjs +3 -4
- package/dist/node.d.ts +5 -4
- package/dist/node.mjs +14 -12
- package/dist/suite.mjs +5 -6
- package/dist/vendor-index.0557b03a.mjs +147 -0
- package/dist/{vendor-index.9d9196cc.mjs → vendor-index.13e3bda3.mjs} +0 -0
- package/dist/{vendor-index.fbec8a81.mjs → vendor-index.4aeeb598.mjs} +2 -2
- package/dist/{vendor-index.2ae8040a.mjs → vendor-index.62ce5c33.mjs} +0 -0
- package/dist/{vendor-index.29636037.mjs → vendor-index.731a22f2.mjs} +0 -0
- package/dist/worker.mjs +17 -15
- package/package.json +17 -10
- package/dist/chunk-utils-global.fa20c2f6.mjs +0 -5
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { c as commonjsGlobal } from './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
2
|
+
|
|
3
|
+
function _mergeNamespaces(n, m) {
|
|
4
|
+
m.forEach(function (e) {
|
|
5
|
+
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
|
|
6
|
+
if (k !== 'default' && !(k in n)) {
|
|
7
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
8
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return e[k]; }
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
return Object.freeze(n);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
var eventTargetPolyfill = {};
|
|
19
|
+
|
|
20
|
+
const root =
|
|
21
|
+
(typeof globalThis !== "undefined" && globalThis) ||
|
|
22
|
+
(typeof self !== "undefined" && self) ||
|
|
23
|
+
(typeof commonjsGlobal !== "undefined" && commonjsGlobal);
|
|
24
|
+
|
|
25
|
+
function isConstructor(fn) {
|
|
26
|
+
try {
|
|
27
|
+
new fn();
|
|
28
|
+
} catch (error) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (typeof root.Event !== "function" || !isConstructor(root.Event)) {
|
|
35
|
+
root.Event = (function () {
|
|
36
|
+
function Event(type, options) {
|
|
37
|
+
this.bubbles = !!options && !!options.bubbles;
|
|
38
|
+
this.cancelable = !!options && !!options.cancelable;
|
|
39
|
+
this.composed = !!options && !!options.composed;
|
|
40
|
+
this.type = type;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return Event;
|
|
44
|
+
})();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (typeof root.EventTarget === "undefined" || !isConstructor(root.Event)) {
|
|
48
|
+
root.EventTarget = (function () {
|
|
49
|
+
function EventTarget() {
|
|
50
|
+
this.__listeners = new Map();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
EventTarget.prototype = Object.create(Object.prototype);
|
|
54
|
+
|
|
55
|
+
EventTarget.prototype.addEventListener = function (
|
|
56
|
+
type,
|
|
57
|
+
listener,
|
|
58
|
+
options
|
|
59
|
+
) {
|
|
60
|
+
if (arguments.length < 2) {
|
|
61
|
+
throw new TypeError(
|
|
62
|
+
`TypeError: Failed to execute 'addEventListener' on 'EventTarget': 2 arguments required, but only ${arguments.length} present.`
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
const __listeners = this.__listeners;
|
|
66
|
+
const actualType = type.toString();
|
|
67
|
+
if (!__listeners.has(actualType)) {
|
|
68
|
+
__listeners.set(actualType, new Map());
|
|
69
|
+
}
|
|
70
|
+
const listenersForType = __listeners.get(actualType);
|
|
71
|
+
if (!listenersForType.has(listener)) {
|
|
72
|
+
// Any given listener is only registered once
|
|
73
|
+
listenersForType.set(listener, options);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
EventTarget.prototype.removeEventListener = function (
|
|
78
|
+
type,
|
|
79
|
+
listener,
|
|
80
|
+
_options
|
|
81
|
+
) {
|
|
82
|
+
if (arguments.length < 2) {
|
|
83
|
+
throw new TypeError(
|
|
84
|
+
`TypeError: Failed to execute 'addEventListener' on 'EventTarget': 2 arguments required, but only ${arguments.length} present.`
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
const __listeners = this.__listeners;
|
|
88
|
+
const actualType = type.toString();
|
|
89
|
+
if (__listeners.has(actualType)) {
|
|
90
|
+
const listenersForType = __listeners.get(actualType);
|
|
91
|
+
if (listenersForType.has(listener)) {
|
|
92
|
+
listenersForType.delete(listener);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
EventTarget.prototype.dispatchEvent = function (event) {
|
|
98
|
+
if (!(event instanceof Event)) {
|
|
99
|
+
throw new TypeError(
|
|
100
|
+
`Failed to execute 'dispatchEvent' on 'EventTarget': parameter 1 is not of type 'Event'.`
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
const type = event.type;
|
|
104
|
+
const __listeners = this.__listeners;
|
|
105
|
+
const listenersForType = __listeners.get(type);
|
|
106
|
+
if (listenersForType) {
|
|
107
|
+
for (const [listener, options] of listenersForType.entries()) {
|
|
108
|
+
try {
|
|
109
|
+
if (typeof listener === "function") {
|
|
110
|
+
// Listener functions must be executed with the EventTarget as the `this` context.
|
|
111
|
+
listener.call(this, event);
|
|
112
|
+
} else if (listener && typeof listener.handleEvent === "function") {
|
|
113
|
+
// Listener objects have their handleEvent method called, if they have one
|
|
114
|
+
listener.handleEvent(event);
|
|
115
|
+
}
|
|
116
|
+
} catch (err) {
|
|
117
|
+
// We need to report the error to the global error handling event,
|
|
118
|
+
// but we do not want to break the loop that is executing the events.
|
|
119
|
+
// Unfortunately, this is the best we can do, which isn't great, because the
|
|
120
|
+
// native EventTarget will actually do this synchronously before moving to the next
|
|
121
|
+
// event in the loop.
|
|
122
|
+
setTimeout(() => {
|
|
123
|
+
throw err;
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
if (options && options.once) {
|
|
127
|
+
// If this was registered with { once: true }, we need
|
|
128
|
+
// to remove it now.
|
|
129
|
+
listenersForType.delete(listener);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
// Since there are no cancellable events on a base EventTarget,
|
|
134
|
+
// this should always return true.
|
|
135
|
+
return true;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
return EventTarget;
|
|
139
|
+
})();
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
var index = /*#__PURE__*/_mergeNamespaces({
|
|
143
|
+
__proto__: null,
|
|
144
|
+
'default': eventTargetPolyfill
|
|
145
|
+
}, [eventTargetPolyfill]);
|
|
146
|
+
|
|
147
|
+
export { index as i };
|
|
File without changes
|
|
@@ -2,10 +2,10 @@ import { Buffer } from 'buffer';
|
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import childProcess from 'child_process';
|
|
4
4
|
import process$1 from 'process';
|
|
5
|
-
import { m as mergeStream, g as getStream, c as crossSpawn } from './vendor-index.
|
|
5
|
+
import { m as mergeStream, g as getStream, c as crossSpawn } from './vendor-index.62ce5c33.mjs';
|
|
6
6
|
import url from 'url';
|
|
7
7
|
import require$$0, { constants } from 'os';
|
|
8
|
-
import { s as signalExit } from './vendor-index.
|
|
8
|
+
import { s as signalExit } from './vendor-index.731a22f2.mjs';
|
|
9
9
|
|
|
10
10
|
function stripFinalNewline(input) {
|
|
11
11
|
const LF = typeof input === 'string' ? '\n' : '\n'.charCodeAt();
|
|
File without changes
|
|
File without changes
|
package/dist/worker.mjs
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { a as resolve, c as distDir } from './chunk-constants.
|
|
2
|
-
import { c as createBirpc, M as ModuleCacheMap } from './chunk-vite-node-client.
|
|
1
|
+
import { a as resolve, c as distDir } from './chunk-constants.6196597b.mjs';
|
|
2
|
+
import { c as createBirpc, M as ModuleCacheMap } from './chunk-vite-node-client.74ebe3d5.mjs';
|
|
3
3
|
import { workerId } from 'tinypool';
|
|
4
|
-
import './chunk-mock-date.
|
|
5
|
-
import { e as executeInViteNode } from './chunk-runtime-mocker.
|
|
6
|
-
import { r as rpc } from './chunk-runtime-rpc.
|
|
7
|
-
import { g as getWorkerState } from './chunk-utils-global.fa20c2f6.mjs';
|
|
4
|
+
import { g as getWorkerState } from './chunk-mock-date.0d86eaa5.mjs';
|
|
5
|
+
import { e as executeInViteNode } from './chunk-runtime-mocker.fc76f21d.mjs';
|
|
6
|
+
import { r as rpc } from './chunk-runtime-rpc.3fe371e9.mjs';
|
|
8
7
|
import 'tty';
|
|
9
8
|
import 'url';
|
|
10
9
|
import 'path';
|
|
11
10
|
import 'module';
|
|
12
11
|
import 'vm';
|
|
13
|
-
import './chunk-vite-node-utils.
|
|
12
|
+
import './chunk-vite-node-utils.68573626.mjs';
|
|
14
13
|
import 'fs';
|
|
15
14
|
import 'assert';
|
|
16
15
|
import 'util';
|
|
@@ -67,15 +66,18 @@ function init(ctx) {
|
|
|
67
66
|
moduleCache,
|
|
68
67
|
config,
|
|
69
68
|
mockMap,
|
|
70
|
-
rpc: createBirpc(
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
69
|
+
rpc: createBirpc(
|
|
70
|
+
{},
|
|
71
|
+
{
|
|
72
|
+
eventNames: ["onUserConsoleLog", "onFinished", "onCollected", "onWorkerExit"],
|
|
73
|
+
post(v) {
|
|
74
|
+
port.postMessage(v);
|
|
75
|
+
},
|
|
76
|
+
on(fn) {
|
|
77
|
+
port.addListener("message", fn);
|
|
78
|
+
}
|
|
77
79
|
}
|
|
78
|
-
|
|
80
|
+
)
|
|
79
81
|
};
|
|
80
82
|
if (ctx.invalidates) {
|
|
81
83
|
ctx.invalidates.forEach((fsPath) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"description": "A blazing fast unit test framework powered by Vite",
|
|
5
5
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,6 +36,10 @@
|
|
|
36
36
|
"types": "./dist/node.d.ts",
|
|
37
37
|
"import": "./dist/node.mjs"
|
|
38
38
|
},
|
|
39
|
+
"./environments": {
|
|
40
|
+
"types": "./dist/environments.d.ts",
|
|
41
|
+
"import": "./dist/environments.mjs"
|
|
42
|
+
},
|
|
39
43
|
"./browser": {
|
|
40
44
|
"types": "./dist/browser.d.ts",
|
|
41
45
|
"import": "./dist/browser.mjs"
|
|
@@ -93,13 +97,15 @@
|
|
|
93
97
|
"chai": "^4.3.6",
|
|
94
98
|
"debug": "^4.3.4",
|
|
95
99
|
"local-pkg": "^0.4.2",
|
|
100
|
+
"strip-literal": "^0.4.0",
|
|
101
|
+
"tinybench": "^2.1.3",
|
|
96
102
|
"tinypool": "^0.2.4",
|
|
97
103
|
"tinyspy": "^1.0.2",
|
|
98
104
|
"vite": "^2.9.12 || ^3.0.0-0"
|
|
99
105
|
},
|
|
100
106
|
"devDependencies": {
|
|
101
107
|
"@antfu/install-pkg": "^0.1.0",
|
|
102
|
-
"@edge-runtime/vm": "1.1.0-beta.
|
|
108
|
+
"@edge-runtime/vm": "1.1.0-beta.31",
|
|
103
109
|
"@sinonjs/fake-timers": "^9.1.2",
|
|
104
110
|
"@types/diff": "^5.0.2",
|
|
105
111
|
"@types/jsdom": "^20.0.0",
|
|
@@ -107,34 +113,35 @@
|
|
|
107
113
|
"@types/natural-compare": "^1.4.1",
|
|
108
114
|
"@types/prompts": "^2.4.0",
|
|
109
115
|
"@types/sinonjs__fake-timers": "^8.1.2",
|
|
110
|
-
"@vitest/ui": "0.
|
|
116
|
+
"@vitest/ui": "0.23.0",
|
|
111
117
|
"birpc": "^0.2.3",
|
|
112
|
-
"cac": "^6.7.
|
|
118
|
+
"cac": "^6.7.14",
|
|
113
119
|
"chai-subset": "^1.6.0",
|
|
114
120
|
"cli-truncate": "^3.1.0",
|
|
115
121
|
"diff": "^5.1.0",
|
|
122
|
+
"event-target-polyfill": "^0.0.3",
|
|
116
123
|
"execa": "^6.1.0",
|
|
117
124
|
"fast-glob": "^3.2.11",
|
|
118
125
|
"find-up": "^6.3.0",
|
|
119
|
-
"flatted": "^3.2.
|
|
126
|
+
"flatted": "^3.2.7",
|
|
120
127
|
"happy-dom": "^6.0.4",
|
|
121
128
|
"jsdom": "^20.0.0",
|
|
122
129
|
"log-update": "^5.0.1",
|
|
123
130
|
"magic-string": "^0.26.2",
|
|
124
131
|
"micromatch": "^4.0.5",
|
|
125
|
-
"mlly": "^0.5.
|
|
132
|
+
"mlly": "^0.5.14",
|
|
126
133
|
"natural-compare": "^1.4.0",
|
|
127
134
|
"p-limit": "^4.0.0",
|
|
128
135
|
"pathe": "^0.2.0",
|
|
129
136
|
"picocolors": "^1.0.0",
|
|
130
|
-
"pkg-types": "^0.3.
|
|
137
|
+
"pkg-types": "^0.3.4",
|
|
131
138
|
"pretty-format": "^27.5.1",
|
|
132
139
|
"prompts": "^2.4.2",
|
|
133
|
-
"rollup": "^2.78.
|
|
140
|
+
"rollup": "^2.78.1",
|
|
134
141
|
"source-map-js": "^1.0.2",
|
|
135
142
|
"strip-ansi": "^7.0.1",
|
|
136
|
-
"typescript": "^4.
|
|
137
|
-
"vite-node": "0.
|
|
143
|
+
"typescript": "^4.8.2",
|
|
144
|
+
"vite-node": "0.23.0",
|
|
138
145
|
"ws": "^8.8.1"
|
|
139
146
|
},
|
|
140
147
|
"scripts": {
|