vitest 1.5.3 → 1.6.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/dist/browser.d.ts +1 -1
- package/dist/browser.js +1 -1
- package/dist/chunks/environments-node.vcoXCoKs.js +19 -0
- package/dist/chunks/{integrations-globals.Hr6znn-f.js → integrations-globals.kw4co3rx.js} +3 -3
- package/dist/chunks/{runtime-runBaseTests.l6qXp5eU.js → runtime-runBaseTests.oAvMKtQC.js} +8 -9
- package/dist/cli.js +2 -2
- package/dist/config.cjs +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.js +1 -1
- package/dist/coverage.d.ts +1 -1
- package/dist/environments.d.ts +1 -1
- package/dist/execute.d.ts +6 -4
- package/dist/execute.js +3 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +4 -4
- package/dist/node.d.ts +2 -2
- package/dist/node.js +7 -7
- package/dist/{reporters-BXNXFKfg.d.ts → reporters-w_64AS5f.d.ts} +103 -25
- package/dist/reporters.d.ts +1 -1
- package/dist/reporters.js +5 -5
- package/dist/runners.d.ts +1 -1
- package/dist/runners.js +2 -2
- package/dist/snapshot.d.ts +9 -0
- package/dist/snapshot.js +8 -0
- package/dist/{suite-KPWE530F.d.ts → suite-dWqIFb_-.d.ts} +1 -1
- package/dist/suite.d.ts +2 -2
- package/dist/vendor/{base.Xt0Omgh7.js → base.5NT-gWu5.js} +9 -1
- package/dist/vendor/{base.oIzAvGLe.js → base.Ybri3C14.js} +2 -2
- package/dist/vendor/{cac.RDd_SGOd.js → cac.cdAtVkJZ.js} +38 -15
- package/dist/vendor/{cli-api.AmIc1Dmz.js → cli-api.OdDWuB7Y.js} +159 -42
- package/dist/vendor/{execute.2_yoIC01.js → execute.fL3szUAI.js} +8 -3
- package/dist/vendor/{index.X7lgIMc_.js → index.-xs08BYx.js} +177 -122
- package/dist/vendor/{index.Fm6OikHU.js → index.DpVgvm2P.js} +17 -18
- package/dist/vendor/{index.QVcwRDVW.js → index.dI9lHwVn.js} +1 -1
- package/dist/vendor/{setup-common.5nUd4r76.js → setup-common.8nJLd4ay.js} +1 -1
- package/dist/vendor/{utils.VYmeMh-u.js → utils.dEtNIEgr.js} +1 -1
- package/dist/vendor/{vi.Y_w82WR8.js → vi.YFlodzP_.js} +1 -1
- package/dist/vendor/{vm.i4FO5N37.js → vm.QEE48c0T.js} +131 -41
- package/dist/worker.js +8 -2
- package/dist/workers/forks.js +4 -4
- package/dist/workers/runVmTests.js +10 -8
- package/dist/workers/threads.js +4 -4
- package/dist/workers/vmForks.js +4 -4
- package/dist/workers/vmThreads.js +4 -4
- package/dist/workers.d.ts +1 -1
- package/dist/workers.js +5 -5
- package/package.json +13 -9
- package/snapshot.d.ts +1 -0
|
@@ -2,7 +2,7 @@ import vm, { isContext } from 'node:vm';
|
|
|
2
2
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
3
3
|
import { dirname, basename, extname, normalize, join, resolve } from 'pathe';
|
|
4
4
|
import { createCustomConsole } from '../chunks/runtime-console.EO5ha7qv.js';
|
|
5
|
-
import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.
|
|
5
|
+
import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.fL3szUAI.js';
|
|
6
6
|
import { distDir } from '../path.js';
|
|
7
7
|
import { dirname as dirname$1 } from 'node:path';
|
|
8
8
|
import { statSync, existsSync, readFileSync } from 'node:fs';
|
|
@@ -244,15 +244,36 @@ function interopCommonJsModule(interopDefault, mod) {
|
|
|
244
244
|
const SyntheticModule$1 = vm.SyntheticModule;
|
|
245
245
|
const SourceTextModule = vm.SourceTextModule;
|
|
246
246
|
|
|
247
|
+
var __defProp$1 = Object.defineProperty;
|
|
248
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
249
|
+
var __publicField$1 = (obj, key, value) => {
|
|
250
|
+
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
251
|
+
return value;
|
|
252
|
+
};
|
|
253
|
+
var __accessCheck$1 = (obj, member, msg) => {
|
|
254
|
+
if (!member.has(obj))
|
|
255
|
+
throw TypeError("Cannot " + msg);
|
|
256
|
+
};
|
|
257
|
+
var __privateGet$1 = (obj, member, getter) => {
|
|
258
|
+
__accessCheck$1(obj, member, "read from private field");
|
|
259
|
+
return getter ? getter.call(obj) : member.get(obj);
|
|
260
|
+
};
|
|
261
|
+
var __privateAdd$1 = (obj, member, value) => {
|
|
262
|
+
if (member.has(obj))
|
|
263
|
+
throw TypeError("Cannot add the same private member more than once");
|
|
264
|
+
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
265
|
+
};
|
|
266
|
+
var _httpIp;
|
|
247
267
|
const dataURIRegex = /^data:(?<mime>text\/javascript|application\/json|application\/wasm)(?:;(?<encoding>charset=utf-8|base64))?,(?<code>.*)$/;
|
|
248
268
|
class EsmExecutor {
|
|
249
269
|
constructor(executor, options) {
|
|
250
270
|
this.executor = executor;
|
|
271
|
+
__publicField$1(this, "moduleCache", /* @__PURE__ */ new Map());
|
|
272
|
+
__publicField$1(this, "esmLinkMap", /* @__PURE__ */ new WeakMap());
|
|
273
|
+
__publicField$1(this, "context");
|
|
274
|
+
__privateAdd$1(this, _httpIp, IPnumber("127.0.0.0"));
|
|
251
275
|
this.context = options.context;
|
|
252
276
|
}
|
|
253
|
-
moduleCache = /* @__PURE__ */ new Map();
|
|
254
|
-
esmLinkMap = /* @__PURE__ */ new WeakMap();
|
|
255
|
-
context;
|
|
256
277
|
async evaluateModule(m) {
|
|
257
278
|
if (m.status === "unlinked") {
|
|
258
279
|
this.esmLinkMap.set(
|
|
@@ -265,10 +286,11 @@ class EsmExecutor {
|
|
|
265
286
|
await m.evaluate();
|
|
266
287
|
return m;
|
|
267
288
|
}
|
|
268
|
-
async createEsModule(fileUrl,
|
|
289
|
+
async createEsModule(fileUrl, getCode) {
|
|
269
290
|
const cached = this.moduleCache.get(fileUrl);
|
|
270
291
|
if (cached)
|
|
271
292
|
return cached;
|
|
293
|
+
const code = await getCode();
|
|
272
294
|
if (fileUrl.endsWith(".json")) {
|
|
273
295
|
const m2 = new SyntheticModule$1(
|
|
274
296
|
["default"],
|
|
@@ -302,14 +324,26 @@ class EsmExecutor {
|
|
|
302
324
|
this.moduleCache.set(fileUrl, m);
|
|
303
325
|
return m;
|
|
304
326
|
}
|
|
305
|
-
async createWebAssemblyModule(fileUrl,
|
|
327
|
+
async createWebAssemblyModule(fileUrl, getCode) {
|
|
306
328
|
const cached = this.moduleCache.get(fileUrl);
|
|
307
329
|
if (cached)
|
|
308
330
|
return cached;
|
|
309
|
-
const m = this.loadWebAssemblyModule(
|
|
331
|
+
const m = this.loadWebAssemblyModule(getCode(), fileUrl);
|
|
310
332
|
this.moduleCache.set(fileUrl, m);
|
|
311
333
|
return m;
|
|
312
334
|
}
|
|
335
|
+
async createNetworkModule(fileUrl) {
|
|
336
|
+
if (fileUrl.startsWith("http:")) {
|
|
337
|
+
const url = new URL(fileUrl);
|
|
338
|
+
if (url.hostname !== "localhost" && url.hostname !== "::1" && (IPnumber(url.hostname) & IPmask(8)) !== __privateGet$1(this, _httpIp)) {
|
|
339
|
+
throw new Error(
|
|
340
|
+
// we don't know the importer, so it's undefined (the same happens in --pool=threads)
|
|
341
|
+
`import of '${fileUrl}' by undefined is not supported: http can only be used to load local resources (use https instead).`
|
|
342
|
+
);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
return this.createEsModule(fileUrl, () => fetch(fileUrl).then((r) => r.text()));
|
|
346
|
+
}
|
|
313
347
|
async loadWebAssemblyModule(source, identifier) {
|
|
314
348
|
const cached = this.moduleCache.get(identifier);
|
|
315
349
|
if (cached)
|
|
@@ -393,9 +427,19 @@ class EsmExecutor {
|
|
|
393
427
|
this.moduleCache.set(identifier, module);
|
|
394
428
|
return module;
|
|
395
429
|
}
|
|
396
|
-
return this.createEsModule(identifier, code);
|
|
430
|
+
return this.createEsModule(identifier, () => code);
|
|
397
431
|
}
|
|
398
432
|
}
|
|
433
|
+
_httpIp = new WeakMap();
|
|
434
|
+
function IPnumber(address) {
|
|
435
|
+
const ip = address.match(/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/);
|
|
436
|
+
if (ip)
|
|
437
|
+
return (+ip[1] << 24) + (+ip[2] << 16) + (+ip[3] << 8) + +ip[4];
|
|
438
|
+
throw new Error(`Expected IP address, received ${address}`);
|
|
439
|
+
}
|
|
440
|
+
function IPmask(maskSize) {
|
|
441
|
+
return -1 << 32 - maskSize;
|
|
442
|
+
}
|
|
399
443
|
|
|
400
444
|
const CLIENT_ID = "/@vite/client";
|
|
401
445
|
const CLIENT_FILE = pathToFileURL(CLIENT_ID).href;
|
|
@@ -433,10 +477,12 @@ class ViteExecutor {
|
|
|
433
477
|
const cached = this.esm.resolveCachedModule(fileUrl);
|
|
434
478
|
if (cached)
|
|
435
479
|
return cached;
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
480
|
+
return this.esm.createEsModule(fileUrl, async () => {
|
|
481
|
+
const result = await this.options.transform(fileUrl, "web");
|
|
482
|
+
if (!result.code)
|
|
483
|
+
throw new Error(`[vitest] Failed to transform ${fileUrl}. Does the file exist?`);
|
|
484
|
+
return result.code;
|
|
485
|
+
});
|
|
440
486
|
}
|
|
441
487
|
createViteClientModule() {
|
|
442
488
|
const identifier = CLIENT_ID;
|
|
@@ -476,11 +522,54 @@ class ViteExecutor {
|
|
|
476
522
|
};
|
|
477
523
|
}
|
|
478
524
|
|
|
525
|
+
var __defProp = Object.defineProperty;
|
|
526
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
527
|
+
var __publicField = (obj, key, value) => {
|
|
528
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
529
|
+
return value;
|
|
530
|
+
};
|
|
531
|
+
var __accessCheck = (obj, member, msg) => {
|
|
532
|
+
if (!member.has(obj))
|
|
533
|
+
throw TypeError("Cannot " + msg);
|
|
534
|
+
};
|
|
535
|
+
var __privateGet = (obj, member, getter) => {
|
|
536
|
+
__accessCheck(obj, member, "read from private field");
|
|
537
|
+
return getter ? getter.call(obj) : member.get(obj);
|
|
538
|
+
};
|
|
539
|
+
var __privateAdd = (obj, member, value) => {
|
|
540
|
+
if (member.has(obj))
|
|
541
|
+
throw TypeError("Cannot add the same private member more than once");
|
|
542
|
+
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
543
|
+
};
|
|
544
|
+
var __privateSet = (obj, member, value, setter) => {
|
|
545
|
+
__accessCheck(obj, member, "write to private field");
|
|
546
|
+
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
547
|
+
return value;
|
|
548
|
+
};
|
|
549
|
+
var _networkSupported;
|
|
479
550
|
const SyntheticModule = vm.SyntheticModule;
|
|
480
551
|
const nativeResolve = import.meta.resolve;
|
|
481
552
|
class ExternalModulesExecutor {
|
|
482
553
|
constructor(options) {
|
|
483
554
|
this.options = options;
|
|
555
|
+
__publicField(this, "cjs");
|
|
556
|
+
__publicField(this, "esm");
|
|
557
|
+
__publicField(this, "vite");
|
|
558
|
+
__publicField(this, "context");
|
|
559
|
+
__publicField(this, "fs");
|
|
560
|
+
__publicField(this, "resolvers", []);
|
|
561
|
+
__privateAdd(this, _networkSupported, null);
|
|
562
|
+
// dynamic import can be used in both ESM and CJS, so we have it in the executor
|
|
563
|
+
__publicField(this, "importModuleDynamically", async (specifier, referencer) => {
|
|
564
|
+
const module = await this.resolveModule(specifier, referencer.identifier);
|
|
565
|
+
return this.esm.evaluateModule(module);
|
|
566
|
+
});
|
|
567
|
+
__publicField(this, "resolveModule", async (specifier, referencer) => {
|
|
568
|
+
let identifier = this.resolve(specifier, referencer);
|
|
569
|
+
if (identifier instanceof Promise)
|
|
570
|
+
identifier = await identifier;
|
|
571
|
+
return await this.createModule(identifier);
|
|
572
|
+
});
|
|
484
573
|
this.context = options.context;
|
|
485
574
|
this.fs = options.fileMap;
|
|
486
575
|
this.esm = new EsmExecutor(this, {
|
|
@@ -499,23 +588,17 @@ class ExternalModulesExecutor {
|
|
|
499
588
|
});
|
|
500
589
|
this.resolvers = [this.vite.resolve];
|
|
501
590
|
}
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
return this.
|
|
512
|
-
}
|
|
513
|
-
resolveModule = async (specifier, referencer) => {
|
|
514
|
-
let identifier = this.resolve(specifier, referencer);
|
|
515
|
-
if (identifier instanceof Promise)
|
|
516
|
-
identifier = await identifier;
|
|
517
|
-
return await this.createModule(identifier);
|
|
518
|
-
};
|
|
591
|
+
async import(identifier) {
|
|
592
|
+
const module = await this.createModule(identifier);
|
|
593
|
+
await this.esm.evaluateModule(module);
|
|
594
|
+
return module.namespace;
|
|
595
|
+
}
|
|
596
|
+
require(identifier) {
|
|
597
|
+
return this.cjs.require(identifier);
|
|
598
|
+
}
|
|
599
|
+
createRequire(identifier) {
|
|
600
|
+
return this.cjs.createRequire(identifier);
|
|
601
|
+
}
|
|
519
602
|
resolve(specifier, parent) {
|
|
520
603
|
for (const resolver of this.resolvers) {
|
|
521
604
|
const id = resolver(specifier, parent);
|
|
@@ -587,6 +670,8 @@ class ExternalModulesExecutor {
|
|
|
587
670
|
const extension = extname(identifier);
|
|
588
671
|
if (extension === ".node" || isNodeBuiltin(identifier))
|
|
589
672
|
return { type: "builtin", url: identifier, path: identifier };
|
|
673
|
+
if (this.isNetworkSupported && (identifier.startsWith("http:") || identifier.startsWith("https:")))
|
|
674
|
+
return { type: "network", url: identifier, path: identifier };
|
|
590
675
|
const isFileUrl = identifier.startsWith("file://");
|
|
591
676
|
const pathUrl = isFileUrl ? fileURLToPath(identifier.split("?")[0]) : identifier;
|
|
592
677
|
const fileUrl = isFileUrl ? identifier : pathToFileURL(pathUrl).toString();
|
|
@@ -622,31 +707,36 @@ class ExternalModulesExecutor {
|
|
|
622
707
|
case "vite":
|
|
623
708
|
return await this.vite.createViteModule(url);
|
|
624
709
|
case "wasm":
|
|
625
|
-
return await this.esm.createWebAssemblyModule(url, this.fs.readBuffer(path));
|
|
710
|
+
return await this.esm.createWebAssemblyModule(url, () => this.fs.readBuffer(path));
|
|
626
711
|
case "module":
|
|
627
|
-
return await this.esm.createEsModule(url, this.fs.readFile(path));
|
|
712
|
+
return await this.esm.createEsModule(url, () => this.fs.readFile(path));
|
|
628
713
|
case "commonjs": {
|
|
629
714
|
const exports = this.require(path);
|
|
630
715
|
return this.wrapCommonJsSynteticModule(identifier, exports);
|
|
631
716
|
}
|
|
717
|
+
case "network": {
|
|
718
|
+
return this.esm.createNetworkModule(url);
|
|
719
|
+
}
|
|
632
720
|
default: {
|
|
633
721
|
const _deadend = type;
|
|
634
722
|
return _deadend;
|
|
635
723
|
}
|
|
636
724
|
}
|
|
637
725
|
}
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
726
|
+
get isNetworkSupported() {
|
|
727
|
+
var _a;
|
|
728
|
+
if (__privateGet(this, _networkSupported) == null) {
|
|
729
|
+
if (process.execArgv.includes("--experimental-network-imports"))
|
|
730
|
+
__privateSet(this, _networkSupported, true);
|
|
731
|
+
else if ((_a = process.env.NODE_OPTIONS) == null ? void 0 : _a.includes("--experimental-network-imports"))
|
|
732
|
+
__privateSet(this, _networkSupported, true);
|
|
733
|
+
else
|
|
734
|
+
__privateSet(this, _networkSupported, false);
|
|
735
|
+
}
|
|
736
|
+
return __privateGet(this, _networkSupported);
|
|
648
737
|
}
|
|
649
738
|
}
|
|
739
|
+
_networkSupported = new WeakMap();
|
|
650
740
|
|
|
651
741
|
class FileMap {
|
|
652
742
|
fsCache = /* @__PURE__ */ new Map();
|
package/dist/worker.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { pathToFileURL } from 'node:url';
|
|
2
2
|
import { workerId } from 'tinypool';
|
|
3
3
|
import { ViteNodeRunner, ModuleCacheMap } from 'vite-node/client';
|
|
4
|
+
import { readFileSync } from 'node:fs';
|
|
4
5
|
import { resolve, normalize } from 'pathe';
|
|
5
6
|
import { e as environments } from './vendor/index.GVFv9dZ0.js';
|
|
6
|
-
import { i as isChildProcess, s as setProcessTitle } from './vendor/base.
|
|
7
|
+
import { i as isChildProcess, s as setProcessTitle } from './vendor/base.5NT-gWu5.js';
|
|
7
8
|
import { s as setupInspect } from './vendor/inspector.IgLX3ur5.js';
|
|
8
9
|
import { c as createRuntimeRpc, a as rpcDone } from './vendor/rpc.joBhAkyK.js';
|
|
9
10
|
import 'node:console';
|
|
@@ -31,7 +32,12 @@ async function loadEnvironment(ctx, rpc) {
|
|
|
31
32
|
return environments[name];
|
|
32
33
|
const loader = await createEnvironmentLoader({
|
|
33
34
|
root: ctx.config.root,
|
|
34
|
-
fetchModule: (id) =>
|
|
35
|
+
fetchModule: async (id) => {
|
|
36
|
+
const result = await rpc.fetch(id, "ssr");
|
|
37
|
+
if (result.id)
|
|
38
|
+
return { code: readFileSync(result.id, "utf-8") };
|
|
39
|
+
return result;
|
|
40
|
+
},
|
|
35
41
|
resolveId: (id, importer) => rpc.resolveId(id, importer, "ssr")
|
|
36
42
|
});
|
|
37
43
|
const root = loader.root;
|
package/dist/workers/forks.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import v8 from 'node:v8';
|
|
2
2
|
import { c as createForksRpcOptions, u as unwrapSerializableConfig } from '../vendor/utils.0uYuCbzo.js';
|
|
3
|
-
import { r as runBaseTests } from '../vendor/base.
|
|
3
|
+
import { r as runBaseTests } from '../vendor/base.Ybri3C14.js';
|
|
4
4
|
import '@vitest/utils';
|
|
5
5
|
import 'vite-node/client';
|
|
6
6
|
import '../vendor/global.CkGT_TMy.js';
|
|
7
|
-
import '../vendor/execute.
|
|
7
|
+
import '../vendor/execute.fL3szUAI.js';
|
|
8
8
|
import 'node:vm';
|
|
9
9
|
import 'node:url';
|
|
10
|
+
import 'node:fs';
|
|
10
11
|
import 'vite-node/utils';
|
|
11
12
|
import 'pathe';
|
|
12
13
|
import '@vitest/utils/error';
|
|
13
14
|
import '../path.js';
|
|
14
|
-
import '
|
|
15
|
-
import '../vendor/base.Xt0Omgh7.js';
|
|
15
|
+
import '../vendor/base.5NT-gWu5.js';
|
|
16
16
|
|
|
17
17
|
class ForksBaseWorker {
|
|
18
18
|
getRpcOptions() {
|
|
@@ -6,14 +6,13 @@ import { performance } from 'node:perf_hooks';
|
|
|
6
6
|
import { startTests } from '@vitest/runner';
|
|
7
7
|
import { setupColors, createColors } from '@vitest/utils';
|
|
8
8
|
import { installSourcemapsSupport } from 'vite-node/source-map';
|
|
9
|
-
import {
|
|
9
|
+
import { s as setupChaiConfig, r as resolveTestRunner, a as resolveSnapshotEnvironment } from '../vendor/index.DpVgvm2P.js';
|
|
10
10
|
import { a as startCoverageInsideWorker, s as stopCoverageInsideWorker } from '../vendor/coverage.E7sG1b3r.js';
|
|
11
11
|
import { g as getWorkerState } from '../vendor/global.CkGT_TMy.js';
|
|
12
|
-
import { V as VitestIndex } from '../vendor/index.
|
|
13
|
-
import { s as setupCommonEnv } from '../vendor/setup-common.
|
|
12
|
+
import { V as VitestIndex } from '../vendor/index.dI9lHwVn.js';
|
|
13
|
+
import { s as setupCommonEnv } from '../vendor/setup-common.8nJLd4ay.js';
|
|
14
14
|
import { c as closeInspector } from '../vendor/inspector.IgLX3ur5.js';
|
|
15
15
|
import 'chai';
|
|
16
|
-
import '@vitest/snapshot/environment';
|
|
17
16
|
import 'pathe';
|
|
18
17
|
import '../path.js';
|
|
19
18
|
import 'node:url';
|
|
@@ -25,14 +24,14 @@ import '../vendor/index.SMVOaj7F.js';
|
|
|
25
24
|
import '../vendor/env.AtSIuHFg.js';
|
|
26
25
|
import 'std-env';
|
|
27
26
|
import '../vendor/run-once.Olz_Zkd8.js';
|
|
28
|
-
import '../vendor/vi.
|
|
27
|
+
import '../vendor/vi.YFlodzP_.js';
|
|
29
28
|
import '../vendor/_commonjsHelpers.jjO7Zipk.js';
|
|
30
29
|
import '@vitest/expect';
|
|
31
30
|
import '@vitest/snapshot';
|
|
32
31
|
import '@vitest/utils/error';
|
|
33
32
|
import '../vendor/tasks.IknbGB2n.js';
|
|
34
33
|
import '@vitest/utils/source-map';
|
|
35
|
-
import '../vendor/base.
|
|
34
|
+
import '../vendor/base.5NT-gWu5.js';
|
|
36
35
|
import '../vendor/date.Ns1pGd_X.js';
|
|
37
36
|
import '@vitest/spy';
|
|
38
37
|
|
|
@@ -43,7 +42,6 @@ async function run(files, config, executor) {
|
|
|
43
42
|
value: VitestIndex,
|
|
44
43
|
enumerable: false
|
|
45
44
|
});
|
|
46
|
-
config.snapshotOptions.snapshotEnvironment = new VitestSnapshotEnvironment(workerState.rpc);
|
|
47
45
|
setupColors(createColors(isatty(1)));
|
|
48
46
|
if (workerState.environment.transformMode === "web") {
|
|
49
47
|
const _require = createRequire(import.meta.url);
|
|
@@ -62,7 +60,11 @@ async function run(files, config, executor) {
|
|
|
62
60
|
await startCoverageInsideWorker(config.coverage, executor);
|
|
63
61
|
if (config.chaiConfig)
|
|
64
62
|
setupChaiConfig(config.chaiConfig);
|
|
65
|
-
const runner = await
|
|
63
|
+
const [runner, snapshotEnvironment] = await Promise.all([
|
|
64
|
+
resolveTestRunner(config, executor),
|
|
65
|
+
resolveSnapshotEnvironment(config, executor)
|
|
66
|
+
]);
|
|
67
|
+
config.snapshotOptions.snapshotEnvironment = snapshotEnvironment;
|
|
66
68
|
workerState.onCancel.then((reason) => {
|
|
67
69
|
var _a;
|
|
68
70
|
closeInspector(config);
|
package/dist/workers/threads.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { r as runBaseTests } from '../vendor/base.
|
|
1
|
+
import { r as runBaseTests } from '../vendor/base.Ybri3C14.js';
|
|
2
2
|
import { a as createThreadsRpcOptions } from '../vendor/utils.0uYuCbzo.js';
|
|
3
3
|
import 'vite-node/client';
|
|
4
4
|
import '../vendor/global.CkGT_TMy.js';
|
|
5
|
-
import '../vendor/execute.
|
|
5
|
+
import '../vendor/execute.fL3szUAI.js';
|
|
6
6
|
import 'node:vm';
|
|
7
7
|
import 'node:url';
|
|
8
|
+
import 'node:fs';
|
|
8
9
|
import 'vite-node/utils';
|
|
9
10
|
import 'pathe';
|
|
10
11
|
import '@vitest/utils/error';
|
|
11
12
|
import '../path.js';
|
|
12
|
-
import 'node:fs';
|
|
13
13
|
import '@vitest/utils';
|
|
14
|
-
import '../vendor/base.
|
|
14
|
+
import '../vendor/base.5NT-gWu5.js';
|
|
15
15
|
|
|
16
16
|
class ThreadsBaseWorker {
|
|
17
17
|
getRpcOptions(ctx) {
|
package/dist/workers/vmForks.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import v8 from 'node:v8';
|
|
2
2
|
import { c as createForksRpcOptions, u as unwrapSerializableConfig } from '../vendor/utils.0uYuCbzo.js';
|
|
3
|
-
import { r as runVmTests } from '../vendor/vm.
|
|
3
|
+
import { r as runVmTests } from '../vendor/vm.QEE48c0T.js';
|
|
4
4
|
import '@vitest/utils';
|
|
5
5
|
import 'node:vm';
|
|
6
6
|
import 'node:url';
|
|
@@ -14,13 +14,13 @@ import '@vitest/runner/utils';
|
|
|
14
14
|
import '../vendor/global.CkGT_TMy.js';
|
|
15
15
|
import '../vendor/env.AtSIuHFg.js';
|
|
16
16
|
import 'std-env';
|
|
17
|
-
import '../vendor/execute.
|
|
17
|
+
import '../vendor/execute.fL3szUAI.js';
|
|
18
|
+
import 'node:fs';
|
|
18
19
|
import 'vite-node/client';
|
|
19
20
|
import 'vite-node/utils';
|
|
20
21
|
import '@vitest/utils/error';
|
|
21
22
|
import '../path.js';
|
|
22
|
-
import '
|
|
23
|
-
import '../vendor/base.Xt0Omgh7.js';
|
|
23
|
+
import '../vendor/base.5NT-gWu5.js';
|
|
24
24
|
import 'node:module';
|
|
25
25
|
import 'vite-node/constants';
|
|
26
26
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as createThreadsRpcOptions } from '../vendor/utils.0uYuCbzo.js';
|
|
2
|
-
import { r as runVmTests } from '../vendor/vm.
|
|
2
|
+
import { r as runVmTests } from '../vendor/vm.QEE48c0T.js';
|
|
3
3
|
import '@vitest/utils';
|
|
4
4
|
import 'node:vm';
|
|
5
5
|
import 'node:url';
|
|
@@ -13,13 +13,13 @@ import '@vitest/runner/utils';
|
|
|
13
13
|
import '../vendor/global.CkGT_TMy.js';
|
|
14
14
|
import '../vendor/env.AtSIuHFg.js';
|
|
15
15
|
import 'std-env';
|
|
16
|
-
import '../vendor/execute.
|
|
16
|
+
import '../vendor/execute.fL3szUAI.js';
|
|
17
|
+
import 'node:fs';
|
|
17
18
|
import 'vite-node/client';
|
|
18
19
|
import 'vite-node/utils';
|
|
19
20
|
import '@vitest/utils/error';
|
|
20
21
|
import '../path.js';
|
|
21
|
-
import '
|
|
22
|
-
import '../vendor/base.Xt0Omgh7.js';
|
|
22
|
+
import '../vendor/base.5NT-gWu5.js';
|
|
23
23
|
import 'node:module';
|
|
24
24
|
import 'vite-node/constants';
|
|
25
25
|
|
package/dist/workers.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as v8 from 'v8';
|
|
2
|
-
import { d as BirpcOptions, e as RuntimeRPC, f as ContextRPC, W as WorkerGlobalState, g as WorkerContext, R as ResolvedConfig } from './reporters-
|
|
2
|
+
import { d as BirpcOptions, e as RuntimeRPC, f as ContextRPC, W as WorkerGlobalState, g as WorkerContext, R as ResolvedConfig } from './reporters-w_64AS5f.js';
|
|
3
3
|
import { Awaitable } from '@vitest/utils';
|
|
4
4
|
import 'vite';
|
|
5
5
|
import '@vitest/runner';
|
package/dist/workers.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
export { c as createForksRpcOptions, a as createThreadsRpcOptions, u as unwrapSerializableConfig } from './vendor/utils.0uYuCbzo.js';
|
|
2
2
|
export { p as provideWorkerState } from './vendor/global.CkGT_TMy.js';
|
|
3
3
|
export { run as runVitestWorker } from './worker.js';
|
|
4
|
-
export { r as runVmTests } from './vendor/vm.
|
|
5
|
-
export { r as runBaseTests } from './vendor/base.
|
|
4
|
+
export { r as runVmTests } from './vendor/vm.QEE48c0T.js';
|
|
5
|
+
export { r as runBaseTests } from './vendor/base.Ybri3C14.js';
|
|
6
6
|
import '@vitest/utils';
|
|
7
7
|
import 'node:url';
|
|
8
8
|
import 'tinypool';
|
|
9
9
|
import 'vite-node/client';
|
|
10
|
+
import 'node:fs';
|
|
10
11
|
import 'pathe';
|
|
11
12
|
import './vendor/index.GVFv9dZ0.js';
|
|
12
13
|
import 'node:console';
|
|
13
|
-
import './vendor/base.
|
|
14
|
+
import './vendor/base.5NT-gWu5.js';
|
|
14
15
|
import './vendor/inspector.IgLX3ur5.js';
|
|
15
16
|
import 'node:module';
|
|
16
17
|
import './vendor/rpc.joBhAkyK.js';
|
|
@@ -23,9 +24,8 @@ import './vendor/date.Ns1pGd_X.js';
|
|
|
23
24
|
import '@vitest/runner/utils';
|
|
24
25
|
import './vendor/env.AtSIuHFg.js';
|
|
25
26
|
import 'std-env';
|
|
26
|
-
import './vendor/execute.
|
|
27
|
+
import './vendor/execute.fL3szUAI.js';
|
|
27
28
|
import 'vite-node/utils';
|
|
28
29
|
import '@vitest/utils/error';
|
|
29
30
|
import './path.js';
|
|
30
|
-
import 'node:fs';
|
|
31
31
|
import 'vite-node/constants';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.6.1",
|
|
5
5
|
"description": "Next generation testing framework powered by Vite",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -91,6 +91,10 @@
|
|
|
91
91
|
"./reporters": {
|
|
92
92
|
"types": "./dist/reporters.d.ts",
|
|
93
93
|
"default": "./dist/reporters.js"
|
|
94
|
+
},
|
|
95
|
+
"./snapshot": {
|
|
96
|
+
"types": "./dist/snapshot.d.ts",
|
|
97
|
+
"default": "./dist/snapshot.js"
|
|
94
98
|
}
|
|
95
99
|
},
|
|
96
100
|
"main": "./dist/index.js",
|
|
@@ -115,8 +119,8 @@
|
|
|
115
119
|
"@types/node": "^18.0.0 || >=20.0.0",
|
|
116
120
|
"happy-dom": "*",
|
|
117
121
|
"jsdom": "*",
|
|
118
|
-
"@vitest/
|
|
119
|
-
"@vitest/
|
|
122
|
+
"@vitest/ui": "1.6.1",
|
|
123
|
+
"@vitest/browser": "1.6.1"
|
|
120
124
|
},
|
|
121
125
|
"peerDependenciesMeta": {
|
|
122
126
|
"@edge-runtime/vm": {
|
|
@@ -153,12 +157,12 @@
|
|
|
153
157
|
"tinypool": "^0.8.3",
|
|
154
158
|
"vite": "^5.0.0",
|
|
155
159
|
"why-is-node-running": "^2.2.2",
|
|
156
|
-
"@vitest/
|
|
157
|
-
"@vitest/
|
|
158
|
-
"
|
|
159
|
-
"@vitest/
|
|
160
|
-
"
|
|
161
|
-
"@vitest/
|
|
160
|
+
"@vitest/runner": "1.6.1",
|
|
161
|
+
"@vitest/expect": "1.6.1",
|
|
162
|
+
"@vitest/spy": "1.6.1",
|
|
163
|
+
"@vitest/utils": "1.6.1",
|
|
164
|
+
"vite-node": "1.6.1",
|
|
165
|
+
"@vitest/snapshot": "1.6.1"
|
|
162
166
|
},
|
|
163
167
|
"devDependencies": {
|
|
164
168
|
"@ampproject/remapping": "^2.2.1",
|
package/snapshot.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist/snapshot.js'
|