vitest 0.29.8 → 0.30.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 (57) hide show
  1. package/LICENSE.md +372 -451
  2. package/dist/browser.d.ts +5 -3
  3. package/dist/browser.js +5 -6
  4. package/dist/child.js +12 -16
  5. package/dist/{chunk-api-setup.3aabe9ac.js → chunk-api-setup.c93e5069.js} +58 -51
  6. package/dist/{chunk-install-pkg.6aa7cf6d.js → chunk-install-pkg.ee5cc9a8.js} +32 -32
  7. package/dist/chunk-integrations-globals.d419838f.js +26 -0
  8. package/dist/{chunk-node-git.ed5bded8.js → chunk-node-git.4c43bd73.js} +4 -2
  9. package/dist/cli-wrapper.js +6 -5
  10. package/dist/cli.js +26 -26
  11. package/dist/config.cjs +15 -2
  12. package/dist/config.d.ts +18 -4
  13. package/dist/config.js +10 -1
  14. package/dist/coverage.d.ts +5 -2
  15. package/dist/coverage.js +6 -0
  16. package/dist/entry.js +35 -34
  17. package/dist/environments.d.ts +5 -2
  18. package/dist/environments.js +1 -1
  19. package/dist/index.d.ts +11 -10
  20. package/dist/index.js +9 -11
  21. package/dist/loader.js +396 -13
  22. package/dist/node.d.ts +9 -7
  23. package/dist/node.js +27 -30
  24. package/dist/runners.d.ts +5 -2
  25. package/dist/runners.js +35 -31
  26. package/dist/{types-94cfe4b4.d.ts → types-e3c9754d.d.ts} +224 -305
  27. package/dist/{chunk-node-pkg.30d8b37e.js → vendor-cli-api.70680cd5.js} +3849 -3330
  28. package/dist/vendor-constants.538d9b49.js +54 -0
  29. package/dist/{chunk-runtime-mocker.3283818a.js → vendor-execute.70609f6f.js} +9 -12
  30. package/dist/{chunk-env-node.affdd278.js → vendor-index.75f2b63d.js} +9 -2
  31. package/dist/vendor-index.7dcbfa46.js +167 -0
  32. package/dist/{chunk-integrations-utils.23c19408.js → vendor-index.81b9e499.js} +22 -21
  33. package/dist/{vendor-index.2cbcdd1e.js → vendor-index.c1e09929.js} +458 -373
  34. package/dist/vendor-index.fad2598b.js +44 -0
  35. package/dist/{vendor-index.534e612c.js → vendor-index.fc98d30f.js} +2 -2
  36. package/dist/{chunk-runtime-inspector.b1427a10.js → vendor-inspector.47fc8cbb.js} +5 -2
  37. package/dist/{chunk-runtime-rpc.d6aa57f8.js → vendor-rpc.4d3d7a54.js} +5 -5
  38. package/dist/{chunk-integrations-run-once.ea614f17.js → vendor-run-once.69ce7172.js} +3 -3
  39. package/dist/{chunk-runtime-setup.5d504677.js → vendor-setup.common.cef38f4e.js} +2 -2
  40. package/dist/vendor-tasks.042d6084.js +14 -0
  41. package/dist/{chunk-utils-import.e488ace3.js → vendor-vi.a3ff54b1.js} +73 -2957
  42. package/dist/worker.js +14 -18
  43. package/package.json +29 -34
  44. package/dist/chunk-constants.bc18a549.js +0 -36
  45. package/dist/chunk-integrations-globals.49802775.js +0 -28
  46. package/dist/chunk-snapshot-env.a347d647.js +0 -11
  47. package/dist/chunk-utils-base.b5ddfcc9.js +0 -91
  48. package/dist/chunk-utils-env.6b856dbf.js +0 -64
  49. package/dist/chunk-utils-tasks.8781fd71.js +0 -107
  50. package/dist/env-afee91f0.d.ts +0 -10
  51. package/dist/vendor-index.783e7f3e.js +0 -71
  52. package/dist/vendor-index.bdee400f.js +0 -396
  53. package/dist/vendor-magic-string.es.b3bc5745.js +0 -1591
  54. /package/dist/{vendor-_commonjsHelpers.addc3445.js → vendor-_commonjsHelpers.76cdd49e.js} +0 -0
  55. /package/dist/{chunk-integrations-coverage.d93ee824.js → vendor-coverage.a585b712.js} +0 -0
  56. /package/dist/{chunk-utils-global.fd174983.js → vendor-global.6795f91f.js} +0 -0
  57. /package/dist/{chunk-paths.e36446b4.js → vendor-paths.84fc7a99.js} +0 -0
package/dist/browser.d.ts CHANGED
@@ -1,18 +1,20 @@
1
1
  export { startTests } from '@vitest/runner';
2
- import { a as ResolvedConfig, a0 as CoverageOptions, Y as CoverageProvider, _ as CoverageProviderModule } from './types-94cfe4b4.js';
3
- export { s as setupSnapshotEnvironment } from './env-afee91f0.js';
2
+ import { a as ResolvedConfig, _ as CoverageOptions, S as CoverageProvider, Y as CoverageProviderModule } from './types-e3c9754d.js';
4
3
  import '@vitest/expect';
4
+ import '@vitest/snapshot';
5
5
  import 'vite';
6
6
  import '@vitest/runner/types';
7
7
  import '@vitest/runner/utils';
8
8
  import '@vitest/utils';
9
9
  import 'tinybench';
10
10
  import 'vite-node/client';
11
+ import '@vitest/snapshot/manager';
11
12
  import 'node:worker_threads';
12
13
  import 'vite-node';
13
14
  import 'source-map';
14
- import 'node:fs';
15
15
  import 'vite-node/server';
16
+ import 'node:fs';
17
+ import 'chai';
16
18
 
17
19
  declare function setupCommonEnv(config: ResolvedConfig): Promise<void>;
18
20
 
package/dist/browser.js CHANGED
@@ -1,11 +1,10 @@
1
1
  export { startTests } from '@vitest/runner';
2
- export { s as setupCommonEnv } from './chunk-runtime-setup.5d504677.js';
3
- export { s as setupSnapshotEnvironment } from './chunk-snapshot-env.a347d647.js';
4
- export { g as getCoverageProvider, a as startCoverageInsideWorker, s as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunk-integrations-coverage.d93ee824.js';
2
+ export { s as setupCommonEnv } from './vendor-setup.common.cef38f4e.js';
3
+ export { g as getCoverageProvider, a as startCoverageInsideWorker, s as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './vendor-coverage.a585b712.js';
5
4
  import '@vitest/utils';
6
- import './chunk-integrations-run-once.ea614f17.js';
7
- import './chunk-utils-env.6b856dbf.js';
5
+ import './vendor-run-once.69ce7172.js';
6
+ import './vendor-index.fad2598b.js';
8
7
  import 'pathe';
9
8
  import 'std-env';
10
9
  import '@vitest/runner/utils';
11
- import './chunk-utils-global.fd174983.js';
10
+ import './vendor-global.6795f91f.js';
package/dist/child.js CHANGED
@@ -1,27 +1,19 @@
1
1
  import v8 from 'node:v8';
2
- import { c as createBirpc } from './vendor-index.783e7f3e.js';
2
+ import { c as createBirpc } from './vendor-index.7dcbfa46.js';
3
3
  import { parseRegexp } from '@vitest/utils';
4
- import { s as startViteNode, m as moduleCache, a as mockMap } from './chunk-runtime-mocker.3283818a.js';
5
- import { a as rpcDone } from './chunk-runtime-rpc.d6aa57f8.js';
6
- import { s as setupInspect } from './chunk-runtime-inspector.b1427a10.js';
4
+ import { s as startViteNode, m as moduleCache, a as mockMap } from './vendor-execute.70609f6f.js';
5
+ import { a as rpcDone } from './vendor-rpc.4d3d7a54.js';
6
+ import { s as setupInspect } from './vendor-inspector.47fc8cbb.js';
7
7
  import 'node:url';
8
8
  import 'vite-node/client';
9
9
  import 'vite-node/utils';
10
10
  import 'pathe';
11
- import './vendor-index.bdee400f.js';
12
- import 'acorn';
13
- import 'node:module';
14
- import 'node:fs';
15
- import 'node:assert';
16
- import 'node:process';
17
- import 'node:path';
18
- import 'node:util';
19
11
  import '@vitest/runner/utils';
20
- import './chunk-utils-global.fd174983.js';
21
- import './chunk-paths.e36446b4.js';
22
- import './chunk-utils-base.b5ddfcc9.js';
12
+ import './vendor-global.6795f91f.js';
13
+ import './vendor-paths.84fc7a99.js';
14
+ import 'node:fs';
23
15
  import '@vitest/spy';
24
- import 'node:inspector';
16
+ import 'node:module';
25
17
 
26
18
  function init(ctx) {
27
19
  const { config } = ctx;
@@ -33,6 +25,10 @@ function init(ctx) {
33
25
  moduleCache,
34
26
  config,
35
27
  mockMap,
28
+ durations: {
29
+ environment: 0,
30
+ prepare: performance.now()
31
+ },
36
32
  rpc: createBirpc(
37
33
  {},
38
34
  {
@@ -1,5 +1,6 @@
1
1
  import { promises, existsSync } from 'node:fs';
2
- import { c as createBirpc } from './vendor-index.783e7f3e.js';
2
+ import { dirname } from 'pathe';
3
+ import { c as createBirpc, i as isPrimitive } from './vendor-index.7dcbfa46.js';
3
4
  import require$$0$2 from 'stream';
4
5
  import require$$0 from 'zlib';
5
6
  import require$$0$1 from 'buffer';
@@ -10,18 +11,14 @@ import require$$2 from 'events';
10
11
  import require$$1 from 'https';
11
12
  import require$$2$1 from 'http';
12
13
  import require$$7 from 'url';
13
- import { A as API_PATH } from './chunk-constants.bc18a549.js';
14
- import './chunk-utils-env.6b856dbf.js';
15
- import { a as parseErrorStacktrace } from './chunk-utils-tasks.8781fd71.js';
16
- import { a as isPrimitive } from './chunk-utils-base.b5ddfcc9.js';
17
- import 'pathe';
14
+ import { A as API_PATH } from './vendor-constants.538d9b49.js';
15
+ import './vendor-index.fad2598b.js';
16
+ import { parseErrorStacktrace } from '@vitest/utils';
18
17
  import 'std-env';
19
18
  import '@vitest/runner/utils';
20
- import './chunk-utils-global.fd174983.js';
21
- import '@vitest/utils';
19
+ import './vendor-global.6795f91f.js';
22
20
 
23
21
  async function getModuleGraph(ctx, id) {
24
- var _a;
25
22
  const graph = {};
26
23
  const externalized = /* @__PURE__ */ new Set();
27
24
  const inlined = /* @__PURE__ */ new Set();
@@ -47,7 +44,7 @@ async function getModuleGraph(ctx, id) {
47
44
  graph[id2] = (await Promise.all(mods.map((m) => get(m, seen)))).filter(Boolean);
48
45
  return id2;
49
46
  }
50
- await get(ctx.server.moduleGraph.getModuleById(id) || ((_a = ctx.browser) == null ? void 0 : _a.moduleGraph.getModuleById(id)));
47
+ await get(ctx.server.moduleGraph.getModuleById(id));
51
48
  return {
52
49
  graph,
53
50
  externalized: Array.from(externalized),
@@ -300,7 +297,7 @@ const kRun = Symbol('kRun');
300
297
  * A very simple job queue with adjustable concurrency. Adapted from
301
298
  * https://github.com/STRML/async-limiter
302
299
  */
303
- class Limiter$1 {
300
+ let Limiter$1 = class Limiter {
304
301
  /**
305
302
  * Creates a new `Limiter`.
306
303
  *
@@ -343,7 +340,7 @@ class Limiter$1 {
343
340
  job(this[kDone]);
344
341
  }
345
342
  }
346
- }
343
+ };
347
344
 
348
345
  var limiter = Limiter$1;
349
346
 
@@ -373,7 +370,7 @@ let zlibLimiter;
373
370
  /**
374
371
  * permessage-deflate implementation.
375
372
  */
376
- class PerMessageDeflate$4 {
373
+ let PerMessageDeflate$4 = class PerMessageDeflate {
377
374
  /**
378
375
  * Creates a PerMessageDeflate instance.
379
376
  *
@@ -805,7 +802,7 @@ class PerMessageDeflate$4 {
805
802
  callback(null, data);
806
803
  });
807
804
  }
808
- }
805
+ };
809
806
 
810
807
  var permessageDeflate = PerMessageDeflate$4;
811
808
 
@@ -1018,7 +1015,7 @@ const INFLATING = 5;
1018
1015
  *
1019
1016
  * @extends Writable
1020
1017
  */
1021
- class Receiver$1 extends Writable {
1018
+ let Receiver$1 = class Receiver extends Writable {
1022
1019
  /**
1023
1020
  * Creates a Receiver instance.
1024
1021
  *
@@ -1592,7 +1589,7 @@ class Receiver$1 extends Writable {
1592
1589
 
1593
1590
  this._state = GET_INFO;
1594
1591
  }
1595
- }
1592
+ };
1596
1593
 
1597
1594
  var receiver = Receiver$1;
1598
1595
 
@@ -1633,7 +1630,7 @@ const maskBuffer = Buffer.alloc(4);
1633
1630
  /**
1634
1631
  * HyBi Sender implementation.
1635
1632
  */
1636
- class Sender$1 {
1633
+ let Sender$1 = class Sender {
1637
1634
  /**
1638
1635
  * Creates a Sender instance.
1639
1636
  *
@@ -1810,7 +1807,7 @@ class Sender$1 {
1810
1807
  if (this._deflating) {
1811
1808
  this.enqueue([this.dispatch, buf, false, options, cb]);
1812
1809
  } else {
1813
- this.sendFrame(Sender$1.frame(buf, options), cb);
1810
+ this.sendFrame(Sender.frame(buf, options), cb);
1814
1811
  }
1815
1812
  }
1816
1813
 
@@ -1853,7 +1850,7 @@ class Sender$1 {
1853
1850
  if (this._deflating) {
1854
1851
  this.enqueue([this.dispatch, data, false, options, cb]);
1855
1852
  } else {
1856
- this.sendFrame(Sender$1.frame(data, options), cb);
1853
+ this.sendFrame(Sender.frame(data, options), cb);
1857
1854
  }
1858
1855
  }
1859
1856
 
@@ -1896,7 +1893,7 @@ class Sender$1 {
1896
1893
  if (this._deflating) {
1897
1894
  this.enqueue([this.dispatch, data, false, options, cb]);
1898
1895
  } else {
1899
- this.sendFrame(Sender$1.frame(data, options), cb);
1896
+ this.sendFrame(Sender.frame(data, options), cb);
1900
1897
  }
1901
1898
  }
1902
1899
 
@@ -1973,7 +1970,7 @@ class Sender$1 {
1973
1970
  }
1974
1971
  } else {
1975
1972
  this.sendFrame(
1976
- Sender$1.frame(data, {
1973
+ Sender.frame(data, {
1977
1974
  [kByteLength]: byteLength,
1978
1975
  fin: options.fin,
1979
1976
  generateMask: this._generateMask,
@@ -2013,7 +2010,7 @@ class Sender$1 {
2013
2010
  */
2014
2011
  dispatch(data, compress, options, cb) {
2015
2012
  if (!compress) {
2016
- this.sendFrame(Sender$1.frame(data, options), cb);
2013
+ this.sendFrame(Sender.frame(data, options), cb);
2017
2014
  return;
2018
2015
  }
2019
2016
 
@@ -2042,7 +2039,7 @@ class Sender$1 {
2042
2039
  this._bufferedBytes -= options[kByteLength];
2043
2040
  this._deflating = false;
2044
2041
  options.readOnly = false;
2045
- this.sendFrame(Sender$1.frame(buf, options), cb);
2042
+ this.sendFrame(Sender.frame(buf, options), cb);
2046
2043
  this.dequeue();
2047
2044
  });
2048
2045
  }
@@ -2089,7 +2086,7 @@ class Sender$1 {
2089
2086
  this._socket.write(list[0], cb);
2090
2087
  }
2091
2088
  }
2092
- }
2089
+ };
2093
2090
 
2094
2091
  var sender = Sender$1;
2095
2092
 
@@ -2626,7 +2623,7 @@ const subprotocolRegex = /^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;
2626
2623
  *
2627
2624
  * @extends EventEmitter
2628
2625
  */
2629
- class WebSocket$1 extends EventEmitter$1 {
2626
+ let WebSocket$1 = class WebSocket extends EventEmitter$1 {
2630
2627
  /**
2631
2628
  * Create a new `WebSocket`.
2632
2629
  *
@@ -2646,7 +2643,7 @@ class WebSocket$1 extends EventEmitter$1 {
2646
2643
  this._extensions = {};
2647
2644
  this._paused = false;
2648
2645
  this._protocol = '';
2649
- this._readyState = WebSocket$1.CONNECTING;
2646
+ this._readyState = WebSocket.CONNECTING;
2650
2647
  this._receiver = null;
2651
2648
  this._sender = null;
2652
2649
  this._socket = null;
@@ -2818,7 +2815,7 @@ class WebSocket$1 extends EventEmitter$1 {
2818
2815
  socket.on('end', socketOnEnd);
2819
2816
  socket.on('error', socketOnError$1);
2820
2817
 
2821
- this._readyState = WebSocket$1.OPEN;
2818
+ this._readyState = WebSocket.OPEN;
2822
2819
  this.emit('open');
2823
2820
  }
2824
2821
 
@@ -2829,7 +2826,7 @@ class WebSocket$1 extends EventEmitter$1 {
2829
2826
  */
2830
2827
  emitClose() {
2831
2828
  if (!this._socket) {
2832
- this._readyState = WebSocket$1.CLOSED;
2829
+ this._readyState = WebSocket.CLOSED;
2833
2830
  this.emit('close', this._closeCode, this._closeMessage);
2834
2831
  return;
2835
2832
  }
@@ -2839,7 +2836,7 @@ class WebSocket$1 extends EventEmitter$1 {
2839
2836
  }
2840
2837
 
2841
2838
  this._receiver.removeAllListeners();
2842
- this._readyState = WebSocket$1.CLOSED;
2839
+ this._readyState = WebSocket.CLOSED;
2843
2840
  this.emit('close', this._closeCode, this._closeMessage);
2844
2841
  }
2845
2842
 
@@ -2864,14 +2861,14 @@ class WebSocket$1 extends EventEmitter$1 {
2864
2861
  * @public
2865
2862
  */
2866
2863
  close(code, data) {
2867
- if (this.readyState === WebSocket$1.CLOSED) return;
2868
- if (this.readyState === WebSocket$1.CONNECTING) {
2864
+ if (this.readyState === WebSocket.CLOSED) return;
2865
+ if (this.readyState === WebSocket.CONNECTING) {
2869
2866
  const msg = 'WebSocket was closed before the connection was established';
2870
2867
  abortHandshake$1(this, this._req, msg);
2871
2868
  return;
2872
2869
  }
2873
2870
 
2874
- if (this.readyState === WebSocket$1.CLOSING) {
2871
+ if (this.readyState === WebSocket.CLOSING) {
2875
2872
  if (
2876
2873
  this._closeFrameSent &&
2877
2874
  (this._closeFrameReceived || this._receiver._writableState.errorEmitted)
@@ -2882,7 +2879,7 @@ class WebSocket$1 extends EventEmitter$1 {
2882
2879
  return;
2883
2880
  }
2884
2881
 
2885
- this._readyState = WebSocket$1.CLOSING;
2882
+ this._readyState = WebSocket.CLOSING;
2886
2883
  this._sender.close(code, data, !this._isServer, (err) => {
2887
2884
  //
2888
2885
  // This error is handled by the `'error'` listener on the socket. We only
@@ -2916,8 +2913,8 @@ class WebSocket$1 extends EventEmitter$1 {
2916
2913
  */
2917
2914
  pause() {
2918
2915
  if (
2919
- this.readyState === WebSocket$1.CONNECTING ||
2920
- this.readyState === WebSocket$1.CLOSED
2916
+ this.readyState === WebSocket.CONNECTING ||
2917
+ this.readyState === WebSocket.CLOSED
2921
2918
  ) {
2922
2919
  return;
2923
2920
  }
@@ -2935,7 +2932,7 @@ class WebSocket$1 extends EventEmitter$1 {
2935
2932
  * @public
2936
2933
  */
2937
2934
  ping(data, mask, cb) {
2938
- if (this.readyState === WebSocket$1.CONNECTING) {
2935
+ if (this.readyState === WebSocket.CONNECTING) {
2939
2936
  throw new Error('WebSocket is not open: readyState 0 (CONNECTING)');
2940
2937
  }
2941
2938
 
@@ -2949,7 +2946,7 @@ class WebSocket$1 extends EventEmitter$1 {
2949
2946
 
2950
2947
  if (typeof data === 'number') data = data.toString();
2951
2948
 
2952
- if (this.readyState !== WebSocket$1.OPEN) {
2949
+ if (this.readyState !== WebSocket.OPEN) {
2953
2950
  sendAfterClose(this, data, cb);
2954
2951
  return;
2955
2952
  }
@@ -2967,7 +2964,7 @@ class WebSocket$1 extends EventEmitter$1 {
2967
2964
  * @public
2968
2965
  */
2969
2966
  pong(data, mask, cb) {
2970
- if (this.readyState === WebSocket$1.CONNECTING) {
2967
+ if (this.readyState === WebSocket.CONNECTING) {
2971
2968
  throw new Error('WebSocket is not open: readyState 0 (CONNECTING)');
2972
2969
  }
2973
2970
 
@@ -2981,7 +2978,7 @@ class WebSocket$1 extends EventEmitter$1 {
2981
2978
 
2982
2979
  if (typeof data === 'number') data = data.toString();
2983
2980
 
2984
- if (this.readyState !== WebSocket$1.OPEN) {
2981
+ if (this.readyState !== WebSocket.OPEN) {
2985
2982
  sendAfterClose(this, data, cb);
2986
2983
  return;
2987
2984
  }
@@ -2997,8 +2994,8 @@ class WebSocket$1 extends EventEmitter$1 {
2997
2994
  */
2998
2995
  resume() {
2999
2996
  if (
3000
- this.readyState === WebSocket$1.CONNECTING ||
3001
- this.readyState === WebSocket$1.CLOSED
2997
+ this.readyState === WebSocket.CONNECTING ||
2998
+ this.readyState === WebSocket.CLOSED
3002
2999
  ) {
3003
3000
  return;
3004
3001
  }
@@ -3023,7 +3020,7 @@ class WebSocket$1 extends EventEmitter$1 {
3023
3020
  * @public
3024
3021
  */
3025
3022
  send(data, options, cb) {
3026
- if (this.readyState === WebSocket$1.CONNECTING) {
3023
+ if (this.readyState === WebSocket.CONNECTING) {
3027
3024
  throw new Error('WebSocket is not open: readyState 0 (CONNECTING)');
3028
3025
  }
3029
3026
 
@@ -3034,7 +3031,7 @@ class WebSocket$1 extends EventEmitter$1 {
3034
3031
 
3035
3032
  if (typeof data === 'number') data = data.toString();
3036
3033
 
3037
- if (this.readyState !== WebSocket$1.OPEN) {
3034
+ if (this.readyState !== WebSocket.OPEN) {
3038
3035
  sendAfterClose(this, data, cb);
3039
3036
  return;
3040
3037
  }
@@ -3060,19 +3057,19 @@ class WebSocket$1 extends EventEmitter$1 {
3060
3057
  * @public
3061
3058
  */
3062
3059
  terminate() {
3063
- if (this.readyState === WebSocket$1.CLOSED) return;
3064
- if (this.readyState === WebSocket$1.CONNECTING) {
3060
+ if (this.readyState === WebSocket.CLOSED) return;
3061
+ if (this.readyState === WebSocket.CONNECTING) {
3065
3062
  const msg = 'WebSocket was closed before the connection was established';
3066
3063
  abortHandshake$1(this, this._req, msg);
3067
3064
  return;
3068
3065
  }
3069
3066
 
3070
3067
  if (this._socket) {
3071
- this._readyState = WebSocket$1.CLOSING;
3068
+ this._readyState = WebSocket.CLOSING;
3072
3069
  this._socket.destroy();
3073
3070
  }
3074
3071
  }
3075
- }
3072
+ };
3076
3073
 
3077
3074
  /**
3078
3075
  * @constant {Number} CONNECTING
@@ -3574,7 +3571,11 @@ function initAsClient(websocket, address, protocols, options) {
3574
3571
  });
3575
3572
  });
3576
3573
 
3577
- req.end();
3574
+ if (opts.finishRequest) {
3575
+ opts.finishRequest(req, websocket);
3576
+ } else {
3577
+ req.end();
3578
+ }
3578
3579
  }
3579
3580
 
3580
3581
  /**
@@ -4483,8 +4484,9 @@ function abortHandshakeOrEmitwsClientError(server, req, socket, code, message) {
4483
4484
  }
4484
4485
  }
4485
4486
 
4486
- function setup(ctx, server) {
4487
+ function setup(vitestOrWorkspace, server) {
4487
4488
  var _a;
4489
+ const ctx = "ctx" in vitestOrWorkspace ? vitestOrWorkspace.ctx : vitestOrWorkspace;
4488
4490
  const wss = new websocketServer({ noServer: true });
4489
4491
  const clients = /* @__PURE__ */ new Map();
4490
4492
  (_a = (server || ctx.server).httpServer) == null ? void 0 : _a.on("upgrade", (request, socket, head) => {
@@ -4529,6 +4531,9 @@ function setup(ctx, server) {
4529
4531
  resolveSnapshotPath(testPath) {
4530
4532
  return ctx.snapshot.resolvePath(testPath);
4531
4533
  },
4534
+ resolveSnapshotRawPath(testPath, rawPath) {
4535
+ return ctx.snapshot.resolveRawPath(testPath, rawPath);
4536
+ },
4532
4537
  removeFile(id) {
4533
4538
  return promises.unlink(id);
4534
4539
  },
@@ -4543,8 +4548,10 @@ function setup(ctx, server) {
4543
4548
  snapshotSaved(snapshot) {
4544
4549
  ctx.snapshot.add(snapshot);
4545
4550
  },
4546
- writeFile(id, content) {
4547
- return promises.writeFile(id, content, "utf-8");
4551
+ async writeFile(id, content, ensureDir) {
4552
+ if (ensureDir)
4553
+ await promises.mkdir(dirname(id), { recursive: true });
4554
+ return await promises.writeFile(id, content, "utf-8");
4548
4555
  },
4549
4556
  async rerun(files) {
4550
4557
  await ctx.rerunFiles(files);
@@ -1,57 +1,57 @@
1
1
  import require$$0 from 'fs';
2
- import k from 'path';
2
+ import p from 'path';
3
3
  import require$$0$1 from 'util';
4
4
  import require$$0$3 from 'child_process';
5
- import { p as pathKey, s as signalExit, m as mergeStream$1, g as getStream$1, c as crossSpawn$1 } from './vendor-index.2cbcdd1e.js';
6
- import { o as onetime$1 } from './chunk-node-pkg.30d8b37e.js';
5
+ import { p as pathKey, s as signalExit, m as mergeStream$1, g as getStream$1, c as crossSpawn$1 } from './vendor-index.c1e09929.js';
6
+ import { o as onetime$1 } from './vendor-cli-api.70680cd5.js';
7
7
  import require$$0$2 from 'os';
8
8
  import 'node:buffer';
9
9
  import 'node:path';
10
10
  import 'node:child_process';
11
11
  import 'node:process';
12
- import './vendor-_commonjsHelpers.addc3445.js';
12
+ import './vendor-_commonjsHelpers.76cdd49e.js';
13
13
  import 'node:url';
14
14
  import 'node:os';
15
15
  import 'assert';
16
16
  import 'events';
17
+ import 'node:fs';
17
18
  import 'buffer';
18
19
  import 'stream';
20
+ import 'node:util';
19
21
  import 'pathe';
20
- import './chunk-constants.bc18a549.js';
21
- import './chunk-integrations-coverage.d93ee824.js';
22
- import './chunk-env-node.affdd278.js';
22
+ import './vendor-constants.538d9b49.js';
23
+ import './vendor-coverage.a585b712.js';
24
+ import './vendor-index.75f2b63d.js';
23
25
  import 'node:console';
24
26
  import 'local-pkg';
25
27
  import 'picocolors';
26
- import './chunk-utils-env.6b856dbf.js';
28
+ import './vendor-index.fad2598b.js';
27
29
  import 'std-env';
28
30
  import '@vitest/runner/utils';
29
- import './chunk-utils-global.fd174983.js';
30
31
  import '@vitest/utils';
32
+ import './vendor-global.6795f91f.js';
31
33
  import 'vite';
32
- import 'node:fs';
33
34
  import 'vite-node/utils';
34
35
  import 'vite-node/client';
35
- import 'node:fs/promises';
36
- import 'source-map';
37
- import 'module';
38
- import 'acorn';
39
- import 'acorn-walk';
40
- import './chunk-utils-base.b5ddfcc9.js';
41
- import 'crypto';
42
- import './chunk-paths.e36446b4.js';
36
+ import '@vitest/snapshot/manager';
37
+ import './vendor-paths.84fc7a99.js';
43
38
  import 'node:v8';
44
- import './vendor-index.783e7f3e.js';
39
+ import './vendor-index.7dcbfa46.js';
45
40
  import 'node:worker_threads';
46
41
  import 'tinypool';
47
- import 'perf_hooks';
48
- import './chunk-utils-tasks.8781fd71.js';
49
- import '@vitest/utils/diff';
50
- import 'vite-node/server';
51
- import './vendor-magic-string.es.b3bc5745.js';
42
+ import 'node:perf_hooks';
43
+ import './vendor-tasks.042d6084.js';
52
44
  import 'node:module';
53
45
  import 'node:crypto';
46
+ import 'node:fs/promises';
47
+ import 'source-map';
48
+ import 'module';
49
+ import 'acorn';
50
+ import 'acorn-walk';
51
+ import 'magic-string';
54
52
  import 'strip-literal';
53
+ import 'vite-node/server';
54
+ import 'node:readline';
55
55
  import 'readline';
56
56
 
57
57
  var findUp$1 = {exports: {}};
@@ -70,7 +70,7 @@ class Node {
70
70
  }
71
71
  }
72
72
 
73
- class Queue$1 {
73
+ let Queue$1 = class Queue {
74
74
  // TODO: Use private class fields when targeting Node.js 12.
75
75
  // #_head;
76
76
  // #_tail;
@@ -123,7 +123,7 @@ class Queue$1 {
123
123
  current = current.next;
124
124
  }
125
125
  }
126
- }
126
+ };
127
127
 
128
128
  var yoctoQueue = Queue$1;
129
129
 
@@ -248,7 +248,7 @@ const pLocate$1 = async (iterable, tester, options) => {
248
248
 
249
249
  var pLocate_1 = pLocate$1;
250
250
 
251
- const path$1 = k;
251
+ const path$1 = p;
252
252
  const fs$1 = require$$0;
253
253
  const {promisify: promisify$1} = require$$0$1;
254
254
  const pLocate = pLocate_1;
@@ -342,7 +342,7 @@ pathExists.exports.sync = path => {
342
342
  };
343
343
 
344
344
  (function (module) {
345
- const path = k;
345
+ const path = p;
346
346
  const locatePath$1 = locatePath.exports;
347
347
  const pathExists$1 = pathExists.exports;
348
348
 
@@ -454,7 +454,7 @@ var stripFinalNewline$1 = input => {
454
454
  var npmRunPath$1 = {exports: {}};
455
455
 
456
456
  (function (module) {
457
- const path = k;
457
+ const path = p;
458
458
  const pathKey$1 = pathKey.exports;
459
459
 
460
460
  const npmRunPath = options => {
@@ -1384,7 +1384,7 @@ var command = {
1384
1384
  parseCommand: parseCommand$1
1385
1385
  };
1386
1386
 
1387
- const path = k;
1387
+ const path = p;
1388
1388
  const childProcess = require$$0$3;
1389
1389
  const crossSpawn = crossSpawn$1.exports;
1390
1390
  const stripFinalNewline = stripFinalNewline$1;
@@ -1666,7 +1666,7 @@ async function detectPackageManager(cwd = process.cwd()) {
1666
1666
  const lockPath = await findUp(Object.keys(LOCKS), { cwd });
1667
1667
  let packageJsonPath;
1668
1668
  if (lockPath)
1669
- packageJsonPath = k.resolve(lockPath, "../package.json");
1669
+ packageJsonPath = p.resolve(lockPath, "../package.json");
1670
1670
  else
1671
1671
  packageJsonPath = await findUp("package.json", { cwd });
1672
1672
  if (packageJsonPath && require$$0.existsSync(packageJsonPath)) {
@@ -1687,7 +1687,7 @@ async function detectPackageManager(cwd = process.cwd()) {
1687
1687
  }
1688
1688
  }
1689
1689
  if (!agent && lockPath)
1690
- agent = LOCKS[k.basename(lockPath)];
1690
+ agent = LOCKS[p.basename(lockPath)];
1691
1691
  return agent;
1692
1692
  }
1693
1693
  async function installPackage(names, options = {}) {
@@ -0,0 +1,26 @@
1
+ import { g as globalApis } from './vendor-constants.538d9b49.js';
2
+ import { i as index } from './vendor-index.81b9e499.js';
3
+ import '@vitest/runner';
4
+ import './vendor-vi.a3ff54b1.js';
5
+ import '@vitest/runner/utils';
6
+ import '@vitest/utils';
7
+ import './vendor-index.fad2598b.js';
8
+ import 'pathe';
9
+ import 'std-env';
10
+ import './vendor-global.6795f91f.js';
11
+ import 'chai';
12
+ import './vendor-_commonjsHelpers.76cdd49e.js';
13
+ import '@vitest/expect';
14
+ import '@vitest/snapshot';
15
+ import './vendor-tasks.042d6084.js';
16
+ import 'util';
17
+ import '@vitest/spy';
18
+ import './vendor-run-once.69ce7172.js';
19
+
20
+ function registerApiGlobally() {
21
+ globalApis.forEach((api) => {
22
+ globalThis[api] = index[api];
23
+ });
24
+ }
25
+
26
+ export { registerApiGlobally };
@@ -1,20 +1,22 @@
1
1
  import { resolve } from 'pathe';
2
- import { e as execa } from './vendor-index.2cbcdd1e.js';
2
+ import { e as execa } from './vendor-index.c1e09929.js';
3
3
  import 'node:buffer';
4
4
  import 'node:path';
5
5
  import 'node:child_process';
6
6
  import 'node:process';
7
7
  import 'child_process';
8
8
  import 'path';
9
- import './vendor-_commonjsHelpers.addc3445.js';
9
+ import './vendor-_commonjsHelpers.76cdd49e.js';
10
10
  import 'fs';
11
11
  import 'node:url';
12
12
  import 'node:os';
13
13
  import 'assert';
14
14
  import 'events';
15
+ import 'node:fs';
15
16
  import 'buffer';
16
17
  import 'stream';
17
18
  import 'util';
19
+ import 'node:util';
18
20
 
19
21
  class VitestGit {
20
22
  constructor(cwd) {