vitest 0.26.3 → 0.27.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 (44) hide show
  1. package/LICENSE.md +15 -66
  2. package/dist/browser.d.ts +3 -3
  3. package/dist/browser.js +15 -15
  4. package/dist/{chunk-api-setup.47a09f0f.js → chunk-api-setup.2be3cc38.js} +60 -31
  5. package/dist/{chunk-install-pkg.6dd2bae6.js → chunk-install-pkg.7b006b3e.js} +8 -8
  6. package/dist/{chunk-integrations-coverage.befed097.js → chunk-integrations-coverage.44413252.js} +19 -1
  7. package/dist/chunk-integrations-globals.02f1259c.js +27 -0
  8. package/dist/{chunk-typecheck-constants.06e1fe5b.js → chunk-mock-date.149ed990.js} +19 -32
  9. package/dist/{chunk-node-git.a90c0582.js → chunk-node-git.125c9008.js} +3 -4
  10. package/dist/{chunk-runtime-chain.f51aa930.js → chunk-runtime-chain.4e2aa823.js} +1193 -1029
  11. package/dist/{chunk-runtime-error.f5c8aaf2.js → chunk-runtime-error.97854396.js} +2 -2
  12. package/dist/{chunk-runtime-mocker.887bf8c8.js → chunk-runtime-mocker.4755840f.js} +10 -8
  13. package/dist/{chunk-runtime-rpc.54d72169.js → chunk-runtime-rpc.25cc9413.js} +2 -2
  14. package/dist/{chunk-runtime-setup.a06d5c72.js → chunk-runtime-setup.56d71d30.js} +51 -52
  15. package/dist/{chunk-snapshot-manager.70695b70.js → chunk-snapshot-manager.1a2dbf96.js} +468 -302
  16. package/dist/{chunk-utils-env.3fdc1793.js → chunk-utils-env.f4a39d2c.js} +8 -70
  17. package/dist/{chunk-utils-import.e7f64637.js → chunk-utils-import.16d9fb0d.js} +22 -8
  18. package/dist/chunk-utils-source-map.4e9b891d.js +408 -0
  19. package/dist/{chunk-utils-timers.715da787.js → chunk-utils-timers.52534f96.js} +2977 -3458
  20. package/dist/cli-wrapper.js +15 -15
  21. package/dist/cli.js +15 -627
  22. package/dist/config.cjs +2 -1
  23. package/dist/config.d.ts +1 -1
  24. package/dist/config.js +2 -1
  25. package/dist/entry.js +14 -14
  26. package/dist/environments.d.ts +1 -1
  27. package/dist/{index-761e769b.d.ts → index-1cfc7f58.d.ts} +4 -2
  28. package/dist/index.d.ts +4 -4
  29. package/dist/index.js +12 -12
  30. package/dist/loader.js +9 -10
  31. package/dist/node.d.ts +2 -2
  32. package/dist/node.js +14 -12
  33. package/dist/spy.js +2 -102
  34. package/dist/suite.js +10 -10
  35. package/dist/{types-bae746aa.d.ts → types-5617096e.d.ts} +97 -77
  36. package/dist/{vendor-index.b2fdde54.js → vendor-index.451e37bc.js} +1 -1
  37. package/dist/vendor-index.723a074f.js +102 -0
  38. package/dist/vendor-index.b0346fe4.js +395 -0
  39. package/dist/{vendor-index.7a2cebfe.js → vendor-index.e6c27006.js} +12 -12
  40. package/dist/worker.js +24 -19
  41. package/package.json +13 -8
  42. package/dist/chunk-integrations-globals.ee28730b.js +0 -27
  43. package/dist/chunk-utils-source-map.5278ee22.js +0 -86
  44. package/dist/vendor-index.2e96c50b.js +0 -215
package/LICENSE.md CHANGED
@@ -250,7 +250,7 @@ Repository: chalk/ansi-regex
250
250
 
251
251
  > MIT License
252
252
  >
253
- > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
253
+ > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
254
254
  >
255
255
  > 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:
256
256
  >
@@ -267,7 +267,7 @@ Repository: chalk/ansi-styles
267
267
 
268
268
  > MIT License
269
269
  >
270
- > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
270
+ > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
271
271
  >
272
272
  > 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:
273
273
  >
@@ -335,35 +335,6 @@ Repository: micromatch/braces
335
335
 
336
336
  ---------------------------------------
337
337
 
338
- ## cac
339
- License: MIT
340
- By: egoist
341
- Repository: egoist/cac
342
-
343
- > The MIT License (MIT)
344
- >
345
- > Copyright (c) EGOIST <0x142857@gmail.com> (https://github.com/egoist)
346
- >
347
- > Permission is hereby granted, free of charge, to any person obtaining a copy
348
- > of this software and associated documentation files (the "Software"), to deal
349
- > in the Software without restriction, including without limitation the rights
350
- > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
351
- > copies of the Software, and to permit persons to whom the Software is
352
- > furnished to do so, subject to the following conditions:
353
- >
354
- > The above copyright notice and this permission notice shall be included in
355
- > all copies or substantial portions of the Software.
356
- >
357
- > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
358
- > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
359
- > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
360
- > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
361
- > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
362
- > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
363
- > THE SOFTWARE.
364
-
365
- ---------------------------------------
366
-
367
338
  ## chai-subset
368
339
  License: MIT
369
340
  By: Andrii Shumada, Robert Herhold
@@ -1693,29 +1664,6 @@ Repository: unjs/pathe
1693
1664
 
1694
1665
  ---------------------------------------
1695
1666
 
1696
- ## picocolors
1697
- License: ISC
1698
- By: Alexey Raspopov
1699
- Repository: alexeyraspopov/picocolors
1700
-
1701
- > ISC License
1702
- >
1703
- > Copyright (c) 2021 Alexey Raspopov, Kostiantyn Denysov, Anton Verinov
1704
- >
1705
- > Permission to use, copy, modify, and/or distribute this software for any
1706
- > purpose with or without fee is hereby granted, provided that the above
1707
- > copyright notice and this permission notice appear in all copies.
1708
- >
1709
- > THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1710
- > WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1711
- > MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1712
- > ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1713
- > WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1714
- > ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1715
- > OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1716
-
1717
- ---------------------------------------
1718
-
1719
1667
  ## picomatch
1720
1668
  License: MIT
1721
1669
  By: Jon Schlinkert
@@ -2190,24 +2138,25 @@ By: Einar Otto Stangvik
2190
2138
  Repository: websockets/ws
2191
2139
 
2192
2140
  > Copyright (c) 2011 Einar Otto Stangvik <einaros@gmail.com>
2141
+ > Copyright (c) 2013 Arnout Kazemier and contributors
2142
+ > Copyright (c) 2016 Luigi Pinca and contributors
2193
2143
  >
2194
- > Permission is hereby granted, free of charge, to any person obtaining a copy
2195
- > of this software and associated documentation files (the "Software"), to deal
2196
- > in the Software without restriction, including without limitation the rights
2197
- > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2198
- > copies of the Software, and to permit persons to whom the Software is
2199
- > furnished to do so, subject to the following conditions:
2144
+ > Permission is hereby granted, free of charge, to any person obtaining a copy of
2145
+ > this software and associated documentation files (the "Software"), to deal in
2146
+ > the Software without restriction, including without limitation the rights to
2147
+ > use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
2148
+ > the Software, and to permit persons to whom the Software is furnished to do so,
2149
+ > subject to the following conditions:
2200
2150
  >
2201
2151
  > The above copyright notice and this permission notice shall be included in all
2202
2152
  > copies or substantial portions of the Software.
2203
2153
  >
2204
2154
  > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2205
- > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2206
- > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2207
- > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2208
- > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2209
- > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2210
- > SOFTWARE.
2155
+ > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
2156
+ > FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
2157
+ > COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
2158
+ > IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
2159
+ > CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2211
2160
 
2212
2161
  ---------------------------------------
2213
2162
 
package/dist/browser.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export { A as AssertType, E as EnhancedSpy, q as ExpectTypeOf, x as Mock, y as MockContext, w as MockInstance, z as Mocked, B as MockedClass, u as MockedFunction, v as MockedObject, S as SpyInstance, j as afterAll, l as afterEach, r as assertType, h as beforeAll, k as beforeEach, n as createExpect, e as describe, m as expect, p as expectTypeOf, i as it, o as onTestFailed, d as suite, t as test } from './index-761e769b.js';
2
- import { b as ResolvedConfig } from './types-bae746aa.js';
3
- export { a2 as AfterSuiteRunMeta, A as ApiConfig, a8 as ArgumentsType, a7 as Arrayable, a5 as Awaitable, ap as BaseCoverageOptions, av as BenchFunction, at as Benchmark, aw as BenchmarkAPI, au as BenchmarkResult, as as BenchmarkUserOptions, B as BuiltinEnvironment, j as CSSModuleScopeStrategy, C as CollectLineNumbers, g as CollectLines, ac as Constructable, i as Context, ar as CoverageC8Options, aq as CoverageIstanbulOptions, an as CoverageOptions, ak as CoverageProvider, al as CoverageProviderModule, am as CoverageReporter, aa as DeepMerge, D as DoneCallback, af as Environment, E as EnvironmentOptions, ae as EnvironmentReturn, ai as ErrorWithDiff, a as File, y as HookCleanupCallback, H as HookListener, I as InlineConfig, J as JSDOMOptions, a9 as MergeInsertions, ad as ModuleCache, c as ModuleGraphData, ab as MutableArray, a6 as Nullable, aj as OnServerRestartHandler, O as OnTestFailedHandler, ah as ParsedStack, e as RawErrsMap, d as Reporter, a1 as ResolveIdFunction, b as ResolvedConfig, ao as ResolvedCoverageOptions, h as RootAndTarget, m as RunMode, R as RuntimeConfig, L as RuntimeContext, S as SequenceHooks, Q as SnapshotData, Y as SnapshotMatchOptions, Z as SnapshotResult, X as SnapshotStateOptions, $ as SnapshotSummary, W as SnapshotUpdateState, q as Suite, x as SuiteAPI, G as SuiteCollector, K as SuiteFactory, z as SuiteHooks, t as Task, o as TaskBase, p as TaskResult, T as TaskResultPack, n as TaskState, r as Test, w as TestAPI, N as TestContext, u as TestFunction, v as TestOptions, f as TscErrorInfo, s as TypeCheck, l as TypecheckConfig, _ as UncheckedSnapshot, U as UserConfig, ag as UserConsoleLog, P as Vitest, V as VitestEnvironment, k as VitestRunMode, a0 as WorkerContext, a4 as WorkerGlobalState, a3 as WorkerRPC } from './types-bae746aa.js';
1
+ export { A as AssertType, E as EnhancedSpy, q as ExpectTypeOf, x as Mock, y as MockContext, w as MockInstance, z as Mocked, B as MockedClass, u as MockedFunction, v as MockedObject, S as SpyInstance, j as afterAll, l as afterEach, r as assertType, h as beforeAll, k as beforeEach, n as createExpect, e as describe, m as expect, p as expectTypeOf, i as it, o as onTestFailed, d as suite, t as test } from './index-1cfc7f58.js';
2
+ import { b as ResolvedConfig } from './types-5617096e.js';
3
+ export { a1 as AfterSuiteRunMeta, A as ApiConfig, a7 as ArgumentsType, a6 as Arrayable, a4 as Awaitable, ao as BaseCoverageOptions, au as BenchFunction, as as Benchmark, av as BenchmarkAPI, at as BenchmarkResult, ar as BenchmarkUserOptions, B as BuiltinEnvironment, j as CSSModuleScopeStrategy, C as CollectLineNumbers, g as CollectLines, ab as Constructable, i as Context, aq as CoverageC8Options, ap as CoverageIstanbulOptions, am as CoverageOptions, aj as CoverageProvider, ak as CoverageProviderModule, al as CoverageReporter, a9 as DeepMerge, D as DoneCallback, ae as Environment, E as EnvironmentOptions, ad as EnvironmentReturn, ah as ErrorWithDiff, a as File, x as HookCleanupCallback, H as HookListener, I as InlineConfig, J as JSDOMOptions, a8 as MergeInsertions, ac as ModuleCache, c as ModuleGraphData, aa as MutableArray, a5 as Nullable, ai as OnServerRestartHandler, O as OnTestFailedHandler, ag as ParsedStack, e as RawErrsMap, d as Reporter, a0 as ResolveIdFunction, b as ResolvedConfig, an as ResolvedCoverageOptions, h as RootAndTarget, m as RunMode, R as RuntimeConfig, K as RuntimeContext, S as SequenceHooks, P as SnapshotData, X as SnapshotMatchOptions, Y as SnapshotResult, W as SnapshotStateOptions, _ as SnapshotSummary, Q as SnapshotUpdateState, q as Suite, w as SuiteAPI, z as SuiteCollector, G as SuiteFactory, y as SuiteHooks, s as Task, o as TaskBase, p as TaskResult, T as TaskResultPack, n as TaskState, r as Test, v as TestAPI, L as TestContext, t as TestFunction, u as TestOptions, f as TscErrorInfo, l as TypecheckConfig, Z as UncheckedSnapshot, U as UserConfig, af as UserConsoleLog, N as Vitest, V as VitestEnvironment, k as VitestRunMode, $ as WorkerContext, a3 as WorkerGlobalState, a2 as WorkerRPC } from './types-5617096e.js';
4
4
  import * as chai from 'chai';
5
5
  export { chai };
6
6
  export { assert, should } from 'chai';
package/dist/browser.js CHANGED
@@ -1,29 +1,29 @@
1
- export { c as createExpect, d as describe, e as expect, i as it, s as suite, t as test } from './chunk-runtime-chain.f51aa930.js';
2
- import { e as dist } from './chunk-utils-import.e7f64637.js';
3
- export { a as afterAll, d as afterEach, f as assertType, b as beforeAll, c as beforeEach, o as onTestFailed } from './chunk-utils-import.e7f64637.js';
4
- export { a as setupGlobalEnv, s as startTests } from './chunk-runtime-setup.a06d5c72.js';
1
+ export { c as createExpect, d as describe, e as expect, i as it, s as suite, t as test } from './chunk-runtime-chain.4e2aa823.js';
2
+ import { e as dist } from './chunk-utils-import.16d9fb0d.js';
3
+ export { a as afterAll, d as afterEach, f as assertType, b as beforeAll, c as beforeEach, o as onTestFailed } from './chunk-utils-import.16d9fb0d.js';
4
+ export { a as setupGlobalEnv, s as startTests } from './chunk-runtime-setup.56d71d30.js';
5
5
  import * as chai from 'chai';
6
6
  export { chai };
7
7
  export { assert, should } from 'chai';
8
8
  import 'util';
9
- import './chunk-typecheck-constants.06e1fe5b.js';
9
+ import './chunk-mock-date.149ed990.js';
10
10
  import 'node:path';
11
- import './chunk-utils-env.3fdc1793.js';
12
- import 'tty';
11
+ import 'picocolors';
12
+ import 'local-pkg';
13
+ import './chunk-utils-env.f4a39d2c.js';
13
14
  import 'node:url';
14
15
  import 'path';
15
- import 'local-pkg';
16
16
  import './vendor-_commonjsHelpers.addc3445.js';
17
- import './chunk-runtime-rpc.54d72169.js';
18
- import './chunk-utils-timers.715da787.js';
17
+ import './chunk-utils-timers.52534f96.js';
18
+ import './vendor-index.723a074f.js';
19
+ import 'tinyspy';
20
+ import './chunk-utils-source-map.4e9b891d.js';
21
+ import './chunk-runtime-rpc.25cc9413.js';
19
22
  import 'node:fs';
20
- import './chunk-utils-source-map.5278ee22.js';
21
23
  import 'fs';
22
- import './spy.js';
23
- import 'tinyspy';
24
24
  import 'perf_hooks';
25
- import './chunk-integrations-coverage.befed097.js';
26
- import './chunk-runtime-error.f5c8aaf2.js';
25
+ import './chunk-integrations-coverage.44413252.js';
26
+ import './chunk-runtime-error.97854396.js';
27
27
  import 'vite-node/source-map';
28
28
  import './chunk-env-node.b3664da2.js';
29
29
  import 'node:console';
@@ -1,7 +1,8 @@
1
1
  import { promises } from 'node:fs';
2
2
  import { c as createBirpc } from './vendor-index.783e7f3e.js';
3
- import require$$0$1 from 'stream';
3
+ import require$$0$2 from 'stream';
4
4
  import require$$0 from 'zlib';
5
+ import require$$0$1 from 'buffer';
5
6
  import require$$3 from 'net';
6
7
  import require$$4 from 'tls';
7
8
  import require$$5 from 'crypto';
@@ -9,14 +10,15 @@ import require$$2 from 'events';
9
10
  import require$$1 from 'https';
10
11
  import require$$2$1 from 'http';
11
12
  import require$$7 from 'url';
12
- import { A as API_PATH } from './chunk-utils-env.3fdc1793.js';
13
- import './chunk-typecheck-constants.06e1fe5b.js';
14
- import { p as parseStacktrace } from './chunk-utils-source-map.5278ee22.js';
15
- import 'tty';
13
+ import { A as API_PATH } from './chunk-utils-env.f4a39d2c.js';
14
+ import './chunk-mock-date.149ed990.js';
15
+ import { b as parseStacktrace } from './chunk-utils-source-map.4e9b891d.js';
16
16
  import 'node:url';
17
17
  import 'path';
18
18
  import 'node:path';
19
+ import 'picocolors';
19
20
  import 'local-pkg';
21
+ import './chunk-utils-timers.52534f96.js';
20
22
 
21
23
  async function getModuleGraph(ctx, id) {
22
24
  const graph = {};
@@ -162,6 +164,8 @@ var mask;
162
164
 
163
165
  const { EMPTY_BUFFER: EMPTY_BUFFER$3 } = constants;
164
166
 
167
+ const FastBuffer$2 = Buffer[Symbol.species];
168
+
165
169
  /**
166
170
  * Merges an array of buffers into a new buffer.
167
171
  *
@@ -183,7 +187,9 @@ function concat$1(list, totalLength) {
183
187
  offset += buf.length;
184
188
  }
185
189
 
186
- if (offset < totalLength) return target.slice(0, offset);
190
+ if (offset < totalLength) {
191
+ return new FastBuffer$2(target.buffer, target.byteOffset, offset);
192
+ }
187
193
 
188
194
  return target;
189
195
  }
@@ -225,11 +231,11 @@ function _unmask(buffer, mask) {
225
231
  * @public
226
232
  */
227
233
  function toArrayBuffer$1(buf) {
228
- if (buf.byteLength === buf.buffer.byteLength) {
234
+ if (buf.length === buf.buffer.byteLength) {
229
235
  return buf.buffer;
230
236
  }
231
237
 
232
- return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
238
+ return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.length);
233
239
  }
234
240
 
235
241
  /**
@@ -248,9 +254,9 @@ function toBuffer$2(data) {
248
254
  let buf;
249
255
 
250
256
  if (data instanceof ArrayBuffer) {
251
- buf = Buffer.from(data);
257
+ buf = new FastBuffer$2(data);
252
258
  } else if (ArrayBuffer.isView(data)) {
253
- buf = Buffer.from(data.buffer, data.byteOffset, data.byteLength);
259
+ buf = new FastBuffer$2(data.buffer, data.byteOffset, data.byteLength);
254
260
  } else {
255
261
  buf = Buffer.from(data);
256
262
  toBuffer$2.readOnly = false;
@@ -346,6 +352,7 @@ const bufferUtil = bufferUtil$1.exports;
346
352
  const Limiter = limiter;
347
353
  const { kStatusCode: kStatusCode$2 } = constants;
348
354
 
355
+ const FastBuffer$1 = Buffer[Symbol.species];
349
356
  const TRAILER = Buffer.from([0x00, 0x00, 0xff, 0xff]);
350
357
  const kPerMessageDeflate = Symbol('permessage-deflate');
351
358
  const kTotalLength = Symbol('total-length');
@@ -777,7 +784,9 @@ class PerMessageDeflate$4 {
777
784
  this._deflate[kTotalLength]
778
785
  );
779
786
 
780
- if (fin) data = data.slice(0, data.length - 4);
787
+ if (fin) {
788
+ data = new FastBuffer$1(data.buffer, data.byteOffset, data.length - 4);
789
+ }
781
790
 
782
791
  //
783
792
  // Ensure that the callback will not be called again in
@@ -854,6 +863,8 @@ var validation = {exports: {}};
854
863
 
855
864
  var isValidUTF8_1;
856
865
 
866
+ const { isUtf8 } = require$$0$1;
867
+
857
868
  //
858
869
  // Allowed token characters:
859
870
  //
@@ -965,20 +976,23 @@ validation.exports = {
965
976
  tokenChars: tokenChars$2
966
977
  };
967
978
 
968
- /* istanbul ignore else */
969
- if (!process.env.WS_NO_UTF_8_VALIDATE) {
979
+ if (isUtf8) {
980
+ isValidUTF8_1 = validation.exports.isValidUTF8 = function (buf) {
981
+ return buf.length < 24 ? _isValidUTF8(buf) : isUtf8(buf);
982
+ };
983
+ } /* istanbul ignore else */ else if (!process.env.WS_NO_UTF_8_VALIDATE) {
970
984
  try {
971
985
  const isValidUTF8 = require('utf-8-validate');
972
986
 
973
987
  isValidUTF8_1 = validation.exports.isValidUTF8 = function (buf) {
974
- return buf.length < 150 ? _isValidUTF8(buf) : isValidUTF8(buf);
988
+ return buf.length < 32 ? _isValidUTF8(buf) : isValidUTF8(buf);
975
989
  };
976
990
  } catch (e) {
977
991
  // Continue regardless of the error.
978
992
  }
979
993
  }
980
994
 
981
- const { Writable } = require$$0$1;
995
+ const { Writable } = require$$0$2;
982
996
 
983
997
  const PerMessageDeflate$3 = permessageDeflate;
984
998
  const {
@@ -990,6 +1004,7 @@ const {
990
1004
  const { concat, toArrayBuffer, unmask } = bufferUtil$1.exports;
991
1005
  const { isValidStatusCode: isValidStatusCode$1, isValidUTF8 } = validation.exports;
992
1006
 
1007
+ const FastBuffer = Buffer[Symbol.species];
993
1008
  const GET_INFO = 0;
994
1009
  const GET_PAYLOAD_LENGTH_16 = 1;
995
1010
  const GET_PAYLOAD_LENGTH_64 = 2;
@@ -1075,8 +1090,13 @@ class Receiver$1 extends Writable {
1075
1090
 
1076
1091
  if (n < this._buffers[0].length) {
1077
1092
  const buf = this._buffers[0];
1078
- this._buffers[0] = buf.slice(n);
1079
- return buf.slice(0, n);
1093
+ this._buffers[0] = new FastBuffer(
1094
+ buf.buffer,
1095
+ buf.byteOffset + n,
1096
+ buf.length - n
1097
+ );
1098
+
1099
+ return new FastBuffer(buf.buffer, buf.byteOffset, n);
1080
1100
  }
1081
1101
 
1082
1102
  const dst = Buffer.allocUnsafe(n);
@@ -1089,7 +1109,11 @@ class Receiver$1 extends Writable {
1089
1109
  dst.set(this._buffers.shift(), offset);
1090
1110
  } else {
1091
1111
  dst.set(new Uint8Array(buf.buffer, buf.byteOffset, n), offset);
1092
- this._buffers[0] = buf.slice(n);
1112
+ this._buffers[0] = new FastBuffer(
1113
+ buf.buffer,
1114
+ buf.byteOffset + n,
1115
+ buf.length - n
1116
+ );
1093
1117
  }
1094
1118
 
1095
1119
  n -= buf.length;
@@ -1237,7 +1261,10 @@ class Receiver$1 extends Writable {
1237
1261
  );
1238
1262
  }
1239
1263
 
1240
- if (this._payloadLength > 0x7d) {
1264
+ if (
1265
+ this._payloadLength > 0x7d ||
1266
+ (this._opcode === 0x08 && this._payloadLength === 1)
1267
+ ) {
1241
1268
  this._loop = false;
1242
1269
  return error(
1243
1270
  RangeError,
@@ -1524,14 +1551,6 @@ class Receiver$1 extends Writable {
1524
1551
  if (data.length === 0) {
1525
1552
  this.emit('conclude', 1005, EMPTY_BUFFER$2);
1526
1553
  this.end();
1527
- } else if (data.length === 1) {
1528
- return error(
1529
- RangeError,
1530
- 'invalid payload length 1',
1531
- true,
1532
- 1002,
1533
- 'WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH'
1534
- );
1535
1554
  } else {
1536
1555
  const code = data.readUInt16BE(0);
1537
1556
 
@@ -1545,7 +1564,11 @@ class Receiver$1 extends Writable {
1545
1564
  );
1546
1565
  }
1547
1566
 
1548
- const buf = data.slice(2);
1567
+ const buf = new FastBuffer(
1568
+ data.buffer,
1569
+ data.byteOffset + 2,
1570
+ data.length - 2
1571
+ );
1549
1572
 
1550
1573
  if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
1551
1574
  return error(
@@ -2843,7 +2866,8 @@ class WebSocket$1 extends EventEmitter$1 {
2843
2866
  if (this.readyState === WebSocket$1.CLOSED) return;
2844
2867
  if (this.readyState === WebSocket$1.CONNECTING) {
2845
2868
  const msg = 'WebSocket was closed before the connection was established';
2846
- return abortHandshake$1(this, this._req, msg);
2869
+ abortHandshake$1(this, this._req, msg);
2870
+ return;
2847
2871
  }
2848
2872
 
2849
2873
  if (this.readyState === WebSocket$1.CLOSING) {
@@ -3038,7 +3062,8 @@ class WebSocket$1 extends EventEmitter$1 {
3038
3062
  if (this.readyState === WebSocket$1.CLOSED) return;
3039
3063
  if (this.readyState === WebSocket$1.CONNECTING) {
3040
3064
  const msg = 'WebSocket was closed before the connection was established';
3041
- return abortHandshake$1(this, this._req, msg);
3065
+ abortHandshake$1(this, this._req, msg);
3066
+ return;
3042
3067
  }
3043
3068
 
3044
3069
  if (this._socket) {
@@ -3657,7 +3682,7 @@ function sendAfterClose(websocket, data, cb) {
3657
3682
  `WebSocket is not open: readyState ${websocket.readyState} ` +
3658
3683
  `(${readyStates[websocket.readyState]})`
3659
3684
  );
3660
- cb(err);
3685
+ process.nextTick(cb, err);
3661
3686
  }
3662
3687
  }
3663
3688
 
@@ -4559,8 +4584,12 @@ class WebSocketReporter {
4559
4584
  if (this.clients.size === 0)
4560
4585
  return;
4561
4586
  packs.forEach(([, result]) => {
4587
+ var _a;
4562
4588
  if (result == null ? void 0 : result.error)
4563
4589
  result.error.stacks = parseStacktrace(result.error);
4590
+ (_a = result == null ? void 0 : result.errors) == null ? void 0 : _a.forEach((error) => {
4591
+ error.stacks = parseStacktrace(error);
4592
+ });
4564
4593
  });
4565
4594
  this.clients.forEach((client) => {
4566
4595
  var _a;
@@ -1,8 +1,8 @@
1
1
  import require$$0 from 'fs';
2
- import g from 'path';
2
+ import k from 'path';
3
3
  import util from 'util';
4
4
  import require$$0$2 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.7a2cebfe.js';
5
+ import { p as pathKey, s as signalExit, m as mergeStream$1, g as getStream$1, c as crossSpawn$1 } from './vendor-index.e6c27006.js';
6
6
  import { o as onetime$1 } from './vendor-index.9c919048.js';
7
7
  import require$$0$1 from 'os';
8
8
  import './vendor-_commonjsHelpers.addc3445.js';
@@ -205,7 +205,7 @@ const pLocate$1 = async (iterable, tester, options) => {
205
205
 
206
206
  var pLocate_1 = pLocate$1;
207
207
 
208
- const path$1 = g;
208
+ const path$1 = k;
209
209
  const fs$1 = require$$0;
210
210
  const {promisify: promisify$1} = util;
211
211
  const pLocate = pLocate_1;
@@ -299,7 +299,7 @@ pathExists.exports.sync = path => {
299
299
  };
300
300
 
301
301
  (function (module) {
302
- const path = g;
302
+ const path = k;
303
303
  const locatePath$1 = locatePath.exports;
304
304
  const pathExists$1 = pathExists.exports;
305
305
 
@@ -411,7 +411,7 @@ var stripFinalNewline$1 = input => {
411
411
  var npmRunPath$1 = {exports: {}};
412
412
 
413
413
  (function (module) {
414
- const path = g;
414
+ const path = k;
415
415
  const pathKey$1 = pathKey.exports;
416
416
 
417
417
  const npmRunPath = options => {
@@ -1341,7 +1341,7 @@ var command = {
1341
1341
  parseCommand: parseCommand$1
1342
1342
  };
1343
1343
 
1344
- const path = g;
1344
+ const path = k;
1345
1345
  const childProcess = require$$0$2;
1346
1346
  const crossSpawn = crossSpawn$1.exports;
1347
1347
  const stripFinalNewline = stripFinalNewline$1;
@@ -1623,7 +1623,7 @@ async function detectPackageManager(cwd = process.cwd()) {
1623
1623
  const lockPath = await findUp(Object.keys(LOCKS), { cwd });
1624
1624
  let packageJsonPath;
1625
1625
  if (lockPath)
1626
- packageJsonPath = g.resolve(lockPath, "../package.json");
1626
+ packageJsonPath = k.resolve(lockPath, "../package.json");
1627
1627
  else
1628
1628
  packageJsonPath = await findUp("package.json", { cwd });
1629
1629
  if (packageJsonPath && require$$0.existsSync(packageJsonPath)) {
@@ -1644,7 +1644,7 @@ async function detectPackageManager(cwd = process.cwd()) {
1644
1644
  }
1645
1645
  }
1646
1646
  if (!agent && lockPath)
1647
- agent = LOCKS[g.basename(lockPath)];
1647
+ agent = LOCKS[k.basename(lockPath)];
1648
1648
  return agent;
1649
1649
  }
1650
1650
  async function installPackage(names, options = {}) {
@@ -218,5 +218,23 @@ function checkAllowOnly(task, allowOnly) {
218
218
  error: new Error("[Vitest] Unexpected .only modifier. Remove it or pass --allowOnly argument to bypass this error")
219
219
  };
220
220
  }
221
+ function generateHash(str) {
222
+ let hash = 0;
223
+ if (str.length === 0)
224
+ return `${hash}`;
225
+ for (let i = 0; i < str.length; i++) {
226
+ const char = str.charCodeAt(i);
227
+ hash = (hash << 5) - hash + char;
228
+ hash = hash & hash;
229
+ }
230
+ return `${hash}`;
231
+ }
232
+ function calculateSuiteHash(parent) {
233
+ parent.tasks.forEach((t, idx) => {
234
+ t.id = `${parent.id}_${idx}`;
235
+ if (t.type === "suite")
236
+ calculateSuiteHash(t);
237
+ });
238
+ }
221
239
 
222
- export { CoverageProviderMap as C, getCoverageProvider as g, interpretTaskModes as i, pLimit as p, someTasksAreOnly as s, takeCoverageInsideWorker as t };
240
+ export { CoverageProviderMap as C, getCoverageProvider as a, calculateSuiteHash as c, generateHash as g, interpretTaskModes as i, pLimit as p, someTasksAreOnly as s, takeCoverageInsideWorker as t };
@@ -0,0 +1,27 @@
1
+ import { m as globalApis } from './chunk-utils-env.f4a39d2c.js';
2
+ import { i as index } from './chunk-utils-import.16d9fb0d.js';
3
+ import 'node:url';
4
+ import 'path';
5
+ import './chunk-runtime-chain.4e2aa823.js';
6
+ import 'util';
7
+ import 'chai';
8
+ import './chunk-mock-date.149ed990.js';
9
+ import 'node:path';
10
+ import 'picocolors';
11
+ import 'local-pkg';
12
+ import './vendor-_commonjsHelpers.addc3445.js';
13
+ import './chunk-utils-timers.52534f96.js';
14
+ import './vendor-index.723a074f.js';
15
+ import 'tinyspy';
16
+ import './chunk-utils-source-map.4e9b891d.js';
17
+ import './chunk-runtime-rpc.25cc9413.js';
18
+ import 'node:fs';
19
+ import 'fs';
20
+
21
+ function registerApiGlobally() {
22
+ globalApis.forEach((api) => {
23
+ globalThis[api] = index[api];
24
+ });
25
+ }
26
+
27
+ export { registerApiGlobally };