vitest 5.0.0-beta.6 → 5.0.0-rc.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.
Files changed (82) hide show
  1. package/LICENSE.md +166 -2
  2. package/dist/browser.d.ts +29 -14
  3. package/dist/browser.js +11 -14
  4. package/dist/chunks/{acorn.B2iPLyUM.js → acorn.C1kjbUFw.js} +30 -30
  5. package/dist/chunks/{base.BKfXyFN7.js → base.IQV3unVv.js} +49 -41
  6. package/dist/chunks/{browser.d.DoM6vBOs.d.ts → browser.d.Dp8LNQdx.d.ts} +14 -14
  7. package/dist/chunks/{cac.DKrA6qEB.js → cac.CM6y_f_i.js} +64 -36
  8. package/dist/chunks/check.Cz_-YojU.js +15 -0
  9. package/dist/chunks/cli-api.B4r6twmv.js +520 -0
  10. package/dist/chunks/{config.d.CKWK3nld.d.ts → config.d.BpALOMjL.d.ts} +1006 -131
  11. package/dist/chunks/{console.DjVIMaXT.js → console.DWNMLVgF.js} +64 -64
  12. package/dist/chunks/{coverage.CTzCuANN.js → coverage.CPiksdSj.js} +7 -2
  13. package/dist/chunks/coverage.VANpXofm.js +26 -0
  14. package/dist/chunks/{creator.C4nK7Krt.js → creator.BW8mSwbG.js} +56 -34
  15. package/dist/chunks/{defaults.B_pFOTYy.js → defaults.D2ip7f-X.js} +6 -3
  16. package/dist/chunks/display.pkpxlVcY.js +194 -0
  17. package/dist/chunks/doctor.oxixVMjH.js +465 -0
  18. package/dist/chunks/{env.BKKtU2WC.js → env.DzFJjrmK.js} +1 -1
  19. package/dist/chunks/{environment.d.CrsxCzP1.d.ts → environment.d.DCnG-EPE.d.ts} +1 -1
  20. package/dist/chunks/globals.Dfl9zyCz.js +28 -0
  21. package/dist/chunks/{index.DNRmy2jU.js → index.BfU4rh_M.js} +108 -32
  22. package/dist/chunks/{index.Chj8NDwU.js → index.CCh1Pb8k.js} +6 -12
  23. package/dist/chunks/{index.B4UTDegh.js → index.CePpwRnE.js} +6 -5
  24. package/dist/chunks/{index.D6NDM5O1.js → index.DRmbsPYf.js} +7618 -7451
  25. package/dist/chunks/{index.CMESou6r.js → index.DXQx-kDM.js} +77 -81
  26. package/dist/chunks/{cli-api.cZcvaUFI.js → index.DiRpHFrd.js} +16460 -13961
  27. package/dist/chunks/index.M2dsQ_UQ.js +944 -0
  28. package/dist/chunks/{init-forks.BG4bCDny.js → init-forks.BpFQPK_m.js} +1 -1
  29. package/dist/chunks/{init-threads.DLtIP5Qq.js → init-threads.DspSJVVe.js} +1 -1
  30. package/dist/chunks/{init.DTAQFCjl.js → init.BU4khizz.js} +73 -29
  31. package/dist/chunks/{native.DPzPHdi5.js → native.offEPk9l.js} +5 -6
  32. package/dist/chunks/{nativeModuleMocker.BKtCThoO.js → nativeModuleMocker.0CD1hdFV.js} +19 -12
  33. package/dist/chunks/{index.CesbTg1C.js → nativeModuleRunner.Bc3kXpWn.js} +101 -33
  34. package/dist/chunks/{node.C9I1sbE9.js → node.CS-X6Ymg.js} +2 -1
  35. package/dist/chunks/offset.Dy-5Fdfn.js +24 -0
  36. package/dist/chunks/pathe.M-eThtNZ.k2RS39sQ.js +489 -0
  37. package/dist/chunks/{plugin.d.Bpge8Jye.d.ts → plugin.d.xikpJNpD.d.ts} +1795 -1543
  38. package/dist/chunks/{plugins.DrsmdUE2.js → plugins.Cigb0uSy.js} +1 -1
  39. package/dist/chunks/resolver.B_5CI0Kh.js +48 -0
  40. package/dist/chunks/{rpc.DZEh5xnQ.js → rpc.DaPTofpf.js} +8 -76
  41. package/dist/chunks/{rpc.d.C6-dGZ2f.d.ts → rpc.d.DWQfGdI1.d.ts} +14 -1
  42. package/dist/chunks/{artifact.BNnEI1sJ.js → run.DS9d28OG.js} +1539 -202
  43. package/dist/chunks/setup-common.D_kw2djf.js +36 -0
  44. package/dist/chunks/setup.CXTsmSEE.js +5398 -0
  45. package/dist/chunks/source-map.CTObTzjj.js +1777 -0
  46. package/dist/chunks/source-map.d.DRVw4m2c.d.ts +88 -0
  47. package/dist/chunks/spy.DPpyuUIA.js +461 -0
  48. package/dist/chunks/{task-utils.d.mMDXJF_I.d.ts → task-utils.d.B0b4kWzC.d.ts} +26 -18
  49. package/dist/chunks/tinyrainbow.Ht9iggcq.js +95 -0
  50. package/dist/chunks/{utils.DKODp04v.js → utils.DtdLoSPT.js} +45 -51
  51. package/dist/chunks/vm.QEFtWwx4.js +1262 -0
  52. package/dist/chunks/{worker.d.JES7ffPK.d.ts → worker.d.D7LKSMQN.d.ts} +26 -17
  53. package/dist/cli.js +4 -5
  54. package/dist/config.cjs +1 -0
  55. package/dist/config.d.ts +20 -17
  56. package/dist/config.js +2 -2
  57. package/dist/index.d.ts +16 -30
  58. package/dist/index.js +12 -17
  59. package/dist/module-evaluator.d.ts +57 -9
  60. package/dist/module-evaluator.js +92 -41
  61. package/dist/node.d.ts +214 -85
  62. package/dist/node.js +30 -67
  63. package/dist/runtime.d.ts +5 -10
  64. package/dist/runtime.js +4 -5
  65. package/dist/spy.js +1 -1
  66. package/dist/task-utils.js +8 -23
  67. package/dist/traces.js +2 -1
  68. package/dist/worker.d.ts +7 -10
  69. package/dist/worker.js +25 -37
  70. package/dist/workers/forks.js +22 -34
  71. package/dist/workers/runVmTests.js +46 -39
  72. package/dist/workers/threads.js +22 -34
  73. package/dist/workers/vmForks.js +16 -16
  74. package/dist/workers/vmThreads.js +16 -16
  75. package/package.json +34 -36
  76. package/dist/chunks/_commonjsHelpers.D26ty3Ew.js +0 -6
  77. package/dist/chunks/coverage.d.CCNrKR65.d.ts +0 -43
  78. package/dist/chunks/globals.CzUA1xn8.js +0 -33
  79. package/dist/chunks/index.Djaij2xr.js +0 -6960
  80. package/dist/chunks/nativeModuleRunner.WlMdOB52.js +0 -36
  81. package/dist/chunks/setup-common.ZNdeu5wa.js +0 -64
  82. package/dist/chunks/vm.CeHWcIrU.js +0 -785
package/LICENSE.md CHANGED
@@ -31,7 +31,7 @@ BSD-3-Clause, ISC, MIT
31
31
  ## @antfu/install-pkg
32
32
  License: MIT
33
33
  By: Anthony Fu
34
- Repository: git+https://github.com/antfu/install-pkg.git
34
+ Repository: git+https://github.com/antfu-collective/install-pkg.git
35
35
 
36
36
  > MIT License
37
37
  >
@@ -316,6 +316,65 @@ Repository: egoist/cac
316
316
 
317
317
  ---------------------------------------
318
318
 
319
+ ## convert-source-map
320
+ License: MIT
321
+ By: Thorsten Lorenz
322
+ Repository: git://github.com/thlorenz/convert-source-map.git
323
+
324
+ > Copyright 2013 Thorsten Lorenz.
325
+ > All rights reserved.
326
+ >
327
+ > Permission is hereby granted, free of charge, to any person
328
+ > obtaining a copy of this software and associated documentation
329
+ > files (the "Software"), to deal in the Software without
330
+ > restriction, including without limitation the rights to use,
331
+ > copy, modify, merge, publish, distribute, sublicense, and/or sell
332
+ > copies of the Software, and to permit persons to whom the
333
+ > Software is furnished to do so, subject to the following
334
+ > conditions:
335
+ >
336
+ > The above copyright notice and this permission notice shall be
337
+ > included in all copies or substantial portions of the Software.
338
+ >
339
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
340
+ > EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
341
+ > OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
342
+ > NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
343
+ > HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
344
+ > WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
345
+ > FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
346
+ > OTHER DEALINGS IN THE SOFTWARE.
347
+
348
+ ---------------------------------------
349
+
350
+ ## diff-sequences
351
+ License: MIT
352
+ Repository: https://github.com/jestjs/jest.git
353
+
354
+ > MIT License
355
+ >
356
+ > Copyright (c) Meta Platforms, Inc. and affiliates.
357
+ >
358
+ > Permission is hereby granted, free of charge, to any person obtaining a copy
359
+ > of this software and associated documentation files (the "Software"), to deal
360
+ > in the Software without restriction, including without limitation the rights
361
+ > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
362
+ > copies of the Software, and to permit persons to whom the Software is
363
+ > furnished to do so, subject to the following conditions:
364
+ >
365
+ > The above copyright notice and this permission notice shall be included in all
366
+ > copies or substantial portions of the Software.
367
+ >
368
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
369
+ > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
370
+ > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
371
+ > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
372
+ > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
373
+ > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
374
+ > SOFTWARE.
375
+
376
+ ---------------------------------------
377
+
319
378
  ## flatted
320
379
  License: ISC
321
380
  By: Andrea Giammarchi
@@ -346,7 +405,7 @@ Repository: lydell/js-tokens
346
405
 
347
406
  > The MIT License (MIT)
348
407
  >
349
- > Copyright (c) 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Simon Lydell
408
+ > Copyright (c) 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024 Simon Lydell
350
409
  >
351
410
  > Permission is hereby granted, free of charge, to any person obtaining a copy
352
411
  > of this software and associated documentation files (the "Software"), to deal
@@ -519,6 +578,83 @@ Repository: git+https://github.com/antfu-collective/package-manager-detector.git
519
578
 
520
579
  ---------------------------------------
521
580
 
581
+ ## pathe
582
+ License: MIT
583
+ Repository: unjs/pathe
584
+
585
+ > MIT License
586
+ >
587
+ > Copyright (c) Pooya Parsa <pooya@pi0.io> - Daniel Roe <daniel@roe.dev>
588
+ >
589
+ > Permission is hereby granted, free of charge, to any person obtaining a copy
590
+ > of this software and associated documentation files (the "Software"), to deal
591
+ > in the Software without restriction, including without limitation the rights
592
+ > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
593
+ > copies of the Software, and to permit persons to whom the Software is
594
+ > furnished to do so, subject to the following conditions:
595
+ >
596
+ > The above copyright notice and this permission notice shall be included in all
597
+ > copies or substantial portions of the Software.
598
+ >
599
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
600
+ > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
601
+ > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
602
+ > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
603
+ > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
604
+ > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
605
+ > SOFTWARE.
606
+ >
607
+ > ---
608
+ >
609
+ > Copyright Joyent, Inc. and other Node contributors.
610
+ >
611
+ > Permission is hereby granted, free of charge, to any person obtaining a
612
+ > copy of this software and associated documentation files (the
613
+ > "Software"), to deal in the Software without restriction, including
614
+ > without limitation the rights to use, copy, modify, merge, publish,
615
+ > distribute, sublicense, and/or sell copies of the Software, and to permit
616
+ > persons to whom the Software is furnished to do so, subject to the
617
+ > following conditions:
618
+ >
619
+ > The above copyright notice and this permission notice shall be included
620
+ > in all copies or substantial portions of the Software.
621
+ >
622
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
623
+ > OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
624
+ > MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
625
+ > NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
626
+ > DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
627
+ > OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
628
+ > USE OR OTHER DEALINGS IN THE SOFTWARE.
629
+ >
630
+ > ---
631
+ >
632
+ > Bundled zeptomatch (https://github.com/fabiospampinato/zeptomatch)
633
+ >
634
+ > The MIT License (MIT)
635
+ >
636
+ > Copyright (c) 2023-present Fabio Spampinato
637
+ >
638
+ > Permission is hereby granted, free of charge, to any person obtaining a
639
+ > copy of this software and associated documentation files (the "Software"),
640
+ > to deal in the Software without restriction, including without limitation
641
+ > the rights to use, copy, modify, merge, publish, distribute, sublicense,
642
+ > and/or sell copies of the Software, and to permit persons to whom the
643
+ > Software is furnished to do so, subject to the following conditions:
644
+ >
645
+ > The above copyright notice and this permission notice shall be included in
646
+ > all copies or substantial portions of the Software.
647
+ >
648
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
649
+ > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
650
+ > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
651
+ > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
652
+ > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
653
+ > FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
654
+ > DEALINGS IN THE SOFTWARE.
655
+
656
+ ---------------------------------------
657
+
522
658
  ## prompts
523
659
  License: MIT
524
660
  By: Terkel Gjervig
@@ -719,6 +855,34 @@ Repository: git+https://github.com/tinylibs/tinyhighlight.git
719
855
 
720
856
  ---------------------------------------
721
857
 
858
+ ## tinyrainbow
859
+ License: MIT
860
+ Repository: git+https://github.com/tinylibs/tinyrainbow.git
861
+
862
+ > MIT License
863
+ >
864
+ > Copyright (c) 2022 Tinylibs
865
+ >
866
+ > Permission is hereby granted, free of charge, to any person obtaining a copy
867
+ > of this software and associated documentation files (the "Software"), to deal
868
+ > in the Software without restriction, including without limitation the rights
869
+ > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
870
+ > copies of the Software, and to permit persons to whom the Software is
871
+ > furnished to do so, subject to the following conditions:
872
+ >
873
+ > The above copyright notice and this permission notice shall be included in all
874
+ > copies or substantial portions of the Software.
875
+ >
876
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
877
+ > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
878
+ > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
879
+ > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
880
+ > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
881
+ > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
882
+ > SOFTWARE.
883
+
884
+ ---------------------------------------
885
+
722
886
  ## type-detect
723
887
  License: MIT
724
888
  By: Jake Luer, Keith Cirkel, David Losert, Aleksey Shvayka, Lucas Fernandes da Costa, Grant Snodgrass, Jeremy Tice, Edward Betts, dvlsg, Amila Welihinda, Jake Champion, Miroslav Bajtoš
package/dist/browser.d.ts CHANGED
@@ -1,18 +1,30 @@
1
- import { a4 as SerializedCoverageConfig, aH as FileSpecification, V as VitestRunner, F as File, n as SerializedConfig } from './chunks/config.d.CKWK3nld.js';
2
- import { R as RuntimeCoverageModuleLoader } from './chunks/coverage.d.CCNrKR65.js';
3
- import { SerializedDiffOptions } from '@vitest/utils/diff';
4
- import * as _vitest_spy from '@vitest/spy';
5
- export { _vitest_spy as SpyModule };
6
- export { ParsedStack, StringifyOptions } from '@vitest/utils';
7
- export { format, inspect, stringify } from '@vitest/utils/display';
8
- export { processError } from '@vitest/utils/error';
9
- export { getType } from '@vitest/utils/helpers';
10
- export { DecodedMap, getOriginalPosition } from '@vitest/utils/source-map';
11
- export { getSafeTimers, setSafeTimers } from '@vitest/utils/timers';
12
- import '@vitest/pretty-format';
13
- import 'tinyrainbow';
1
+ import { F as FileSpecification, c as SerializedDiffOptions } from './chunks/config.d.BpALOMjL.js';
2
+ import { SerializedCoverageConfig, RunnerTestFile as File, SerializedConfig, DiffOptions, TestError } from './index.js';
3
+ import { VitestRunner } from './runtime.js';
4
+ export { P as ParsedStack, _ as SpyModule, d as StringifyOptions, f as format, i as inspect, s as stringify } from './chunks/config.d.BpALOMjL.js';
5
+ import { R as RuntimeCoverageModuleLoader } from './chunks/source-map.d.DRVw4m2c.js';
6
+ export { D as DecodedMap, g as getOriginalPosition } from './chunks/source-map.d.DRVw4m2c.js';
7
+ import 'vitest/optional-runtime-types.js';
14
8
  import 'tinybench';
15
9
 
10
+ declare function getType(value: unknown): string;
11
+
12
+ interface SafeTimers {
13
+ nextTick?: (cb: () => void) => void;
14
+ setImmediate?: {
15
+ <TArgs extends any[]>(callback: (...args: TArgs) => void, ...args: TArgs): any;
16
+ __promisify__: <T = void>(value?: T, options?: any) => Promise<T>;
17
+ };
18
+ clearImmediate?: (immediateId: any) => void;
19
+ setTimeout: typeof setTimeout;
20
+ setInterval: typeof setInterval;
21
+ clearInterval: typeof clearInterval;
22
+ clearTimeout: typeof clearTimeout;
23
+ queueMicrotask: typeof queueMicrotask;
24
+ }
25
+ declare function getSafeTimers(): SafeTimers;
26
+ declare function setSafeTimers(): void;
27
+
16
28
  declare function startCoverageInsideWorker(options: SerializedCoverageConfig, loader: RuntimeCoverageModuleLoader, runtimeOptions: {
17
29
  isolate: boolean;
18
30
  }): Promise<unknown>;
@@ -29,9 +41,12 @@ interface PublicModuleRunner {
29
41
  }
30
42
 
31
43
  declare function setupCommonEnv(config: SerializedConfig): Promise<void>;
44
+ declare function setupEnv(env: Record<string, any>, metaEnv: Record<string, any>): void;
32
45
  declare function loadDiffConfig(config: SerializedConfig, moduleRunner: PublicModuleRunner): Promise<SerializedDiffOptions | undefined>;
33
46
  declare function loadSnapshotSerializers(config: SerializedConfig, moduleRunner: PublicModuleRunner): Promise<void>;
34
47
 
48
+ declare function processError(_err: any, diffOptions?: DiffOptions, seen?: WeakSet<WeakKey>): TestError;
49
+
35
50
  interface FsOptions {
36
51
  encoding?: BufferEncoding;
37
52
  flag?: string | number;
@@ -45,5 +60,5 @@ interface BrowserCommands {
45
60
  }
46
61
  interface CDPSession {}
47
62
 
48
- export { FileSpecification, publicCollect as collectTests, loadDiffConfig, loadSnapshotSerializers, setupCommonEnv, startCoverageInsideWorker, startTests, stopCoverageInsideWorker, takeCoverageInsideWorker };
63
+ export { FileSpecification, publicCollect as collectTests, getSafeTimers, getType, loadDiffConfig, loadSnapshotSerializers, processError, setSafeTimers, setupCommonEnv, setupEnv, startCoverageInsideWorker, startTests, stopCoverageInsideWorker, takeCoverageInsideWorker };
49
64
  export type { BrowserCommands, CDPSession, FsOptions };
package/dist/browser.js CHANGED
@@ -1,18 +1,15 @@
1
- export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv, b as startCoverageInsideWorker, c as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/setup-common.ZNdeu5wa.js';
2
- export { p as collectTests, s as startTests } from './chunks/artifact.BNnEI1sJ.js';
3
- import * as spyModule from '@vitest/spy';
4
- export { spyModule as SpyModule };
5
- export { format, inspect, stringify } from '@vitest/utils/display';
6
- export { processError } from '@vitest/utils/error';
7
- export { getType } from '@vitest/utils/helpers';
8
- export { DecodedMap, getOriginalPosition } from '@vitest/utils/source-map';
9
- export { getSafeTimers, setSafeTimers } from '@vitest/utils/timers';
10
- import './chunks/coverage.CTzCuANN.js';
11
- import './chunks/utils.DYj33du9.js';
12
- import './chunks/plugins.DrsmdUE2.js';
13
- import '@vitest/pretty-format';
1
+ export { s as startCoverageInsideWorker, a as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/coverage.VANpXofm.js';
2
+ export { p as collectTests, a as processError, s as startTests } from './chunks/run.DS9d28OG.js';
3
+ export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv, b as setupEnv } from './chunks/setup-common.D_kw2djf.js';
4
+ export { s as SpyModule } from './chunks/spy.DPpyuUIA.js';
5
+ export { f as format, i as inspect, s as stringify } from './chunks/display.pkpxlVcY.js';
6
+ export { g as getType } from './chunks/pathe.M-eThtNZ.k2RS39sQ.js';
7
+ export { D as DecodedMap, g as getOriginalPosition, a as getSafeTimers, s as setSafeTimers } from './chunks/source-map.CTObTzjj.js';
8
+ import './chunks/coverage.CPiksdSj.js';
9
+ import './chunks/index.M2dsQ_UQ.js';
10
+ import './chunks/tinyrainbow.Ht9iggcq.js';
14
11
  import './task-utils.js';
15
- import 'pathe';
12
+ import './chunks/plugins.Cigb0uSy.js';
16
13
 
17
14
  /**
18
15
  * @internal
@@ -817,10 +817,10 @@ var pp$8 = Parser.prototype;
817
817
  // to its body instead of creating a new node.
818
818
 
819
819
  pp$8.parseTopLevel = function(node) {
820
- var exports$1 = Object.create(null);
820
+ var exports = Object.create(null);
821
821
  if (!node.body) { node.body = []; }
822
822
  while (this.type !== types$1.eof) {
823
- var stmt = this.parseStatement(null, true, exports$1);
823
+ var stmt = this.parseStatement(null, true, exports);
824
824
  node.body.push(stmt);
825
825
  }
826
826
  if (this.inModule)
@@ -884,7 +884,7 @@ pp$8.isAsyncFunction = function() {
884
884
  // `if (foo) /blah/.exec(foo)`, where looking at the previous token
885
885
  // does not help.
886
886
 
887
- pp$8.parseStatement = function(context, topLevel, exports$1) {
887
+ pp$8.parseStatement = function(context, topLevel, exports) {
888
888
  var starttype = this.type, node = this.startNode(), kind;
889
889
 
890
890
  if (this.isLet(context)) {
@@ -939,7 +939,7 @@ pp$8.parseStatement = function(context, topLevel, exports$1) {
939
939
  if (!this.inModule)
940
940
  { this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'"); }
941
941
  }
942
- return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports$1)
942
+ return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports)
943
943
 
944
944
  // If the statement does not start with a statement keyword or a
945
945
  // brace, it's an ExpressionStatement or LabeledStatement. We
@@ -1654,11 +1654,11 @@ function checkKeyName(node, name) {
1654
1654
 
1655
1655
  // Parses module export declaration.
1656
1656
 
1657
- pp$8.parseExportAllDeclaration = function(node, exports$1) {
1657
+ pp$8.parseExportAllDeclaration = function(node, exports) {
1658
1658
  if (this.options.ecmaVersion >= 11) {
1659
1659
  if (this.eatContextual("as")) {
1660
1660
  node.exported = this.parseModuleExportName();
1661
- this.checkExport(exports$1, node.exported, this.lastTokStart);
1661
+ this.checkExport(exports, node.exported, this.lastTokStart);
1662
1662
  } else {
1663
1663
  node.exported = null;
1664
1664
  }
@@ -1670,14 +1670,14 @@ pp$8.parseExportAllDeclaration = function(node, exports$1) {
1670
1670
  return this.finishNode(node, "ExportAllDeclaration")
1671
1671
  };
1672
1672
 
1673
- pp$8.parseExport = function(node, exports$1) {
1673
+ pp$8.parseExport = function(node, exports) {
1674
1674
  this.next();
1675
1675
  // export * from '...'
1676
1676
  if (this.eat(types$1.star)) {
1677
- return this.parseExportAllDeclaration(node, exports$1)
1677
+ return this.parseExportAllDeclaration(node, exports)
1678
1678
  }
1679
1679
  if (this.eat(types$1._default)) { // export default ...
1680
- this.checkExport(exports$1, "default", this.lastTokStart);
1680
+ this.checkExport(exports, "default", this.lastTokStart);
1681
1681
  node.declaration = this.parseExportDefaultDeclaration();
1682
1682
  return this.finishNode(node, "ExportDefaultDeclaration")
1683
1683
  }
@@ -1685,14 +1685,14 @@ pp$8.parseExport = function(node, exports$1) {
1685
1685
  if (this.shouldParseExportStatement()) {
1686
1686
  node.declaration = this.parseExportDeclaration(node);
1687
1687
  if (node.declaration.type === "VariableDeclaration")
1688
- { this.checkVariableExport(exports$1, node.declaration.declarations); }
1688
+ { this.checkVariableExport(exports, node.declaration.declarations); }
1689
1689
  else
1690
- { this.checkExport(exports$1, node.declaration.id, node.declaration.id.start); }
1690
+ { this.checkExport(exports, node.declaration.id, node.declaration.id.start); }
1691
1691
  node.specifiers = [];
1692
1692
  node.source = null;
1693
1693
  } else { // export { x, y as z } [from '...']
1694
1694
  node.declaration = null;
1695
- node.specifiers = this.parseExportSpecifiers(exports$1);
1695
+ node.specifiers = this.parseExportSpecifiers(exports);
1696
1696
  if (this.eatContextual("from")) {
1697
1697
  if (this.type !== types$1.string) { this.unexpected(); }
1698
1698
  node.source = this.parseExprAtom();
@@ -1738,47 +1738,47 @@ pp$8.parseExportDefaultDeclaration = function() {
1738
1738
  }
1739
1739
  };
1740
1740
 
1741
- pp$8.checkExport = function(exports$1, name, pos) {
1742
- if (!exports$1) { return }
1741
+ pp$8.checkExport = function(exports, name, pos) {
1742
+ if (!exports) { return }
1743
1743
  if (typeof name !== "string")
1744
1744
  { name = name.type === "Identifier" ? name.name : name.value; }
1745
- if (hasOwn(exports$1, name))
1745
+ if (hasOwn(exports, name))
1746
1746
  { this.raiseRecoverable(pos, "Duplicate export '" + name + "'"); }
1747
- exports$1[name] = true;
1747
+ exports[name] = true;
1748
1748
  };
1749
1749
 
1750
- pp$8.checkPatternExport = function(exports$1, pat) {
1750
+ pp$8.checkPatternExport = function(exports, pat) {
1751
1751
  var type = pat.type;
1752
1752
  if (type === "Identifier")
1753
- { this.checkExport(exports$1, pat, pat.start); }
1753
+ { this.checkExport(exports, pat, pat.start); }
1754
1754
  else if (type === "ObjectPattern")
1755
1755
  { for (var i = 0, list = pat.properties; i < list.length; i += 1)
1756
1756
  {
1757
1757
  var prop = list[i];
1758
1758
 
1759
- this.checkPatternExport(exports$1, prop);
1759
+ this.checkPatternExport(exports, prop);
1760
1760
  } }
1761
1761
  else if (type === "ArrayPattern")
1762
1762
  { for (var i$1 = 0, list$1 = pat.elements; i$1 < list$1.length; i$1 += 1) {
1763
1763
  var elt = list$1[i$1];
1764
1764
 
1765
- if (elt) { this.checkPatternExport(exports$1, elt); }
1765
+ if (elt) { this.checkPatternExport(exports, elt); }
1766
1766
  } }
1767
1767
  else if (type === "Property")
1768
- { this.checkPatternExport(exports$1, pat.value); }
1768
+ { this.checkPatternExport(exports, pat.value); }
1769
1769
  else if (type === "AssignmentPattern")
1770
- { this.checkPatternExport(exports$1, pat.left); }
1770
+ { this.checkPatternExport(exports, pat.left); }
1771
1771
  else if (type === "RestElement")
1772
- { this.checkPatternExport(exports$1, pat.argument); }
1772
+ { this.checkPatternExport(exports, pat.argument); }
1773
1773
  };
1774
1774
 
1775
- pp$8.checkVariableExport = function(exports$1, decls) {
1776
- if (!exports$1) { return }
1775
+ pp$8.checkVariableExport = function(exports, decls) {
1776
+ if (!exports) { return }
1777
1777
  for (var i = 0, list = decls; i < list.length; i += 1)
1778
1778
  {
1779
1779
  var decl = list[i];
1780
1780
 
1781
- this.checkPatternExport(exports$1, decl.id);
1781
+ this.checkPatternExport(exports, decl.id);
1782
1782
  }
1783
1783
  };
1784
1784
 
@@ -1793,13 +1793,13 @@ pp$8.shouldParseExportStatement = function() {
1793
1793
 
1794
1794
  // Parses a comma-separated list of module exports.
1795
1795
 
1796
- pp$8.parseExportSpecifier = function(exports$1) {
1796
+ pp$8.parseExportSpecifier = function(exports) {
1797
1797
  var node = this.startNode();
1798
1798
  node.local = this.parseModuleExportName();
1799
1799
 
1800
1800
  node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local;
1801
1801
  this.checkExport(
1802
- exports$1,
1802
+ exports,
1803
1803
  node.exported,
1804
1804
  node.exported.start
1805
1805
  );
@@ -1807,7 +1807,7 @@ pp$8.parseExportSpecifier = function(exports$1) {
1807
1807
  return this.finishNode(node, "ExportSpecifier")
1808
1808
  };
1809
1809
 
1810
- pp$8.parseExportSpecifiers = function(exports$1) {
1810
+ pp$8.parseExportSpecifiers = function(exports) {
1811
1811
  var nodes = [], first = true;
1812
1812
  // export { x, y as z } [from '...']
1813
1813
  this.expect(types$1.braceL);
@@ -1817,7 +1817,7 @@ pp$8.parseExportSpecifiers = function(exports$1) {
1817
1817
  if (this.afterTrailingComma(types$1.braceR)) { break }
1818
1818
  } else { first = false; }
1819
1819
 
1820
- nodes.push(this.parseExportSpecifier(exports$1));
1820
+ nodes.push(this.parseExportSpecifier(exports));
1821
1821
  }
1822
1822
  return nodes
1823
1823
  };
@@ -1,21 +1,21 @@
1
1
  import { runInThisContext } from 'node:vm';
2
- import * as spyModule from '@vitest/spy';
3
- import { r as resolveTestRunner, a as resolveSnapshotEnvironment, d as detectAsyncLeaks, s as setupChaiConfig } from './index.B4UTDegh.js';
4
- import { l as loadEnvironment, e as emitModuleRunner, a as listenForErrors } from './init.DTAQFCjl.js';
5
- import { N as NativeModuleRunner } from './nativeModuleRunner.WlMdOB52.js';
2
+ import { s as spyModule } from './spy.DPpyuUIA.js';
3
+ import { r as resolveTestRunner, a as resolveSnapshotEnvironment, d as detectAsyncLeaks, s as setupChaiConfig } from './index.CePpwRnE.js';
4
+ import { l as loadEnvironment, e as emitModuleRunner, a as listenForErrors } from './init.BU4khizz.js';
6
5
  import { Traces } from '../traces.js';
7
- import { V as VitestEvaluatedModules } from './rpc.DZEh5xnQ.js';
8
- import { s as startVitestModuleRunner, c as createNodeImportMeta } from './index.DNRmy2jU.js';
6
+ import { V as VitestEvaluatedModules } from './rpc.DaPTofpf.js';
7
+ import { s as startVitestModuleRunner, c as createNodeImportMeta } from './index.BfU4rh_M.js';
9
8
  import { performance as performance$1 } from 'node:perf_hooks';
10
- import { s as setupCommonEnv, b as startCoverageInsideWorker, c as stopCoverageInsideWorker } from './setup-common.ZNdeu5wa.js';
11
- import { i as index, g as globalExpect, v as vi } from './index.D6NDM5O1.js';
9
+ import { s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './coverage.VANpXofm.js';
10
+ import { i as index, g as globalExpect, v as vi } from './index.DRmbsPYf.js';
12
11
  import { c as closeInspector } from './inspector.CvyFGlXm.js';
13
- import { s as startTests, p as publicCollect } from './artifact.BNnEI1sJ.js';
12
+ import { s as startTests, p as publicCollect } from './run.DS9d28OG.js';
14
13
  import { createRequire } from 'node:module';
15
14
  import timers from 'node:timers';
16
15
  import timersPromises from 'node:timers/promises';
17
16
  import util from 'node:util';
18
- import { KNOWN_ASSET_TYPES } from '@vitest/utils/constants';
17
+ import { K as KNOWN_ASSET_TYPES } from './pathe.M-eThtNZ.k2RS39sQ.js';
18
+ import { s as setupCommonEnv, b as setupEnv } from './setup-common.D_kw2djf.js';
19
19
  import { g as getWorkerState, r as resetModules, p as provideWorkerState, a as getSafeWorkerState } from './utils.DYj33du9.js';
20
20
 
21
21
  // this should only be used in Node
@@ -57,7 +57,7 @@ function resolveAsset(mod, url) {
57
57
  mod.exports = url;
58
58
  }
59
59
  async function setupConsoleLogSpy() {
60
- const { createCustomConsole } = await import('./console.DjVIMaXT.js');
60
+ const { createCustomConsole } = await import('./console.DWNMLVgF.js');
61
61
  globalThis.console = createCustomConsole();
62
62
  }
63
63
 
@@ -72,30 +72,34 @@ async function run(method, files, config, moduleRunner, environment, traces) {
72
72
  if (!workerState.config.snapshotOptions.snapshotEnvironment) workerState.config.snapshotOptions.snapshotEnvironment = await resolveSnapshotEnvironment(config, moduleRunner);
73
73
  })
74
74
  ]);
75
- workerState.onCancel((reason) => {
75
+ const offCancel = workerState.onCancel((reason) => {
76
76
  closeInspector(config);
77
77
  testRunner.cancel?.(reason);
78
78
  });
79
79
  workerState.durations.prepare = performance$1.now() - workerState.durations.prepare;
80
- await traces.$(`vitest.test.runner.${method}`, async () => {
81
- for (const file of files) {
82
- if (config.isolate) {
83
- moduleRunner.mocker?.reset();
84
- resetModules(workerState.evaluatedModules, true);
80
+ try {
81
+ await traces.$(`vitest.test.runner.${method}`, async () => {
82
+ for (const file of files) {
83
+ if (config.isolate) {
84
+ moduleRunner.mocker?.reset();
85
+ resetModules(workerState.evaluatedModules, true);
86
+ }
87
+ workerState.filepath = file.filepath;
88
+ if (method === "run") {
89
+ const collectAsyncLeaks = config.detectAsyncLeaks ? detectAsyncLeaks(file.filepath, workerState.ctx.projectName) : void 0;
90
+ await traces.$(`vitest.test.runner.${method}.module`, { attributes: { "code.file.path": file.filepath } }, () => startTests([file], testRunner));
91
+ const leaks = await collectAsyncLeaks?.();
92
+ if (leaks?.length) workerState.rpc.onAsyncLeaks(leaks);
93
+ } else await traces.$(`vitest.test.runner.${method}.module`, { attributes: { "code.file.path": file.filepath } }, () => publicCollect([file], testRunner));
94
+ // reset after tests, because user might call `vi.setConfig` in setupFile
95
+ vi.resetConfig();
96
+ // mocks should not affect different files
97
+ vi.restoreAllMocks();
85
98
  }
86
- workerState.filepath = file.filepath;
87
- if (method === "run") {
88
- const collectAsyncLeaks = config.detectAsyncLeaks ? detectAsyncLeaks(file.filepath, workerState.ctx.projectName) : void 0;
89
- await traces.$(`vitest.test.runner.${method}.module`, { attributes: { "code.file.path": file.filepath } }, () => startTests([file], testRunner));
90
- const leaks = await collectAsyncLeaks?.();
91
- if (leaks?.length) workerState.rpc.onAsyncLeaks(leaks);
92
- } else await traces.$(`vitest.test.runner.${method}.module`, { attributes: { "code.file.path": file.filepath } }, () => publicCollect([file], testRunner));
93
- // reset after tests, because user might call `vi.setConfig` in setupFile
94
- vi.resetConfig();
95
- // mocks should not affect different files
96
- vi.restoreAllMocks();
97
- }
98
- });
99
+ });
100
+ } finally {
101
+ offCancel();
102
+ }
99
103
  await traces.$("vitest.runtime.coverage.stop", () => stopCoverageInsideWorker(config.coverage, moduleRunner, { isolate: config.isolate }));
100
104
  }
101
105
 
@@ -114,7 +118,7 @@ async function startModuleRunner(options) {
114
118
  let mocker;
115
119
  if (options.state.config.experimental.nodeLoader !== false) {
116
120
  // this additionally imports acorn/magic-string
117
- const { NativeModuleMocker } = await import('./nativeModuleMocker.BKtCThoO.js');
121
+ const { NativeModuleMocker } = await import('./nativeModuleMocker.0CD1hdFV.js');
118
122
  mocker = new NativeModuleMocker({
119
123
  async resolveId(id, importer) {
120
124
  // TODO: use import.meta.resolve instead
@@ -129,6 +133,9 @@ async function startModuleRunner(options) {
129
133
  spyModule
130
134
  });
131
135
  }
136
+ // imported lazily (pulls in `local-pkg`) so it stays out of the default
137
+ // worker startup graph; only the `viteModuleRunner: false` path needs it
138
+ const { NativeModuleRunner } = await import('./nativeModuleRunner.Bc3kXpWn.js').then(function (n) { return n.n; });
132
139
  _moduleRunner = new NativeModuleRunner(root, mocker);
133
140
  return _moduleRunner;
134
141
  }
@@ -140,20 +147,12 @@ let _environmentTime;
140
147
  /** @experimental */
141
148
  async function setupBaseEnvironment(context) {
142
149
  if (context.config.experimental.viteModuleRunner === false) {
143
- const { setupNodeLoaderHooks } = await import('./native.DPzPHdi5.js');
150
+ const { setupNodeLoaderHooks } = await import('./native.offEPk9l.js');
144
151
  await setupNodeLoaderHooks(context);
145
152
  }
146
153
  const startTime = performance.now();
147
154
  const { environment: { name: environmentName, options: environmentOptions }, rpc, config } = context;
148
- // we could load @vite/env, but it would take ~8ms, while this takes ~0,02ms
149
- if (context.config.serializedDefines) try {
150
- runInThisContext(`(() =>{\n${context.config.serializedDefines}})()`, {
151
- lineOffset: 1,
152
- filename: "virtual:load-defines.js"
153
- });
154
- } catch (error) {
155
- throw new Error(`Failed to load custom "defines": ${error.message}`);
156
- }
155
+ setupEnv(config.env, context.metaEnv);
157
156
  const otel = context.traces;
158
157
  const { environment, loader } = await loadEnvironment(environmentName, config.root, rpc, otel, context.config.experimental.viteModuleRunner);
159
158
  _currentEnvironment = environment;
@@ -177,6 +176,15 @@ async function runBaseTests(method, state, traces) {
177
176
  state.evaluatedModules = evaluatedModules;
178
177
  state.moduleExecutionInfo = moduleExecutionInfo;
179
178
  provideWorkerState(globalThis, state);
179
+ // we could load @vite/env, but it would take ~8ms, while this takes ~0,02ms
180
+ if (state.config.serializedDefines) try {
181
+ runInThisContext(`(() =>{\n${state.config.serializedDefines}})()`, {
182
+ lineOffset: 1,
183
+ filename: "virtual:load-defines.js"
184
+ });
185
+ } catch (error) {
186
+ throw new Error(`Failed to load custom "defines": ${error.message}`);
187
+ }
180
188
  if (ctx.invalidates) ctx.invalidates.forEach((filepath) => {
181
189
  (state.evaluatedModules.fileToModulesMap.get(filepath) || []).forEach((module) => {
182
190
  state.evaluatedModules.invalidateModule(module);
@@ -1,17 +1,6 @@
1
- import { aH as FileSpecification } from './config.d.CKWK3nld.js';
2
- import { O as OTELCarrier } from './rpc.d.C6-dGZ2f.js';
3
- import { T as TestExecutionMethod } from './worker.d.JES7ffPK.js';
4
-
5
- type SerializedTestSpecification = [project: {
6
- name: string | undefined;
7
- root: string;
8
- }, file: string, options: {
9
- pool: string;
10
- testLines?: number[] | undefined;
11
- testIds?: string[] | undefined;
12
- testNamePattern?: RegExp | undefined;
13
- testTagsFilter?: string[] | undefined;
14
- }];
1
+ import { F as FileSpecification } from './config.d.BpALOMjL.js';
2
+ import { O as OTELCarrier } from './rpc.d.DWQfGdI1.js';
3
+ import { T as TestExecutionMethod } from './worker.d.D7LKSMQN.js';
15
4
 
16
5
  interface ModuleDefinitionLocation {
17
6
  line: number;
@@ -52,6 +41,17 @@ interface SourceModuleDiagnostic {
52
41
  untrackedModules: UntrackedModuleDefinitionDiagnostic[];
53
42
  }
54
43
 
44
+ type SerializedTestSpecification = [project: {
45
+ name: string | undefined;
46
+ root: string;
47
+ }, file: string, options: {
48
+ pool: string;
49
+ testLines?: number[] | undefined;
50
+ testIds?: string[] | undefined;
51
+ testNamePattern?: RegExp | undefined;
52
+ testTagsFilter?: string[] | undefined;
53
+ }];
54
+
55
55
  interface BrowserTesterOptions {
56
56
  method: TestExecutionMethod;
57
57
  files: FileSpecification[];