vitest 0.27.2 → 0.28.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 (64) hide show
  1. package/LICENSE.md +4 -93
  2. package/browser.d.ts +1 -1
  3. package/dist/browser.d.ts +11 -13
  4. package/dist/browser.js +10 -34
  5. package/dist/{chunk-api-setup.029198e3.js → chunk-api-setup.52751a38.js} +27 -12
  6. package/dist/chunk-constants.797d3ebf.js +42 -0
  7. package/dist/{chunk-env-node.787e9561.js → chunk-env-node.ffd1183b.js} +26 -0
  8. package/dist/{chunk-install-pkg.7b006b3e.js → chunk-install-pkg.cfd23146.js} +51 -11
  9. package/dist/chunk-integrations-coverage.48e6286b.js +3993 -0
  10. package/dist/chunk-integrations-globals.0d5f50f0.js +29 -0
  11. package/dist/chunk-integrations-run-once.38756e30.js +27 -0
  12. package/dist/chunk-integrations-utils.f1f6f1ed.js +118 -0
  13. package/dist/{chunk-node-git.125c9008.js → chunk-node-git.d9ad64ab.js} +6 -7
  14. package/dist/{chunk-snapshot-manager.ce714e21.js → chunk-node-pkg.dcdf4369.js} +12653 -9324
  15. package/dist/{chunk-runtime-mocker.58511c38.js → chunk-runtime-mocker.03017e8c.js} +14 -13
  16. package/dist/{chunk-runtime-rpc.d709e91b.js → chunk-runtime-rpc.9c0386cc.js} +3 -2
  17. package/dist/chunk-runtime-setup.d9302cfd.js +20 -0
  18. package/dist/chunk-snapshot-env.6457638e.js +11 -0
  19. package/dist/chunk-utils-base.977ae74f.js +77 -0
  20. package/dist/chunk-utils-env.860d90c2.js +6 -0
  21. package/dist/chunk-utils-global.442d1d33.js +73 -0
  22. package/dist/{chunk-utils-import.054ab315.js → chunk-utils-import.9911c99d.js} +3289 -169
  23. package/dist/chunk-utils-tasks.1b603032.js +103 -0
  24. package/dist/cli-wrapper.js +8 -6
  25. package/dist/cli.js +18 -15
  26. package/dist/config.cjs +10 -7
  27. package/dist/config.d.ts +22 -4
  28. package/dist/config.js +10 -8
  29. package/dist/entry.js +244 -28
  30. package/dist/env-afee91f0.d.ts +10 -0
  31. package/dist/environments.d.ts +7 -2
  32. package/dist/environments.js +1 -1
  33. package/dist/index.d.ts +160 -11
  34. package/dist/index.js +18 -18
  35. package/dist/loader.js +9 -8
  36. package/dist/node.d.ts +9 -7
  37. package/dist/node.js +20 -17
  38. package/dist/runners-chunk.js +215 -0
  39. package/dist/runners.d.ts +39 -0
  40. package/dist/runners.js +18 -0
  41. package/dist/spy.js +1 -2
  42. package/dist/suite.d.ts +2 -0
  43. package/dist/suite.js +2 -18
  44. package/dist/{types-d97c72c7.d.ts → types-c800444e.d.ts} +196 -437
  45. package/dist/{vendor-index.e6c27006.js → vendor-index.618ca5a1.js} +1078 -10
  46. package/dist/{vendor-index.b0346fe4.js → vendor-index.bdee400f.js} +1 -0
  47. package/dist/worker.js +17 -16
  48. package/package.json +22 -12
  49. package/runners.d.ts +1 -0
  50. package/suite.d.ts +1 -0
  51. package/dist/chunk-integrations-coverage.44413252.js +0 -240
  52. package/dist/chunk-integrations-globals.0024ce21.js +0 -27
  53. package/dist/chunk-mock-date.c543fa3e.js +0 -349
  54. package/dist/chunk-runtime-chain.2da9e75c.js +0 -2595
  55. package/dist/chunk-runtime-error.de671af0.js +0 -144
  56. package/dist/chunk-runtime-setup.35da9209.js +0 -649
  57. package/dist/chunk-utils-env.f4a39d2c.js +0 -228
  58. package/dist/chunk-utils-source-map.5f5d12cf.js +0 -408
  59. package/dist/chunk-utils-timers.52534f96.js +0 -3573
  60. package/dist/index-50755efe.d.ts +0 -258
  61. package/dist/vendor-index.451e37bc.js +0 -1071
  62. package/dist/vendor-index.723a074f.js +0 -102
  63. package/dist/vendor-index.9c919048.js +0 -61
  64. package/dist/vendor-index.9f20a9be.js +0 -6291
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> (https://sindresorhus.com)
253
+ > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (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> (https://sindresorhus.com)
270
+ > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (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
  >
@@ -427,44 +427,6 @@ Repository: git@github.com:moxystudio/node-cross-spawn.git
427
427
 
428
428
  ---------------------------------------
429
429
 
430
- ## diff
431
- License: BSD-3-Clause
432
- Repository: git://github.com/kpdecker/jsdiff.git
433
-
434
- > Software License Agreement (BSD License)
435
- >
436
- > Copyright (c) 2009-2015, Kevin Decker <kpdecker@gmail.com>
437
- >
438
- > All rights reserved.
439
- >
440
- > Redistribution and use of this software in source and binary forms, with or without modification,
441
- > are permitted provided that the following conditions are met:
442
- >
443
- > * Redistributions of source code must retain the above
444
- > copyright notice, this list of conditions and the
445
- > following disclaimer.
446
- >
447
- > * Redistributions in binary form must reproduce the above
448
- > copyright notice, this list of conditions and the
449
- > following disclaimer in the documentation and/or other
450
- > materials provided with the distribution.
451
- >
452
- > * Neither the name of Kevin Decker nor the names of its
453
- > contributors may be used to endorse or promote products
454
- > derived from this software without specific prior
455
- > written permission.
456
- >
457
- > THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
458
- > IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
459
- > FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
460
- > CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
461
- > DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
462
- > DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
463
- > IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
464
- > OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
465
-
466
- ---------------------------------------
467
-
468
430
  ## eastasianwidth
469
431
  License: MIT
470
432
  By: Masaki Komagata
@@ -1466,7 +1428,7 @@ Repository: sindresorhus/mimic-fn
1466
1428
 
1467
1429
  > MIT License
1468
1430
  >
1469
- > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
1431
+ > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
1470
1432
  >
1471
1433
  > 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:
1472
1434
  >
@@ -1603,7 +1565,7 @@ Repository: sindresorhus/path-key
1603
1565
 
1604
1566
  > MIT License
1605
1567
  >
1606
- > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
1568
+ > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
1607
1569
  >
1608
1570
  > 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:
1609
1571
  >
@@ -1613,57 +1575,6 @@ Repository: sindresorhus/path-key
1613
1575
 
1614
1576
  ---------------------------------------
1615
1577
 
1616
- ## pathe
1617
- License: MIT
1618
- Repository: unjs/pathe
1619
-
1620
- > MIT License
1621
- >
1622
- > Copyright (c) 2021 UnJS
1623
- >
1624
- > Permission is hereby granted, free of charge, to any person obtaining a copy
1625
- > of this software and associated documentation files (the "Software"), to deal
1626
- > in the Software without restriction, including without limitation the rights
1627
- > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1628
- > copies of the Software, and to permit persons to whom the Software is
1629
- > furnished to do so, subject to the following conditions:
1630
- >
1631
- > The above copyright notice and this permission notice shall be included in all
1632
- > copies or substantial portions of the Software.
1633
- >
1634
- > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1635
- > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1636
- > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1637
- > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1638
- > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1639
- > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1640
- > SOFTWARE.
1641
- >
1642
- > --------------------------------------------------------------------------------
1643
- >
1644
- > Copyright Joyent, Inc. and other Node contributors.
1645
- >
1646
- > Permission is hereby granted, free of charge, to any person obtaining a
1647
- > copy of this software and associated documentation files (the
1648
- > "Software"), to deal in the Software without restriction, including
1649
- > without limitation the rights to use, copy, modify, merge, publish,
1650
- > distribute, sublicense, and/or sell copies of the Software, and to permit
1651
- > persons to whom the Software is furnished to do so, subject to the
1652
- > following conditions:
1653
- >
1654
- > The above copyright notice and this permission notice shall be included
1655
- > in all copies or substantial portions of the Software.
1656
- >
1657
- > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1658
- > OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1659
- > MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
1660
- > NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
1661
- > DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
1662
- > OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
1663
- > USE OR OTHER DEALINGS IN THE SOFTWARE.
1664
-
1665
- ---------------------------------------
1666
-
1667
1578
  ## picomatch
1668
1579
  License: MIT
1669
1580
  By: Jon Schlinkert
package/browser.d.ts CHANGED
@@ -1 +1 @@
1
- export * from './dist/browser'
1
+ export * from './dist/browser.js'
package/dist/browser.d.ts CHANGED
@@ -1,20 +1,18 @@
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-50755efe.js';
2
- import { b as ResolvedConfig } from './types-d97c72c7.js';
3
- export { a1 as AfterSuiteRunMeta, A as ApiConfig, a7 as ArgumentsType, a6 as Arrayable, a4 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, ab as Constructable, i as Context, ar as CoverageC8Options, aq as CoverageIstanbulOptions, an as CoverageOptions, aj as CoverageProvider, al as CoverageProviderModule, am 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, ak as ReportContext, d as Reporter, a0 as ResolveIdFunction, b as ResolvedConfig, ao 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-d97c72c7.js';
4
- import * as chai from 'chai';
5
- export { chai };
6
- export { assert, should } from 'chai';
7
- export { Bench as BenchFactory, Options as BenchOptions, Task as BenchTask, TaskResult as BenchTaskResult } from 'tinybench';
8
- import 'tinyspy';
1
+ export { startTests } from '@vitest/runner';
2
+ import { a as ResolvedConfig } from './types-c800444e.js';
3
+ export { s as setupSnapshotEnvironment } from './env-afee91f0.js';
4
+ import '@vitest/expect';
9
5
  import 'vite';
6
+ import '@vitest/runner/types';
7
+ import '@vitest/runner/utils';
8
+ import '@vitest/utils';
9
+ import 'tinybench';
10
10
  import 'vite-node/client';
11
11
  import 'vite-node/server';
12
+ import 'node:worker_threads';
12
13
  import 'vite-node';
13
14
  import 'node:fs';
14
- import 'node:worker_threads';
15
-
16
- declare function startTests(paths: string[], config: ResolvedConfig): Promise<void>;
17
15
 
18
- declare function setupGlobalEnv(config: ResolvedConfig): Promise<void>;
16
+ declare function setupCommonEnv(config: ResolvedConfig): Promise<void>;
19
17
 
20
- export { setupGlobalEnv, startTests };
18
+ export { setupCommonEnv };
package/dist/browser.js CHANGED
@@ -1,34 +1,10 @@
1
- export { c as createExpect, d as describe, e as expect, i as it, s as suite, t as test } from './chunk-runtime-chain.2da9e75c.js';
2
- import { e as dist } from './chunk-utils-import.054ab315.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.054ab315.js';
4
- export { a as setupGlobalEnv, s as startTests } from './chunk-runtime-setup.35da9209.js';
5
- import * as chai from 'chai';
6
- export { chai };
7
- export { assert, should } from 'chai';
8
- import 'util';
9
- import './chunk-mock-date.c543fa3e.js';
10
- import 'node:path';
11
- import 'picocolors';
12
- import 'local-pkg';
13
- import './chunk-utils-env.f4a39d2c.js';
14
- import 'node:url';
15
- import 'path';
16
- import './vendor-_commonjsHelpers.addc3445.js';
17
- import './chunk-utils-timers.52534f96.js';
18
- import './vendor-index.723a074f.js';
19
- import 'tinyspy';
20
- import './chunk-utils-source-map.5f5d12cf.js';
21
- import './chunk-runtime-rpc.d709e91b.js';
22
- import 'node:fs';
23
- import 'fs';
24
- import 'perf_hooks';
25
- import './chunk-integrations-coverage.44413252.js';
26
- import './chunk-runtime-error.de671af0.js';
27
- import 'vite-node/source-map';
28
- import './chunk-env-node.787e9561.js';
29
- import 'node:console';
30
-
31
-
32
-
33
- var expectTypeOf = dist.expectTypeOf;
34
- export { expectTypeOf };
1
+ export { startTests } from '@vitest/runner';
2
+ export { s as setupCommonEnv } from './chunk-runtime-setup.d9302cfd.js';
3
+ export { s as setupSnapshotEnvironment } from './chunk-snapshot-env.6457638e.js';
4
+ import '@vitest/utils';
5
+ import './chunk-integrations-run-once.38756e30.js';
6
+ import './chunk-utils-global.442d1d33.js';
7
+ import 'pathe';
8
+ import './chunk-utils-env.860d90c2.js';
9
+ import 'std-env';
10
+ import '@vitest/runner/utils';
@@ -1,4 +1,4 @@
1
- import { promises } from 'node:fs';
1
+ import { promises, existsSync } from 'node:fs';
2
2
  import { c as createBirpc } from './vendor-index.783e7f3e.js';
3
3
  import require$$0$2 from 'stream';
4
4
  import require$$0 from 'zlib';
@@ -10,15 +10,16 @@ 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-utils-env.f4a39d2c.js';
14
- import './chunk-mock-date.c543fa3e.js';
15
- import { b as parseStacktrace } from './chunk-utils-source-map.5f5d12cf.js';
13
+ import { A as API_PATH } from './chunk-constants.797d3ebf.js';
14
+ import './chunk-utils-global.442d1d33.js';
15
+ import { a as parseStacktrace } from './chunk-utils-tasks.1b603032.js';
16
16
  import 'node:url';
17
- import 'path';
18
- import 'node:path';
19
- import 'picocolors';
20
- import 'local-pkg';
21
- import './chunk-utils-timers.52534f96.js';
17
+ import 'pathe';
18
+ import './chunk-utils-env.860d90c2.js';
19
+ import 'std-env';
20
+ import '@vitest/runner/utils';
21
+ import '@vitest/utils';
22
+ import './chunk-utils-base.977ae74f.js';
22
23
 
23
24
  async function getModuleGraph(ctx, id) {
24
25
  const graph = {};
@@ -4517,12 +4518,26 @@ function setup(ctx) {
4517
4518
  getFiles() {
4518
4519
  return ctx.state.getFiles();
4519
4520
  },
4520
- async getPaths() {
4521
- return await ctx.state.getPaths();
4521
+ getPaths() {
4522
+ return ctx.state.getPaths();
4522
4523
  },
4523
- readFile(id) {
4524
+ resolveSnapshotPath(testPath) {
4525
+ return ctx.snapshot.resolvePath(testPath);
4526
+ },
4527
+ removeFile(id) {
4528
+ return promises.unlink(id);
4529
+ },
4530
+ createDirectory(id) {
4531
+ return promises.mkdir(id, { recursive: true });
4532
+ },
4533
+ async readFile(id) {
4534
+ if (!existsSync(id))
4535
+ return null;
4524
4536
  return promises.readFile(id, "utf-8");
4525
4537
  },
4538
+ snapshotSaved(snapshot) {
4539
+ ctx.snapshot.add(snapshot);
4540
+ },
4526
4541
  writeFile(id, content) {
4527
4542
  return promises.writeFile(id, content, "utf-8");
4528
4543
  },
@@ -0,0 +1,42 @@
1
+ import url from 'node:url';
2
+ import { resolve } from 'pathe';
3
+ import { i as isNode } from './chunk-utils-env.860d90c2.js';
4
+
5
+ const rootDir = isNode ? resolve(url.fileURLToPath(import.meta.url), "../../") : import.meta.url;
6
+ const distDir = isNode ? resolve(url.fileURLToPath(import.meta.url), "../../dist") : import.meta.url;
7
+ const defaultPort = 51204;
8
+ const EXIT_CODE_RESTART = 43;
9
+ const API_PATH = "/__vitest_api__";
10
+ const configFiles = [
11
+ "vitest.config.ts",
12
+ "vitest.config.mts",
13
+ "vitest.config.cts",
14
+ "vitest.config.js",
15
+ "vitest.config.mjs",
16
+ "vitest.config.cjs",
17
+ "vite.config.ts",
18
+ "vite.config.mts",
19
+ "vite.config.cts",
20
+ "vite.config.js",
21
+ "vite.config.mjs",
22
+ "vite.config.cjs"
23
+ ];
24
+ const globalApis = [
25
+ "suite",
26
+ "test",
27
+ "describe",
28
+ "it",
29
+ "chai",
30
+ "expect",
31
+ "assert",
32
+ "expectTypeOf",
33
+ "assertType",
34
+ "vitest",
35
+ "vi",
36
+ "beforeAll",
37
+ "afterAll",
38
+ "beforeEach",
39
+ "afterEach"
40
+ ];
41
+
42
+ export { API_PATH as A, EXIT_CODE_RESTART as E, defaultPort as a, configFiles as c, distDir as d, globalApis as g, rootDir as r };
@@ -301,6 +301,29 @@ function populateGlobal(global, win, options = {}) {
301
301
  };
302
302
  }
303
303
 
304
+ function catchWindowErrors(window) {
305
+ let userErrorListenerCount = 0;
306
+ function throwUnhandlerError(e) {
307
+ if (userErrorListenerCount === 0 && e.error != null)
308
+ process.emit("uncaughtException", e.error);
309
+ }
310
+ const addEventListener = window.addEventListener.bind(window);
311
+ const removeEventListener = window.removeEventListener.bind(window);
312
+ window.addEventListener("error", throwUnhandlerError);
313
+ window.addEventListener = function(...args) {
314
+ if (args[0] === "error")
315
+ userErrorListenerCount++;
316
+ return addEventListener.apply(this, args);
317
+ };
318
+ window.removeEventListener = function(...args) {
319
+ if (args[0] === "error" && userErrorListenerCount)
320
+ userErrorListenerCount--;
321
+ return removeEventListener.apply(this, args);
322
+ };
323
+ return function clearErrorHandlers() {
324
+ window.removeEventListener("error", throwUnhandlerError);
325
+ };
326
+ }
304
327
  var jsdom = {
305
328
  name: "jsdom",
306
329
  async setup(global, { jsdom = {} }) {
@@ -339,8 +362,11 @@ var jsdom = {
339
362
  }
340
363
  );
341
364
  const { keys, originals } = populateGlobal(global, dom.window, { bindFunctions: true });
365
+ const clearWindowErrors = catchWindowErrors(global);
342
366
  return {
343
367
  teardown(global2) {
368
+ clearWindowErrors();
369
+ dom.window.close();
344
370
  keys.forEach((key) => delete global2[key]);
345
371
  originals.forEach((v, k) => global2[k] = v);
346
372
  }
@@ -1,15 +1,55 @@
1
1
  import require$$0 from 'fs';
2
2
  import k from 'path';
3
- import util from 'util';
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.e6c27006.js';
6
- import { o as onetime$1 } from './vendor-index.9c919048.js';
7
- import require$$0$1 from 'os';
3
+ import require$$0$1 from 'util';
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.618ca5a1.js';
6
+ import { o as onetime$1 } from './chunk-node-pkg.dcdf4369.js';
7
+ import require$$0$2 from 'os';
8
+ import 'node:buffer';
9
+ import 'node:path';
10
+ import 'node:child_process';
11
+ import 'node:process';
8
12
  import './vendor-_commonjsHelpers.addc3445.js';
13
+ import 'node:url';
14
+ import 'node:os';
9
15
  import 'assert';
10
16
  import 'events';
11
17
  import 'buffer';
12
18
  import 'stream';
19
+ import 'pathe';
20
+ import './chunk-constants.797d3ebf.js';
21
+ import './chunk-utils-env.860d90c2.js';
22
+ import 'std-env';
23
+ import './chunk-integrations-coverage.48e6286b.js';
24
+ import 'local-pkg';
25
+ import './chunk-env-node.ffd1183b.js';
26
+ import 'node:console';
27
+ import 'picocolors';
28
+ import 'vite';
29
+ import 'node:fs';
30
+ import 'vite-node/client';
31
+ import 'vite-node/server';
32
+ import './chunk-utils-global.442d1d33.js';
33
+ import '@vitest/runner/utils';
34
+ import '@vitest/utils';
35
+ import 'node:fs/promises';
36
+ import 'source-map';
37
+ import 'module';
38
+ import 'acorn';
39
+ import 'acorn-walk';
40
+ import 'node:worker_threads';
41
+ import 'tinypool';
42
+ import './vendor-index.783e7f3e.js';
43
+ import 'perf_hooks';
44
+ import './chunk-utils-base.977ae74f.js';
45
+ import './chunk-utils-tasks.1b603032.js';
46
+ import 'crypto';
47
+ import 'vite-node/utils';
48
+ import '@vitest/utils/diff';
49
+ import 'node:crypto';
50
+ import './chunk-magic-string.3a794426.js';
51
+ import 'strip-literal';
52
+ import 'readline';
13
53
 
14
54
  var findUp$1 = {exports: {}};
15
55
 
@@ -207,7 +247,7 @@ var pLocate_1 = pLocate$1;
207
247
 
208
248
  const path$1 = k;
209
249
  const fs$1 = require$$0;
210
- const {promisify: promisify$1} = util;
250
+ const {promisify: promisify$1} = require$$0$1;
211
251
  const pLocate = pLocate_1;
212
252
 
213
253
  const fsStat = promisify$1(fs$1.stat);
@@ -276,7 +316,7 @@ locatePath.exports.sync = (paths, options) => {
276
316
  var pathExists = {exports: {}};
277
317
 
278
318
  const fs = require$$0;
279
- const {promisify} = util;
319
+ const {promisify} = require$$0$1;
280
320
 
281
321
  const pAccess = promisify(fs.access);
282
322
 
@@ -759,7 +799,7 @@ standard:"posix"};
759
799
  const SIGRTMIN=34;
760
800
  const SIGRTMAX=64;realtime.SIGRTMAX=SIGRTMAX;
761
801
 
762
- Object.defineProperty(signals,"__esModule",{value:true});signals.getSignals=void 0;var _os$1=require$$0$1;
802
+ Object.defineProperty(signals,"__esModule",{value:true});signals.getSignals=void 0;var _os$1=require$$0$2;
763
803
 
764
804
  var _core=core;
765
805
  var _realtime$1=realtime;
@@ -794,7 +834,7 @@ const number=supported?constantSignal:defaultNumber;
794
834
  return {name,number,description,supported,action,forced,standard};
795
835
  };
796
836
 
797
- Object.defineProperty(main,"__esModule",{value:true});main.signalsByNumber=main.signalsByName=void 0;var _os=require$$0$1;
837
+ Object.defineProperty(main,"__esModule",{value:true});main.signalsByNumber=main.signalsByName=void 0;var _os=require$$0$2;
798
838
 
799
839
  var _signals=signals;
800
840
  var _realtime=realtime;
@@ -1007,7 +1047,7 @@ stdio.exports.node = options => {
1007
1047
  return [...stdio, 'ipc'];
1008
1048
  };
1009
1049
 
1010
- const os = require$$0$1;
1050
+ const os = require$$0$2;
1011
1051
  const onExit = signalExit.exports;
1012
1052
 
1013
1053
  const DEFAULT_FORCE_KILL_TIMEOUT = 1000 * 5;
@@ -1342,7 +1382,7 @@ var command = {
1342
1382
  };
1343
1383
 
1344
1384
  const path = k;
1345
- const childProcess = require$$0$2;
1385
+ const childProcess = require$$0$3;
1346
1386
  const crossSpawn = crossSpawn$1.exports;
1347
1387
  const stripFinalNewline = stripFinalNewline$1;
1348
1388
  const npmRunPath = npmRunPath$1.exports;