vitest 4.1.0-beta.2 → 4.1.0-beta.4

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 (54) hide show
  1. package/LICENSE.md +116 -1
  2. package/dist/browser.d.ts +1 -1
  3. package/dist/browser.js +1 -1
  4. package/dist/chunks/{base.DiopZV8F.js → base.C_KzYoIG.js} +10 -6
  5. package/dist/chunks/{browser.d.BE4kbYok.d.ts → browser.d.B8ZWo0aT.d.ts} +1 -1
  6. package/dist/chunks/{cac.C4jjt2RX.js → cac.B3UKR5lX.js} +273 -127
  7. package/dist/chunks/{cli-api.ChbI1JU9.js → cli-api.BFaocysU.js} +9261 -8430
  8. package/dist/chunks/{config.d.Cr1Ep39N.d.ts → config.d.BAKb_cTu.d.ts} +16 -4
  9. package/dist/chunks/{constants.B63TT-Bl.js → constants.CPYnjOGj.js} +3 -1
  10. package/dist/chunks/{coverage.tyqbzn4W.js → coverage.B8UAoQGx.js} +46 -7
  11. package/dist/chunks/{creator.yyCHuw5R.js → creator.DgVhQm5q.js} +3 -3
  12. package/dist/chunks/{defaults.BOqNVLsY.js → defaults.BlJmGxXD.js} +2 -1
  13. package/dist/chunks/{global.d.JeWMqlOm.d.ts → global.d.x-ILCfAE.d.ts} +1 -2
  14. package/dist/chunks/{globals.C6Ecf1TO.js → globals.BSO_gjS1.js} +3 -3
  15. package/dist/chunks/{index.CouFDptX.js → index.C39wbgWx.js} +4 -2
  16. package/dist/chunks/{index.D3XRDfWc.js → index.CMESou6r.js} +26 -1
  17. package/dist/chunks/{index.B-iBE_Gx.js → index.CoafDRze.js} +2255 -2197
  18. package/dist/chunks/{index.CAN630q3.js → index.DmJHrI1k.js} +77 -3
  19. package/dist/chunks/{index.CFulQRmC.js → index._gmCCuHk.js} +1 -1
  20. package/dist/chunks/{index.D4KonVSU.js → index.og1WyBLx.js} +18 -3
  21. package/dist/chunks/{plugin.d.C9o5bttz.d.ts → plugin.d.D1im4ulu.d.ts} +1 -1
  22. package/dist/chunks/{reporters.d.7faYdkxy.d.ts → reporters.d.DFKgJkZE.d.ts} +110 -23
  23. package/dist/chunks/{rpc.d.CM7x9-sm.d.ts → rpc.d.BFMWpdph.d.ts} +9 -2
  24. package/dist/chunks/{setup-common.cvFp-ao9.js → setup-common.Bafp3r-q.js} +2 -2
  25. package/dist/chunks/{suite.d.BJWk38HB.d.ts → suite.d.udJtyAgw.d.ts} +1 -1
  26. package/dist/chunks/{test.G82XYNFk.js → test.EDIwt4Yp.js} +25 -68
  27. package/dist/chunks/{vm.BdLtzhnj.js → vm.CMbtLg78.js} +1 -1
  28. package/dist/chunks/{worker.d.CPzI2ZzJ.d.ts → worker.d.KWMdtGFQ.d.ts} +2 -2
  29. package/dist/cli.js +4 -4
  30. package/dist/config.cjs +2 -1
  31. package/dist/config.d.ts +9 -8
  32. package/dist/config.js +2 -2
  33. package/dist/coverage.d.ts +5 -5
  34. package/dist/coverage.js +3 -3
  35. package/dist/index.d.ts +46 -14
  36. package/dist/index.js +3 -3
  37. package/dist/module-evaluator.d.ts +2 -1
  38. package/dist/module-evaluator.js +36 -26
  39. package/dist/node.d.ts +24 -11
  40. package/dist/node.js +24 -25
  41. package/dist/reporters.d.ts +5 -5
  42. package/dist/reporters.js +3 -3
  43. package/dist/runners.d.ts +2 -3
  44. package/dist/runners.js +1 -1
  45. package/dist/suite.d.ts +1 -1
  46. package/dist/worker.d.ts +3 -3
  47. package/dist/worker.js +6 -5
  48. package/dist/workers/forks.js +6 -5
  49. package/dist/workers/runVmTests.js +11 -7
  50. package/dist/workers/threads.js +6 -5
  51. package/dist/workers/vmForks.js +1 -1
  52. package/dist/workers/vmThreads.js +1 -1
  53. package/globals.d.ts +2 -0
  54. package/package.json +24 -17
package/LICENSE.md CHANGED
@@ -316,6 +316,37 @@ 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
+
319
350
  ## empathic
320
351
  License: MIT
321
352
  By: Luke Edwards
@@ -363,7 +394,7 @@ Repository: lydell/js-tokens
363
394
 
364
395
  > The MIT License (MIT)
365
396
  >
366
- > Copyright (c) 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024 Simon Lydell
397
+ > Copyright (c) 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Simon Lydell
367
398
  >
368
399
  > Permission is hereby granted, free of charge, to any person obtaining a copy
369
400
  > of this software and associated documentation files (the "Software"), to deal
@@ -645,6 +676,90 @@ Repository: git+https://github.com/antfu/strip-literal.git
645
676
 
646
677
  ---------------------------------------
647
678
 
679
+ ## tinyhighlight
680
+ License: MIT
681
+ Repository: git+https://github.com/tinylibs/tinyhighlight.git
682
+
683
+ > # Tinyhighlight core license
684
+ >
685
+ > MIT License
686
+ >
687
+ > Copyright (c) 2023 Tinylibs
688
+ >
689
+ > Permission is hereby granted, free of charge, to any person obtaining a copy
690
+ > of this software and associated documentation files (the "Software"), to deal
691
+ > in the Software without restriction, including without limitation the rights
692
+ > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
693
+ > copies of the Software, and to permit persons to whom the Software is
694
+ > furnished to do so, subject to the following conditions:
695
+ >
696
+ > The above copyright notice and this permission notice shall be included in all
697
+ > copies or substantial portions of the Software.
698
+ >
699
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
700
+ > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
701
+ > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
702
+ > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
703
+ > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
704
+ > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
705
+ > SOFTWARE.
706
+ >
707
+ > # Additionaly Tinyhighlight modifies code with the following licenses:
708
+ >
709
+ > MIT
710
+ >
711
+ > ## @babel/highlight
712
+ >
713
+ > MIT License
714
+ >
715
+ > Copyright (c) 2014-present Sebastian McKenzie and other contributors
716
+ >
717
+ > Permission is hereby granted, free of charge, to any person obtaining
718
+ > a copy of this software and associated documentation files (the
719
+ > "Software"), to deal in the Software without restriction, including
720
+ > without limitation the rights to use, copy, modify, merge, publish,
721
+ > distribute, sublicense, and/or sell copies of the Software, and to
722
+ > permit persons to whom the Software is furnished to do so, subject to
723
+ > the following conditions:
724
+ >
725
+ > The above copyright notice and this permission notice shall be
726
+ > included in all copies or substantial portions of the Software.
727
+ >
728
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
729
+ > EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
730
+ > MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
731
+ > NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
732
+ > LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
733
+ > OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
734
+ > WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
735
+ >
736
+ > ## @babel/helper-validator-identifier
737
+ >
738
+ > MIT License
739
+ >
740
+ > Copyright (c) 2014-present Sebastian McKenzie and other contributors
741
+ >
742
+ > Permission is hereby granted, free of charge, to any person obtaining
743
+ > a copy of this software and associated documentation files (the
744
+ > "Software"), to deal in the Software without restriction, including
745
+ > without limitation the rights to use, copy, modify, merge, publish,
746
+ > distribute, sublicense, and/or sell copies of the Software, and to
747
+ > permit persons to whom the Software is furnished to do so, subject to
748
+ > the following conditions:
749
+ >
750
+ > The above copyright notice and this permission notice shall be
751
+ > included in all copies or substantial portions of the Software.
752
+ >
753
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
754
+ > EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
755
+ > MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
756
+ > NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
757
+ > LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
758
+ > OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
759
+ > WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
760
+
761
+ ---------------------------------------
762
+
648
763
  ## type-detect
649
764
  License: MIT
650
765
  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,4 +1,4 @@
1
- import { a as SerializedCoverageConfig, S as SerializedConfig } from './chunks/config.d.Cr1Ep39N.js';
1
+ import { a as SerializedCoverageConfig, S as SerializedConfig } from './chunks/config.d.BAKb_cTu.js';
2
2
  import { R as RuntimeCoverageModuleLoader } from './chunks/coverage.d.BZtK59WP.js';
3
3
  import { SerializedDiffOptions } from '@vitest/utils/diff';
4
4
  export { O as OTELCarrier, T as Traces } from './chunks/traces.d.402V_yFI.js';
package/dist/browser.js CHANGED
@@ -1,4 +1,4 @@
1
- export { l as loadDiffConfig, b as loadSnapshotSerializers, c as setupCommonEnv, s as startCoverageInsideWorker, a as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/setup-common.cvFp-ao9.js';
1
+ export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv, b as startCoverageInsideWorker, c as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/setup-common.Bafp3r-q.js';
2
2
  export { T as Traces } from './chunks/traces.CCmnQaNT.js';
3
3
  export { collectTests, startTests } from '@vitest/runner';
4
4
  import * as spyModule from '@vitest/spy';
@@ -1,6 +1,6 @@
1
1
  import { runInThisContext } from 'node:vm';
2
2
  import * as spyModule from '@vitest/spy';
3
- import { r as resolveTestRunner, a as resolveSnapshotEnvironment, s as setupChaiConfig } from './index.CAN630q3.js';
3
+ import { r as resolveTestRunner, a as resolveSnapshotEnvironment, d as detectAsyncLeaks, s as setupChaiConfig } from './index.DmJHrI1k.js';
4
4
  import { l as loadEnvironment, e as emitModuleRunner, a as listenForErrors } from './init.B95Mm0Iz.js';
5
5
  import { N as NativeModuleRunner } from './nativeModuleRunner.BIakptoF.js';
6
6
  import { T as Traces } from './traces.CCmnQaNT.js';
@@ -8,15 +8,15 @@ import { V as VitestEvaluatedModules } from './evaluatedModules.Dg1zASAC.js';
8
8
  import { s as startVitestModuleRunner, c as createNodeImportMeta } from './startVitestModuleRunner.BK-u7y4N.js';
9
9
  import { performance as performance$1 } from 'node:perf_hooks';
10
10
  import { startTests, collectTests } from '@vitest/runner';
11
- import { c as setupCommonEnv, s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './setup-common.cvFp-ao9.js';
12
- import { g as globalExpect, v as vi } from './test.G82XYNFk.js';
11
+ import { s as setupCommonEnv, b as startCoverageInsideWorker, c as stopCoverageInsideWorker } from './setup-common.Bafp3r-q.js';
12
+ import { g as globalExpect, v as vi } from './test.EDIwt4Yp.js';
13
13
  import { c as closeInspector } from './inspector.CvyFGlXm.js';
14
14
  import { createRequire } from 'node:module';
15
15
  import timers from 'node:timers';
16
16
  import timersPromises from 'node:timers/promises';
17
17
  import util from 'node:util';
18
18
  import { KNOWN_ASSET_TYPES } from '@vitest/utils/constants';
19
- import { i as index } from './index.CouFDptX.js';
19
+ import { i as index } from './index.C39wbgWx.js';
20
20
  import { g as getWorkerState, r as resetModules, p as provideWorkerState, a as getSafeWorkerState } from './utils.DT4VyRyl.js';
21
21
 
22
22
  // this should only be used in Node
@@ -85,8 +85,12 @@ async function run(method, files, config, moduleRunner, environment, traces) {
85
85
  resetModules(workerState.evaluatedModules, true);
86
86
  }
87
87
  workerState.filepath = file.filepath;
88
- if (method === "run") await traces.$(`vitest.test.runner.${method}.module`, { attributes: { "code.file.path": file.filepath } }, () => startTests([file], testRunner));
89
- else await traces.$(`vitest.test.runner.${method}.module`, { attributes: { "code.file.path": file.filepath } }, () => collectTests([file], testRunner));
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 } }, () => collectTests([file], testRunner));
90
94
  // reset after tests, because user might call `vi.setConfig` in setupFile
91
95
  vi.resetConfig();
92
96
  // mocks should not affect different files
@@ -1,6 +1,6 @@
1
1
  import { FileSpecification } from '@vitest/runner';
2
2
  import { O as OTELCarrier } from './traces.d.402V_yFI.js';
3
- import { T as TestExecutionMethod } from './worker.d.CPzI2ZzJ.js';
3
+ import { T as TestExecutionMethod } from './worker.d.KWMdtGFQ.js';
4
4
 
5
5
  type SerializedTestSpecification = [project: {
6
6
  name: string | undefined;