vitest 0.25.8 → 0.26.1
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 +0 -142
- package/browser.d.ts +1 -0
- package/dist/browser.d.ts +8 -5
- package/dist/browser.js +17 -16
- package/dist/{chunk-api-setup.dc71e384.js → chunk-api-setup.adeab271.js} +45 -46
- package/dist/{chunk-env-node.67948209.js → chunk-env-node.b3664da2.js} +1 -1
- package/dist/{chunk-install-pkg.579a5a27.js → chunk-install-pkg.6dd2bae6.js} +19 -19
- package/dist/chunk-integrations-globals.96914902.js +27 -0
- package/dist/{chunk-node-git.5a1b1656.js → chunk-node-git.a90c0582.js} +10 -6
- package/dist/{chunk-runtime-chain.f86e5250.js → chunk-runtime-chain.4cd984be.js} +8 -8
- package/dist/{chunk-runtime-error.616e92ca.js → chunk-runtime-error.f5c8aaf2.js} +10 -8
- package/dist/{chunk-runtime-mocker.99b910d0.js → chunk-runtime-mocker.3fa602ba.js} +73 -65
- package/dist/{chunk-runtime-rpc.42aebbb9.js → chunk-runtime-rpc.54d72169.js} +2 -2
- package/dist/{chunk-runtime-setup.5398e2c4.js → chunk-runtime-setup.9cdedce6.js} +21 -34
- package/dist/{chunk-vite-node-externalize.b9495318.js → chunk-snapshot-manager.e54d78b8.js} +82 -358
- package/dist/{chunk-typecheck-constants.ed987901.js → chunk-typecheck-constants.06e1fe5b.js} +8 -7
- package/dist/{chunk-utils-env.03f840f2.js → chunk-utils-env.3fdc1793.js} +8 -8
- package/dist/{chunk-runtime-test-state.3f86f48f.js → chunk-utils-import.afe2ffde.js} +50 -19
- package/dist/{chunk-utils-source-map.29ff1088.js → chunk-utils-source-map.59ba6b0a.js} +6 -4
- package/dist/{chunk-utils-timers.793fd179.js → chunk-utils-timers.715da787.js} +31 -15
- package/dist/cli-wrapper.js +10 -5
- package/dist/cli.js +30 -25
- package/dist/config.d.ts +6 -3
- package/dist/entry.js +18 -16
- package/dist/environments.d.ts +6 -3
- package/dist/environments.js +2 -2
- package/dist/{index-5aad25c1.d.ts → index-1e9f7f83.d.ts} +1 -1
- package/dist/index.d.ts +30 -12
- package/dist/index.js +12 -10
- package/dist/loader.js +12 -7
- package/dist/node.d.ts +21 -20
- package/dist/node.js +33 -25
- package/dist/suite.js +10 -8
- package/dist/{types-71ccd11d.d.ts → types-c41bae41.d.ts} +39 -279
- package/dist/vendor-index.2e96c50b.js +215 -0
- package/dist/vendor-index.783e7f3e.js +71 -0
- package/dist/{vendor-index.e1d4cf84.js → vendor-index.7a2cebfe.js} +16 -16
- package/dist/{vendor-index.737c3cff.js → vendor-index.b2fdde54.js} +9 -8
- package/dist/worker.js +21 -18
- package/environments.d.ts +1 -0
- package/package.json +4 -4
- package/dist/chunk-integrations-globals.4d261bb8.js +0 -25
- package/dist/chunk-vite-node-source-map.b4ea5792.js +0 -446
- package/dist/chunk-vite-node-utils.0e4a6a88.js +0 -1385
- package/dist/vendor-source-map-support.1ce17397.js +0 -707
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import 'acorn';
|
|
2
|
+
import { builtinModules } from 'node:module';
|
|
3
|
+
import 'node:fs';
|
|
4
|
+
import { pathToFileURL } from 'node:url';
|
|
5
|
+
import 'url';
|
|
6
|
+
import 'fs';
|
|
7
|
+
import 'path';
|
|
8
|
+
import 'module';
|
|
9
|
+
import assert from 'assert';
|
|
10
|
+
import { format, inspect } from 'util';
|
|
11
|
+
import 'node:path';
|
|
12
|
+
|
|
13
|
+
const BUILTIN_MODULES = new Set(builtinModules);
|
|
14
|
+
|
|
15
|
+
const isWindows = process.platform === "win32";
|
|
16
|
+
const own$1 = {}.hasOwnProperty;
|
|
17
|
+
const messages = /* @__PURE__ */ new Map();
|
|
18
|
+
const nodeInternalPrefix = "__node_internal_";
|
|
19
|
+
let userStackTraceLimit;
|
|
20
|
+
createError(
|
|
21
|
+
"ERR_INVALID_MODULE_SPECIFIER",
|
|
22
|
+
(request, reason, base = void 0) => {
|
|
23
|
+
return `Invalid module "${request}" ${reason}${base ? ` imported from ${base}` : ""}`;
|
|
24
|
+
},
|
|
25
|
+
TypeError
|
|
26
|
+
);
|
|
27
|
+
createError(
|
|
28
|
+
"ERR_INVALID_PACKAGE_CONFIG",
|
|
29
|
+
(path, base, message) => {
|
|
30
|
+
return `Invalid package config ${path}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
|
|
31
|
+
},
|
|
32
|
+
Error
|
|
33
|
+
);
|
|
34
|
+
createError(
|
|
35
|
+
"ERR_INVALID_PACKAGE_TARGET",
|
|
36
|
+
(pkgPath, key, target, isImport = false, base = void 0) => {
|
|
37
|
+
const relError = typeof target === "string" && !isImport && target.length > 0 && !target.startsWith("./");
|
|
38
|
+
if (key === ".") {
|
|
39
|
+
assert(isImport === false);
|
|
40
|
+
return `Invalid "exports" main target ${JSON.stringify(target)} defined in the package config ${pkgPath}package.json${base ? ` imported from ${base}` : ""}${relError ? '; targets must start with "./"' : ""}`;
|
|
41
|
+
}
|
|
42
|
+
return `Invalid "${isImport ? "imports" : "exports"}" target ${JSON.stringify(
|
|
43
|
+
target
|
|
44
|
+
)} defined for '${key}' in the package config ${pkgPath}package.json${base ? ` imported from ${base}` : ""}${relError ? '; targets must start with "./"' : ""}`;
|
|
45
|
+
},
|
|
46
|
+
Error
|
|
47
|
+
);
|
|
48
|
+
createError(
|
|
49
|
+
"ERR_MODULE_NOT_FOUND",
|
|
50
|
+
(path, base, type = "package") => {
|
|
51
|
+
return `Cannot find ${type} '${path}' imported from ${base}`;
|
|
52
|
+
},
|
|
53
|
+
Error
|
|
54
|
+
);
|
|
55
|
+
createError(
|
|
56
|
+
"ERR_PACKAGE_IMPORT_NOT_DEFINED",
|
|
57
|
+
(specifier, packagePath, base) => {
|
|
58
|
+
return `Package import specifier "${specifier}" is not defined${packagePath ? ` in package ${packagePath}package.json` : ""} imported from ${base}`;
|
|
59
|
+
},
|
|
60
|
+
TypeError
|
|
61
|
+
);
|
|
62
|
+
createError(
|
|
63
|
+
"ERR_PACKAGE_PATH_NOT_EXPORTED",
|
|
64
|
+
(pkgPath, subpath, base = void 0) => {
|
|
65
|
+
if (subpath === ".") {
|
|
66
|
+
return `No "exports" main defined in ${pkgPath}package.json${base ? ` imported from ${base}` : ""}`;
|
|
67
|
+
}
|
|
68
|
+
return `Package subpath '${subpath}' is not defined by "exports" in ${pkgPath}package.json${base ? ` imported from ${base}` : ""}`;
|
|
69
|
+
},
|
|
70
|
+
Error
|
|
71
|
+
);
|
|
72
|
+
createError(
|
|
73
|
+
"ERR_UNSUPPORTED_DIR_IMPORT",
|
|
74
|
+
"Directory import '%s' is not supported resolving ES modules imported from %s",
|
|
75
|
+
Error
|
|
76
|
+
);
|
|
77
|
+
createError(
|
|
78
|
+
"ERR_UNKNOWN_FILE_EXTENSION",
|
|
79
|
+
'Unknown file extension "%s" for %s',
|
|
80
|
+
TypeError
|
|
81
|
+
);
|
|
82
|
+
createError(
|
|
83
|
+
"ERR_INVALID_ARG_VALUE",
|
|
84
|
+
(name, value, reason = "is invalid") => {
|
|
85
|
+
let inspected = inspect(value);
|
|
86
|
+
if (inspected.length > 128) {
|
|
87
|
+
inspected = `${inspected.slice(0, 128)}...`;
|
|
88
|
+
}
|
|
89
|
+
const type = name.includes(".") ? "property" : "argument";
|
|
90
|
+
return `The ${type} '${name}' ${reason}. Received ${inspected}`;
|
|
91
|
+
},
|
|
92
|
+
TypeError
|
|
93
|
+
);
|
|
94
|
+
createError(
|
|
95
|
+
"ERR_UNSUPPORTED_ESM_URL_SCHEME",
|
|
96
|
+
(url) => {
|
|
97
|
+
let message = "Only file and data URLs are supported by the default ESM loader";
|
|
98
|
+
if (isWindows && url.protocol.length === 2) {
|
|
99
|
+
message += ". On Windows, absolute paths must be valid file:// URLs";
|
|
100
|
+
}
|
|
101
|
+
message += `. Received protocol '${url.protocol}'`;
|
|
102
|
+
return message;
|
|
103
|
+
},
|
|
104
|
+
Error
|
|
105
|
+
);
|
|
106
|
+
function createError(sym, value, def) {
|
|
107
|
+
messages.set(sym, value);
|
|
108
|
+
return makeNodeErrorWithCode(def, sym);
|
|
109
|
+
}
|
|
110
|
+
function makeNodeErrorWithCode(Base, key) {
|
|
111
|
+
return NodeError;
|
|
112
|
+
function NodeError(...args) {
|
|
113
|
+
const limit = Error.stackTraceLimit;
|
|
114
|
+
if (isErrorStackTraceLimitWritable()) {
|
|
115
|
+
Error.stackTraceLimit = 0;
|
|
116
|
+
}
|
|
117
|
+
const error = new Base();
|
|
118
|
+
if (isErrorStackTraceLimitWritable()) {
|
|
119
|
+
Error.stackTraceLimit = limit;
|
|
120
|
+
}
|
|
121
|
+
const message = getMessage(key, args, error);
|
|
122
|
+
Object.defineProperty(error, "message", {
|
|
123
|
+
value: message,
|
|
124
|
+
enumerable: false,
|
|
125
|
+
writable: true,
|
|
126
|
+
configurable: true
|
|
127
|
+
});
|
|
128
|
+
Object.defineProperty(error, "toString", {
|
|
129
|
+
value() {
|
|
130
|
+
return `${this.name} [${key}]: ${this.message}`;
|
|
131
|
+
},
|
|
132
|
+
enumerable: false,
|
|
133
|
+
writable: true,
|
|
134
|
+
configurable: true
|
|
135
|
+
});
|
|
136
|
+
addCodeToName(error, Base.name, key);
|
|
137
|
+
error.code = key;
|
|
138
|
+
return error;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
const addCodeToName = hideStackFrames(
|
|
142
|
+
function(error, name, code) {
|
|
143
|
+
error = captureLargerStackTrace(error);
|
|
144
|
+
error.name = `${name} [${code}]`;
|
|
145
|
+
error.stack;
|
|
146
|
+
if (name === "SystemError") {
|
|
147
|
+
Object.defineProperty(error, "name", {
|
|
148
|
+
value: name,
|
|
149
|
+
enumerable: false,
|
|
150
|
+
writable: true,
|
|
151
|
+
configurable: true
|
|
152
|
+
});
|
|
153
|
+
} else {
|
|
154
|
+
delete error.name;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
);
|
|
158
|
+
function isErrorStackTraceLimitWritable() {
|
|
159
|
+
const desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
|
|
160
|
+
if (desc === void 0) {
|
|
161
|
+
return Object.isExtensible(Error);
|
|
162
|
+
}
|
|
163
|
+
return own$1.call(desc, "writable") ? desc.writable : desc.set !== void 0;
|
|
164
|
+
}
|
|
165
|
+
function hideStackFrames(fn) {
|
|
166
|
+
const hidden = nodeInternalPrefix + fn.name;
|
|
167
|
+
Object.defineProperty(fn, "name", { value: hidden });
|
|
168
|
+
return fn;
|
|
169
|
+
}
|
|
170
|
+
const captureLargerStackTrace = hideStackFrames(
|
|
171
|
+
function(error) {
|
|
172
|
+
const stackTraceLimitIsWritable = isErrorStackTraceLimitWritable();
|
|
173
|
+
if (stackTraceLimitIsWritable) {
|
|
174
|
+
userStackTraceLimit = Error.stackTraceLimit;
|
|
175
|
+
Error.stackTraceLimit = Number.POSITIVE_INFINITY;
|
|
176
|
+
}
|
|
177
|
+
Error.captureStackTrace(error);
|
|
178
|
+
if (stackTraceLimitIsWritable) {
|
|
179
|
+
Error.stackTraceLimit = userStackTraceLimit;
|
|
180
|
+
}
|
|
181
|
+
return error;
|
|
182
|
+
}
|
|
183
|
+
);
|
|
184
|
+
function getMessage(key, args, self) {
|
|
185
|
+
const message = messages.get(key);
|
|
186
|
+
if (typeof message === "function") {
|
|
187
|
+
assert(
|
|
188
|
+
message.length <= args.length,
|
|
189
|
+
`Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${message.length}).`
|
|
190
|
+
);
|
|
191
|
+
return Reflect.apply(message, self, args);
|
|
192
|
+
}
|
|
193
|
+
const expectedLength = (message.match(/%[dfijoOs]/g) || []).length;
|
|
194
|
+
assert(
|
|
195
|
+
expectedLength === args.length,
|
|
196
|
+
`Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${expectedLength}).`
|
|
197
|
+
);
|
|
198
|
+
if (args.length === 0) {
|
|
199
|
+
return message;
|
|
200
|
+
}
|
|
201
|
+
args.unshift(message);
|
|
202
|
+
return Reflect.apply(format, null, args);
|
|
203
|
+
}
|
|
204
|
+
Object.freeze(["node", "import"]);
|
|
205
|
+
function isNodeBuiltin(id = "") {
|
|
206
|
+
id = id.replace(/^node:/, "").split("/")[0];
|
|
207
|
+
return BUILTIN_MODULES.has(id);
|
|
208
|
+
}
|
|
209
|
+
pathToFileURL(process.cwd());
|
|
210
|
+
const CJS_RE = /([\s;]|^)(module.exports\b|exports\.\w|require\s*\(|global\.\w)/m;
|
|
211
|
+
function hasCJSSyntax(code) {
|
|
212
|
+
return CJS_RE.test(code);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export { hasCJSSyntax as h, isNodeBuiltin as i };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
const DEFAULT_TIMEOUT = 6e4;
|
|
2
|
+
function createBirpc(functions, options) {
|
|
3
|
+
const {
|
|
4
|
+
post,
|
|
5
|
+
on,
|
|
6
|
+
eventNames = [],
|
|
7
|
+
serialize = (i) => i,
|
|
8
|
+
deserialize = (i) => i,
|
|
9
|
+
timeout = DEFAULT_TIMEOUT
|
|
10
|
+
} = options;
|
|
11
|
+
const rpcPromiseMap = /* @__PURE__ */ new Map();
|
|
12
|
+
const rpc = new Proxy({}, {
|
|
13
|
+
get(_, method) {
|
|
14
|
+
const sendEvent = (...args) => {
|
|
15
|
+
post(serialize({ m: method, a: args, t: "q" }));
|
|
16
|
+
};
|
|
17
|
+
if (eventNames.includes(method)) {
|
|
18
|
+
sendEvent.asEvent = sendEvent;
|
|
19
|
+
return sendEvent;
|
|
20
|
+
}
|
|
21
|
+
const sendCall = (...args) => {
|
|
22
|
+
return new Promise((resolve, reject) => {
|
|
23
|
+
const id = nanoid();
|
|
24
|
+
rpcPromiseMap.set(id, { resolve, reject });
|
|
25
|
+
post(serialize({ m: method, a: args, i: id, t: "q" }));
|
|
26
|
+
if (timeout >= 0) {
|
|
27
|
+
setTimeout(() => {
|
|
28
|
+
reject(new Error(`[birpc] timeout on calling "${method}"`));
|
|
29
|
+
rpcPromiseMap.delete(id);
|
|
30
|
+
}, timeout);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
sendCall.asEvent = sendEvent;
|
|
35
|
+
return sendCall;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
on(async (data, ...extra) => {
|
|
39
|
+
const msg = deserialize(data);
|
|
40
|
+
if (msg.t === "q") {
|
|
41
|
+
const { m: method, a: args } = msg;
|
|
42
|
+
let result, error;
|
|
43
|
+
try {
|
|
44
|
+
result = await functions[method].apply(rpc, args);
|
|
45
|
+
} catch (e) {
|
|
46
|
+
error = e;
|
|
47
|
+
}
|
|
48
|
+
if (msg.i)
|
|
49
|
+
post(serialize({ t: "s", i: msg.i, r: result, e: error }), ...extra);
|
|
50
|
+
} else {
|
|
51
|
+
const { i: ack, r: result, e: error } = msg;
|
|
52
|
+
const promise = rpcPromiseMap.get(ack);
|
|
53
|
+
if (error)
|
|
54
|
+
promise?.reject(error);
|
|
55
|
+
else
|
|
56
|
+
promise?.resolve(result);
|
|
57
|
+
rpcPromiseMap.delete(ack);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
return rpc;
|
|
61
|
+
}
|
|
62
|
+
const urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
63
|
+
function nanoid(size = 21) {
|
|
64
|
+
let id = "";
|
|
65
|
+
let i = size;
|
|
66
|
+
while (i--)
|
|
67
|
+
id += urlAlphabet[Math.random() * 64 | 0];
|
|
68
|
+
return id;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export { createBirpc as c };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import require$$0$1 from 'child_process';
|
|
2
|
+
import g from 'path';
|
|
3
3
|
import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js';
|
|
4
|
-
import
|
|
4
|
+
import require$$0 from 'fs';
|
|
5
5
|
import assert$1 from 'assert';
|
|
6
6
|
import require$$2 from 'events';
|
|
7
|
-
import require$$0$
|
|
8
|
-
import require$$0 from 'stream';
|
|
7
|
+
import require$$0$3 from 'buffer';
|
|
8
|
+
import require$$0$2 from 'stream';
|
|
9
9
|
import util from 'util';
|
|
10
10
|
|
|
11
11
|
var crossSpawn = {exports: {}};
|
|
@@ -19,7 +19,7 @@ function requireWindows () {
|
|
|
19
19
|
windows = isexe;
|
|
20
20
|
isexe.sync = sync;
|
|
21
21
|
|
|
22
|
-
var fs =
|
|
22
|
+
var fs = require$$0;
|
|
23
23
|
|
|
24
24
|
function checkPathExt (path, options) {
|
|
25
25
|
var pathext = options.pathExt !== undefined ?
|
|
@@ -70,7 +70,7 @@ function requireMode () {
|
|
|
70
70
|
mode = isexe;
|
|
71
71
|
isexe.sync = sync;
|
|
72
72
|
|
|
73
|
-
var fs =
|
|
73
|
+
var fs = require$$0;
|
|
74
74
|
|
|
75
75
|
function isexe (path, options, cb) {
|
|
76
76
|
fs.stat(path, function (er, stat) {
|
|
@@ -172,7 +172,7 @@ const isWindows = process.platform === 'win32' ||
|
|
|
172
172
|
process.env.OSTYPE === 'cygwin' ||
|
|
173
173
|
process.env.OSTYPE === 'msys';
|
|
174
174
|
|
|
175
|
-
const path$2 =
|
|
175
|
+
const path$2 = g;
|
|
176
176
|
const COLON = isWindows ? ';' : ':';
|
|
177
177
|
const isexe = isexe_1;
|
|
178
178
|
|
|
@@ -311,7 +311,7 @@ pathKey$1.exports = pathKey;
|
|
|
311
311
|
// TODO: Remove this for the next major release
|
|
312
312
|
pathKey$1.exports.default = pathKey;
|
|
313
313
|
|
|
314
|
-
const path$1 =
|
|
314
|
+
const path$1 = g;
|
|
315
315
|
const which = which_1;
|
|
316
316
|
const getPathKey = pathKey$1.exports;
|
|
317
317
|
|
|
@@ -429,7 +429,7 @@ var shebangCommand$1 = (string = '') => {
|
|
|
429
429
|
return argument ? `${binary} ${argument}` : binary;
|
|
430
430
|
};
|
|
431
431
|
|
|
432
|
-
const fs =
|
|
432
|
+
const fs = require$$0;
|
|
433
433
|
const shebangCommand = shebangCommand$1;
|
|
434
434
|
|
|
435
435
|
function readShebang$1(command) {
|
|
@@ -451,7 +451,7 @@ function readShebang$1(command) {
|
|
|
451
451
|
|
|
452
452
|
var readShebang_1 = readShebang$1;
|
|
453
453
|
|
|
454
|
-
const path =
|
|
454
|
+
const path = g;
|
|
455
455
|
const resolveCommand = resolveCommand_1;
|
|
456
456
|
const escape = _escape;
|
|
457
457
|
const readShebang = readShebang_1;
|
|
@@ -599,7 +599,7 @@ var enoent$1 = {
|
|
|
599
599
|
notFoundError,
|
|
600
600
|
};
|
|
601
601
|
|
|
602
|
-
const cp =
|
|
602
|
+
const cp = require$$0$1;
|
|
603
603
|
const parse = parse_1;
|
|
604
604
|
const enoent = enoent$1;
|
|
605
605
|
|
|
@@ -909,7 +909,7 @@ if (!processOk(process$1)) {
|
|
|
909
909
|
|
|
910
910
|
var getStream$1 = {exports: {}};
|
|
911
911
|
|
|
912
|
-
const {PassThrough: PassThroughStream} = require$$0;
|
|
912
|
+
const {PassThrough: PassThroughStream} = require$$0$2;
|
|
913
913
|
|
|
914
914
|
var bufferStream$1 = options => {
|
|
915
915
|
options = {...options};
|
|
@@ -961,8 +961,8 @@ var bufferStream$1 = options => {
|
|
|
961
961
|
return stream;
|
|
962
962
|
};
|
|
963
963
|
|
|
964
|
-
const {constants: BufferConstants} = require$$0$
|
|
965
|
-
const stream = require$$0;
|
|
964
|
+
const {constants: BufferConstants} = require$$0$3;
|
|
965
|
+
const stream = require$$0$2;
|
|
966
966
|
const {promisify} = util;
|
|
967
967
|
const bufferStream = bufferStream$1;
|
|
968
968
|
|
|
@@ -1022,7 +1022,7 @@ getStream$1.exports.buffer = (stream, options) => getStream(stream, {...options,
|
|
|
1022
1022
|
getStream$1.exports.array = (stream, options) => getStream(stream, {...options, array: true});
|
|
1023
1023
|
getStream$1.exports.MaxBufferError = MaxBufferError;
|
|
1024
1024
|
|
|
1025
|
-
const { PassThrough } = require$$0;
|
|
1025
|
+
const { PassThrough } = require$$0$2;
|
|
1026
1026
|
|
|
1027
1027
|
var mergeStream = function (/*streams...*/) {
|
|
1028
1028
|
var sources = [];
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { Buffer } from 'buffer';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import childProcess from 'child_process';
|
|
4
|
-
import process$1 from 'process';
|
|
5
|
-
import { s as signalExit, m as mergeStream, g as getStream, c as crossSpawn } from './vendor-index.
|
|
6
|
-
import url from 'url';
|
|
7
|
-
import
|
|
1
|
+
import { Buffer } from 'node:buffer';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import childProcess from 'node:child_process';
|
|
4
|
+
import process$1 from 'node:process';
|
|
5
|
+
import { s as signalExit, m as mergeStream, g as getStream, c as crossSpawn } from './vendor-index.7a2cebfe.js';
|
|
6
|
+
import url from 'node:url';
|
|
7
|
+
import { constants } from 'os';
|
|
8
|
+
import os from 'node:os';
|
|
8
9
|
|
|
9
10
|
function stripFinalNewline(input) {
|
|
10
11
|
const LF = typeof input === 'string' ? '\n' : '\n'.charCodeAt();
|
|
@@ -704,7 +705,7 @@ const setKillTimeout = (kill, signal, options, killResult) => {
|
|
|
704
705
|
|
|
705
706
|
const shouldForceKill = (signal, {forceKillAfterTimeout}, killResult) => isSigterm(signal) && forceKillAfterTimeout !== false && killResult;
|
|
706
707
|
|
|
707
|
-
const isSigterm = signal => signal ===
|
|
708
|
+
const isSigterm = signal => signal === os.constants.signals.SIGTERM
|
|
708
709
|
|| (typeof signal === 'string' && signal.toUpperCase() === 'SIGTERM');
|
|
709
710
|
|
|
710
711
|
const getForceKillAfterTimeout = ({forceKillAfterTimeout = true}) => {
|
package/dist/worker.js
CHANGED
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
import { b as resolve, e as distDir } from './chunk-utils-env.
|
|
2
|
-
import { c as createBirpc
|
|
1
|
+
import { b as resolve, e as distDir } from './chunk-utils-env.3fdc1793.js';
|
|
2
|
+
import { c as createBirpc } from './vendor-index.783e7f3e.js';
|
|
3
3
|
import { workerId } from 'tinypool';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { ModuleCacheMap } from 'vite-node/client';
|
|
5
|
+
import { g as getWorkerState } from './chunk-typecheck-constants.06e1fe5b.js';
|
|
6
|
+
import { e as executeInViteNode } from './chunk-runtime-mocker.3fa602ba.js';
|
|
7
|
+
import { r as rpc } from './chunk-runtime-rpc.54d72169.js';
|
|
8
|
+
import { p as processError } from './chunk-runtime-error.f5c8aaf2.js';
|
|
8
9
|
import 'tty';
|
|
9
|
-
import 'url';
|
|
10
|
+
import 'node:url';
|
|
10
11
|
import 'path';
|
|
11
|
-
import '
|
|
12
|
-
import '
|
|
13
|
-
import '
|
|
14
|
-
import '
|
|
12
|
+
import 'node:path';
|
|
13
|
+
import 'local-pkg';
|
|
14
|
+
import 'vite-node/utils';
|
|
15
|
+
import 'vite';
|
|
16
|
+
import './vendor-index.2e96c50b.js';
|
|
15
17
|
import 'acorn';
|
|
18
|
+
import 'node:module';
|
|
19
|
+
import 'node:fs';
|
|
20
|
+
import 'url';
|
|
21
|
+
import 'fs';
|
|
22
|
+
import 'module';
|
|
16
23
|
import 'assert';
|
|
17
24
|
import 'util';
|
|
18
|
-
import '
|
|
19
|
-
import './vendor-source-map-support.1ce17397.js';
|
|
20
|
-
import 'source-map';
|
|
21
|
-
import 'local-pkg';
|
|
22
|
-
import 'vite';
|
|
23
|
-
import './chunk-utils-timers.793fd179.js';
|
|
25
|
+
import './chunk-utils-timers.715da787.js';
|
|
24
26
|
import 'chai';
|
|
25
27
|
|
|
26
28
|
let _viteNode;
|
|
@@ -53,7 +55,7 @@ async function startViteNode(ctx) {
|
|
|
53
55
|
},
|
|
54
56
|
moduleCache,
|
|
55
57
|
mockMap,
|
|
56
|
-
interopDefault: config.deps.interopDefault
|
|
58
|
+
interopDefault: config.deps.interopDefault,
|
|
57
59
|
root: config.root,
|
|
58
60
|
base: config.base
|
|
59
61
|
}))[0];
|
|
@@ -66,6 +68,7 @@ function init(ctx) {
|
|
|
66
68
|
const { config, port, workerId: workerId$1 } = ctx;
|
|
67
69
|
process.env.VITEST_WORKER_ID = String(workerId$1);
|
|
68
70
|
process.env.VITEST_POOL_ID = String(workerId);
|
|
71
|
+
globalThis.__vitest_environment__ = config.environment;
|
|
69
72
|
globalThis.__vitest_worker__ = {
|
|
70
73
|
ctx,
|
|
71
74
|
moduleCache,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist/environments'
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.26.1",
|
|
5
5
|
"description": "A blazing fast unit test framework powered by Vite",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -113,7 +113,8 @@
|
|
|
113
113
|
"tinybench": "^2.3.1",
|
|
114
114
|
"tinypool": "^0.3.0",
|
|
115
115
|
"tinyspy": "^1.0.2",
|
|
116
|
-
"vite": "^3.0.0 || ^4.0.0"
|
|
116
|
+
"vite": "^3.0.0 || ^4.0.0",
|
|
117
|
+
"vite-node": "0.26.1"
|
|
117
118
|
},
|
|
118
119
|
"devDependencies": {
|
|
119
120
|
"@antfu/install-pkg": "^0.1.1",
|
|
@@ -154,8 +155,7 @@
|
|
|
154
155
|
"strip-ansi": "^7.0.1",
|
|
155
156
|
"typescript": "^4.9.4",
|
|
156
157
|
"ws": "^8.11.0",
|
|
157
|
-
"@vitest/ui": "0.
|
|
158
|
-
"vite-node": "0.25.8"
|
|
158
|
+
"@vitest/ui": "0.26.1"
|
|
159
159
|
},
|
|
160
160
|
"scripts": {
|
|
161
161
|
"build": "rimraf dist && rollup -c",
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { m as globalApis } from './chunk-utils-env.03f840f2.js';
|
|
2
|
-
import { i as index } from './chunk-runtime-test-state.3f86f48f.js';
|
|
3
|
-
import 'tty';
|
|
4
|
-
import 'url';
|
|
5
|
-
import 'path';
|
|
6
|
-
import './chunk-runtime-chain.f86e5250.js';
|
|
7
|
-
import 'util';
|
|
8
|
-
import 'chai';
|
|
9
|
-
import './chunk-typecheck-constants.ed987901.js';
|
|
10
|
-
import 'local-pkg';
|
|
11
|
-
import './vendor-_commonjsHelpers.addc3445.js';
|
|
12
|
-
import './chunk-runtime-rpc.42aebbb9.js';
|
|
13
|
-
import './chunk-utils-timers.793fd179.js';
|
|
14
|
-
import 'fs';
|
|
15
|
-
import './chunk-utils-source-map.29ff1088.js';
|
|
16
|
-
import './spy.js';
|
|
17
|
-
import 'tinyspy';
|
|
18
|
-
|
|
19
|
-
function registerApiGlobally() {
|
|
20
|
-
globalApis.forEach((api) => {
|
|
21
|
-
globalThis[api] = index[api];
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export { registerApiGlobally };
|