vitest 0.29.8 → 0.30.0

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 (56) hide show
  1. package/LICENSE.md +2 -81
  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.6662587e.js} +53 -48
  6. package/dist/{chunk-install-pkg.6aa7cf6d.js → chunk-install-pkg.6450b372.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 +15 -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 +34 -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 +34 -31
  26. package/dist/{types-94cfe4b4.d.ts → types-f03c83c4.d.ts} +225 -306
  27. package/dist/{chunk-node-pkg.30d8b37e.js → vendor-cli-api.c04eaa34.js} +3845 -3326
  28. package/dist/vendor-constants.538d9b49.js +54 -0
  29. package/dist/{chunk-runtime-mocker.3283818a.js → vendor-execute.8eaab47b.js} +9 -12
  30. package/dist/{chunk-utils-base.b5ddfcc9.js → vendor-index.4f82d248.js} +80 -10
  31. package/dist/{chunk-env-node.affdd278.js → vendor-index.75f2b63d.js} +9 -2
  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 +13 -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-env.6b856dbf.js +0 -64
  48. package/dist/chunk-utils-tasks.8781fd71.js +0 -107
  49. package/dist/env-afee91f0.d.ts +0 -10
  50. package/dist/vendor-index.783e7f3e.js +0 -71
  51. package/dist/vendor-index.bdee400f.js +0 -396
  52. package/dist/vendor-magic-string.es.b3bc5745.js +0 -1591
  53. /package/dist/{vendor-_commonjsHelpers.addc3445.js → vendor-_commonjsHelpers.76cdd49e.js} +0 -0
  54. /package/dist/{chunk-integrations-coverage.d93ee824.js → vendor-coverage.a585b712.js} +0 -0
  55. /package/dist/{chunk-utils-global.fd174983.js → vendor-global.6795f91f.js} +0 -0
  56. /package/dist/{chunk-paths.e36446b4.js → vendor-paths.84fc7a99.js} +0 -0
package/LICENSE.md CHANGED
@@ -567,7 +567,7 @@ Repository: chalk/ansi-regex
567
567
 
568
568
  > MIT License
569
569
  >
570
- > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
570
+ > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
571
571
  >
572
572
  > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
573
573
  >
@@ -584,7 +584,7 @@ Repository: chalk/ansi-styles
584
584
 
585
585
  > MIT License
586
586
  >
587
- > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
587
+ > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
588
588
  >
589
589
  > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
590
590
  >
@@ -1637,21 +1637,6 @@ Repository: sindresorhus/log-update
1637
1637
 
1638
1638
  ---------------------------------------
1639
1639
 
1640
- ## magic-string
1641
- License: MIT
1642
- By: Rich Harris
1643
- Repository: https://github.com/rich-harris/magic-string
1644
-
1645
- > Copyright 2018 Rich Harris
1646
- >
1647
- > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
1648
- >
1649
- > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
1650
- >
1651
- > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1652
-
1653
- ---------------------------------------
1654
-
1655
1640
  ## merge-stream
1656
1641
  License: MIT
1657
1642
  By: Stephen Sugden
@@ -1783,13 +1768,6 @@ Repository: unjs/mlly
1783
1768
 
1784
1769
  ---------------------------------------
1785
1770
 
1786
- ## natural-compare
1787
- License: MIT
1788
- By: Lauri Rooden
1789
- Repository: git://github.com/litejs/natural-compare-lite.git
1790
-
1791
- ---------------------------------------
1792
-
1793
1771
  ## npm-run-path
1794
1772
  License: MIT
1795
1773
  By: Sindre Sorhus
@@ -1921,35 +1899,6 @@ Repository: micromatch/picomatch
1921
1899
 
1922
1900
  ---------------------------------------
1923
1901
 
1924
- ## pretty-format
1925
- License: MIT
1926
- By: James Kyle
1927
- Repository: https://github.com/facebook/jest.git
1928
-
1929
- > MIT License
1930
- >
1931
- > Copyright (c) Facebook, Inc. and its affiliates.
1932
- >
1933
- > Permission is hereby granted, free of charge, to any person obtaining a copy
1934
- > of this software and associated documentation files (the "Software"), to deal
1935
- > in the Software without restriction, including without limitation the rights
1936
- > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1937
- > copies of the Software, and to permit persons to whom the Software is
1938
- > furnished to do so, subject to the following conditions:
1939
- >
1940
- > The above copyright notice and this permission notice shall be included in all
1941
- > copies or substantial portions of the Software.
1942
- >
1943
- > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1944
- > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1945
- > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1946
- > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1947
- > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1948
- > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1949
- > SOFTWARE.
1950
-
1951
- ---------------------------------------
1952
-
1953
1902
  ## prompts
1954
1903
  License: MIT
1955
1904
  By: Terkel Gjervig
@@ -2007,34 +1956,6 @@ Repository: git://github.com/feross/queue-microtask.git
2007
1956
 
2008
1957
  ---------------------------------------
2009
1958
 
2010
- ## react-is
2011
- License: MIT
2012
- Repository: https://github.com/facebook/react.git
2013
-
2014
- > MIT License
2015
- >
2016
- > Copyright (c) Facebook, Inc. and its affiliates.
2017
- >
2018
- > Permission is hereby granted, free of charge, to any person obtaining a copy
2019
- > of this software and associated documentation files (the "Software"), to deal
2020
- > in the Software without restriction, including without limitation the rights
2021
- > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2022
- > copies of the Software, and to permit persons to whom the Software is
2023
- > furnished to do so, subject to the following conditions:
2024
- >
2025
- > The above copyright notice and this permission notice shall be included in all
2026
- > copies or substantial portions of the Software.
2027
- >
2028
- > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2029
- > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2030
- > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2031
- > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2032
- > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2033
- > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2034
- > SOFTWARE.
2035
-
2036
- ---------------------------------------
2037
-
2038
1959
  ## restore-cursor
2039
1960
  License: MIT
2040
1961
  By: Sindre Sorhus
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-f03c83c4.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.4f82d248.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.8eaab47b.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,5 @@
1
1
  import { promises, existsSync } from 'node:fs';
2
- import { c as createBirpc } from './vendor-index.783e7f3e.js';
2
+ import { c as createBirpc, i as isPrimitive } from './vendor-index.4f82d248.js';
3
3
  import require$$0$2 from 'stream';
4
4
  import require$$0 from 'zlib';
5
5
  import require$$0$1 from 'buffer';
@@ -10,18 +10,15 @@ import require$$2 from 'events';
10
10
  import require$$1 from 'https';
11
11
  import require$$2$1 from 'http';
12
12
  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';
13
+ import { A as API_PATH } from './vendor-constants.538d9b49.js';
14
+ import './vendor-index.fad2598b.js';
15
+ import { parseErrorStacktrace } from '@vitest/utils';
17
16
  import 'pathe';
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
  },