vitest 0.21.1 → 0.23.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 (50) hide show
  1. package/LICENSE.md +61 -33
  2. package/dist/browser.d.ts +5 -5
  3. package/dist/browser.mjs +12 -10
  4. package/dist/{chunk-api-setup.7a6ba7fb.mjs → chunk-api-setup.5fc06d1d.mjs} +94 -91
  5. package/dist/chunk-constants.6196597b.mjs +284 -0
  6. package/dist/chunk-env-node.ceb43f1c.mjs +403 -0
  7. package/dist/{chunk-install-pkg.6c6dc0c2.mjs → chunk-install-pkg.e081fc1b.mjs} +2 -1
  8. package/dist/chunk-integrations-coverage.99c020eb.mjs +166 -0
  9. package/dist/{chunk-integrations-globals.44a8f047.mjs → chunk-integrations-globals.ef598c23.mjs} +8 -9
  10. package/dist/{chunk-magic-string.efe26975.mjs → chunk-magic-string.56b2b543.mjs} +30 -10
  11. package/dist/chunk-mock-date.0d86eaa5.mjs +332 -0
  12. package/dist/chunk-node-git.6f289b0a.mjs +84 -0
  13. package/dist/{chunk-runtime-chain.98d42d89.mjs → chunk-runtime-chain.2af36ddf.mjs} +507 -172
  14. package/dist/{chunk-runtime-error.87a2b5a2.mjs → chunk-runtime-error.ed9b4f70.mjs} +208 -76
  15. package/dist/{chunk-runtime-hooks.453f8858.mjs → chunk-runtime-hooks.75ce0575.mjs} +18 -12
  16. package/dist/{chunk-runtime-mocker.23b62bfa.mjs → chunk-runtime-mocker.fc76f21d.mjs} +18 -11
  17. package/dist/{chunk-runtime-rpc.b50ab560.mjs → chunk-runtime-rpc.3fe371e9.mjs} +1 -2
  18. package/dist/{chunk-utils-source-map.94107ee8.mjs → chunk-utils-source-map.70ee97e1.mjs} +11 -4
  19. package/dist/{chunk-vite-node-client.fdd9592c.mjs → chunk-vite-node-client.74ebe3d5.mjs} +97 -31
  20. package/dist/{chunk-vite-node-debug.09afb76f.mjs → chunk-vite-node-debug.2d8a1dc3.mjs} +3 -3
  21. package/dist/{chunk-vite-node-externalize.27aee038.mjs → chunk-vite-node-externalize.41bf722e.mjs} +644 -222
  22. package/dist/{chunk-vite-node-utils.f34df9d3.mjs → chunk-vite-node-utils.68573626.mjs} +60 -42
  23. package/dist/cli-wrapper.mjs +128 -0
  24. package/dist/cli.mjs +29 -20
  25. package/dist/config.cjs +5 -2
  26. package/dist/config.d.ts +8 -4
  27. package/dist/config.mjs +4 -3
  28. package/dist/entry.mjs +20 -15
  29. package/dist/environments.d.ts +23 -0
  30. package/dist/environments.mjs +3 -0
  31. package/dist/{global-60f880c6.d.ts → global-ea084c9f.d.ts} +627 -178
  32. package/dist/{index-4a906fa4.d.ts → index-5f09f4d0.d.ts} +3 -50
  33. package/dist/index.d.ts +6 -6
  34. package/dist/index.mjs +7 -6
  35. package/dist/loader.mjs +3 -3
  36. package/dist/node.d.ts +5 -4
  37. package/dist/node.mjs +19 -16
  38. package/dist/suite.mjs +6 -5
  39. package/dist/vendor-index.0557b03a.mjs +147 -0
  40. package/dist/vendor-index.13e3bda3.mjs +61 -0
  41. package/dist/{chunk-node-git.c2be9c49.mjs → vendor-index.4aeeb598.mjs} +4 -72
  42. package/dist/{vendor-index.61438b77.mjs → vendor-index.731a22f2.mjs} +1 -61
  43. package/dist/worker.mjs +20 -18
  44. package/package.json +19 -16
  45. package/vitest.mjs +1 -1
  46. package/dist/chunk-constants.26dc9f85.mjs +0 -38
  47. package/dist/chunk-defaults.02abff90.mjs +0 -680
  48. package/dist/chunk-mock-date.bc81a3ac.mjs +0 -555
  49. package/dist/chunk-utils-global.fa20c2f6.mjs +0 -5
  50. package/dist/mocker-5e2a8e41.d.ts +0 -3
@@ -1,53 +1,5 @@
1
- import { MessagePort } from 'worker_threads';
2
- import { R as ResolvedConfig, a2 as ViteNodeResolveId, a3 as FetchFunction, a4 as RawSourceMap, a as File, X as UserConsoleLog, T as TaskResultPack, v as SnapshotResult, g as Test, a5 as ModuleCacheMap, k as SuiteAPI, j as TestAPI, m as SuiteHooks, H as HookListener, q as TestContext, S as Suite, l as HookCleanupCallback } from './global-60f880c6.js';
3
- import { M as MockMap } from './mocker-5e2a8e41.js';
4
1
  import { SpyImpl } from 'tinyspy';
5
-
6
- declare type ArgumentsType<T> = T extends (...args: infer A) => any ? A : never;
7
- declare type ReturnType$1<T> = T extends (...args: any) => infer R ? R : never;
8
- declare type PromisifyFn<T> = ReturnType$1<T> extends Promise<any> ? T : (...args: ArgumentsType<T>) => Promise<Awaited<ReturnType$1<T>>>;
9
- declare type BirpcFn<T> = PromisifyFn<T> & {
10
- /**
11
- * Send event without asking for response
12
- */
13
- asEvent(...args: ArgumentsType<T>): void;
14
- };
15
- declare type BirpcReturn<RemoteFunctions> = {
16
- [K in keyof RemoteFunctions]: BirpcFn<RemoteFunctions[K]>;
17
- };
18
-
19
- interface WorkerContext {
20
- workerId: number;
21
- port: MessagePort;
22
- config: ResolvedConfig;
23
- files: string[];
24
- invalidates?: string[];
25
- }
26
- declare type ResolveIdFunction = (id: string, importer?: string) => Promise<ViteNodeResolveId | null>;
27
- interface WorkerRPC {
28
- fetch: FetchFunction;
29
- resolveId: ResolveIdFunction;
30
- getSourceMap: (id: string, force?: boolean) => Promise<RawSourceMap | undefined>;
31
- onFinished: (files: File[], errors?: unknown[]) => void;
32
- onWorkerExit: (code?: number) => void;
33
- onPathsCollected: (paths: string[]) => void;
34
- onUserConsoleLog: (log: UserConsoleLog) => void;
35
- onUnhandledRejection: (err: unknown) => void;
36
- onCollected: (files: File[]) => void;
37
- onTaskUpdate: (pack: TaskResultPack[]) => void;
38
- snapshotSaved: (snapshot: SnapshotResult) => void;
39
- resolveSnapshotPath: (testPath: string) => string;
40
- }
41
- interface WorkerGlobalState {
42
- ctx: WorkerContext;
43
- config: ResolvedConfig;
44
- rpc: BirpcReturn<WorkerRPC>;
45
- current?: Test;
46
- filepath?: string;
47
- moduleCache: ModuleCacheMap;
48
- browserHashMap?: Map<string, string>;
49
- mockMap: MockMap;
50
- }
2
+ import { m as SuiteAPI, l as TestAPI, al as BenchmarkAPI, o as SuiteHooks, H as HookListener, s as TestContext, S as Suite, n as HookCleanupCallback, h as Test } from './global-ea084c9f.js';
51
3
 
52
4
  interface MockResultReturn<T> {
53
5
  type: 'return';
@@ -150,6 +102,7 @@ declare function fn<TArgs extends any[] = any[], R = any>(implementation: (...ar
150
102
 
151
103
  declare const suite: SuiteAPI<{}>;
152
104
  declare const test: TestAPI<{}>;
105
+ declare const bench: BenchmarkAPI;
153
106
  declare const describe: SuiteAPI<{}>;
154
107
  declare const it: TestAPI<{}>;
155
108
 
@@ -161,4 +114,4 @@ declare const afterEach: <ExtraContext = {}>(fn: HookListener<[TestContext & Ext
161
114
  declare function createExpect(test?: Test): Vi.ExpectStatic;
162
115
  declare const globalExpect: Vi.ExpectStatic;
163
116
 
164
- export { EnhancedSpy as E, MaybeMockedDeep as M, ResolveIdFunction as R, SpyInstance as S, WorkerContext as W, MaybeMocked as a, MaybePartiallyMocked as b, MaybePartiallyMockedDeep as c, suite as d, describe as e, fn as f, beforeAll as g, afterAll as h, it as i, beforeEach as j, afterEach as k, globalExpect as l, createExpect as m, MockedFunction as n, MockedObject as o, MockInstance as p, Mock as q, MockContext as r, spyOn as s, test as t, Mocked as u, MockedClass as v, WorkerRPC as w, WorkerGlobalState as x };
117
+ export { EnhancedSpy as E, MaybeMockedDeep as M, SpyInstance as S, MaybeMocked as a, MaybePartiallyMocked as b, MaybePartiallyMockedDeep as c, suite as d, describe as e, fn as f, bench as g, beforeAll as h, it as i, afterAll as j, beforeEach as k, afterEach as l, globalExpect as m, createExpect as n, MockedFunction as o, MockedObject as p, MockInstance as q, Mock as r, spyOn as s, test as t, MockContext as u, Mocked as v, MockedClass as w };
package/dist/index.d.ts CHANGED
@@ -1,15 +1,15 @@
1
- import { s as spyOn, f as fn, M as MaybeMockedDeep, a as MaybeMocked, b as MaybePartiallyMocked, c as MaybePartiallyMockedDeep, E as EnhancedSpy } from './index-4a906fa4.js';
2
- export { E as EnhancedSpy, q as Mock, r as MockContext, p as MockInstance, u as Mocked, v as MockedClass, n as MockedFunction, o as MockedObject, R as ResolveIdFunction, S as SpyInstance, W as WorkerContext, x as WorkerGlobalState, w as WorkerRPC, h as afterAll, k as afterEach, g as beforeAll, j as beforeEach, m as createExpect, e as describe, l as expect, i as it, d as suite, t as test } from './index-4a906fa4.js';
3
- import { D as DoneCallback, F as FakeTimerInstallOpts, a as File, T as TaskResultPack, R as ResolvedConfig, M as ModuleGraphData, b as Reporter } from './global-60f880c6.js';
4
- export { A as ApiConfig, C as ArgumentsType, z as Arrayable, y as Awaitable, B as BuiltinEnvironment, a0 as C8Options, O as Constructable, $ as CoverageReporter, K as DeepMerge, D as DoneCallback, W as Environment, E as EnvironmentOptions, Q as EnvironmentReturn, _ as ErrorWithDiff, a as File, l as HookCleanupCallback, H as HookListener, I as InlineConfig, J as JSDOMOptions, G as MergeInsertions, P as ModuleCache, M as ModuleGraphData, L as MutableArray, N as Nullable, Z as ParsedStack, Y as Position, b as Reporter, a1 as ResolvedC8Options, R as ResolvedConfig, c as RunMode, p as RuntimeContext, r as SnapshotData, u as SnapshotMatchOptions, v as SnapshotResult, t as SnapshotStateOptions, x as SnapshotSummary, s as SnapshotUpdateState, S as Suite, k as SuiteAPI, n as SuiteCollector, o as SuiteFactory, m as SuiteHooks, h as Task, e as TaskBase, f as TaskResult, T as TaskResultPack, d as TaskState, g as Test, j as TestAPI, q as TestContext, i as TestFunction, w as UncheckedSnapshot, U as UserConfig, X as UserConsoleLog, V as Vitest } from './global-60f880c6.js';
1
+ import { s as spyOn, f as fn, M as MaybeMockedDeep, a as MaybeMocked, b as MaybePartiallyMocked, c as MaybePartiallyMockedDeep, E as EnhancedSpy } from './index-5f09f4d0.js';
2
+ export { E as EnhancedSpy, r as Mock, u as MockContext, q as MockInstance, v as Mocked, w as MockedClass, o as MockedFunction, p as MockedObject, S as SpyInstance, j as afterAll, l as afterEach, h as beforeAll, k as beforeEach, g as bench, n as createExpect, e as describe, m as expect, i as it, d as suite, t as test } from './index-5f09f4d0.js';
3
+ import { D as DoneCallback, F as FakeTimerInstallOpts, a as File, T as TaskResultPack, R as ResolvedConfig, M as ModuleGraphData, b as Reporter } from './global-ea084c9f.js';
4
+ export { L as AfterSuiteRunMeta, A as ApiConfig, Y as ArgumentsType, X as Arrayable, P as Awaitable, ae as BaseCoverageOptions, ak as BenchFunction, ai as Benchmark, al as BenchmarkAPI, aj as BenchmarkResult, ah as BenchmarkUserOptions, B as BuiltinEnvironment, C as CSSModuleScopeStrategy, a0 as Constructable, ag as CoverageC8Options, af as CoverageIstanbulOptions, ac as CoverageOptions, a9 as CoverageProvider, aa as CoverageProviderModule, ab as CoverageReporter, _ as DeepMerge, D as DoneCallback, a3 as Environment, E as EnvironmentOptions, a2 as EnvironmentReturn, a7 as ErrorWithDiff, a as File, n as HookCleanupCallback, H as HookListener, I as InlineConfig, J as JSDOMOptions, Z as MergeInsertions, a1 as ModuleCache, M as ModuleGraphData, $ as MutableArray, Q as Nullable, a8 as OnServerRestartHandler, a6 as ParsedStack, a5 as Position, b as Reporter, K as ResolveIdFunction, R as ResolvedConfig, ad as ResolvedCoverageOptions, d as RunMode, r as RuntimeContext, u as SnapshotData, x as SnapshotMatchOptions, y as SnapshotResult, w as SnapshotStateOptions, G as SnapshotSummary, v as SnapshotUpdateState, S as Suite, m as SuiteAPI, p as SuiteCollector, q as SuiteFactory, o as SuiteHooks, i as Task, f as TaskBase, g as TaskResult, T as TaskResultPack, e as TaskState, h as Test, l as TestAPI, s as TestContext, j as TestFunction, k as TestOptions, z as UncheckedSnapshot, U as UserConfig, a4 as UserConsoleLog, t as Vitest, V as VitestEnvironment, c as VitestRunMode, W as WorkerContext, O as WorkerGlobalState, N as WorkerRPC } from './global-ea084c9f.js';
5
5
  import { TransformResult } from 'vite';
6
6
  import * as chai from 'chai';
7
7
  export { chai };
8
8
  export { assert, should } from 'chai';
9
- import 'worker_threads';
10
- import './mocker-5e2a8e41.js';
9
+ export { Bench as BenchFactory, Options as BenchOptions, Task as BenchTask, TaskResult as BenchTaskResult } from 'tinybench';
11
10
  import 'tinyspy';
12
11
  import 'fs';
12
+ import 'worker_threads';
13
13
 
14
14
  /**
15
15
  * A simple wrapper for converting callback style to promise
package/dist/index.mjs CHANGED
@@ -1,18 +1,19 @@
1
- export { c as createExpect, d as describe, b as expect, i as it, s as suite, t as test } from './chunk-runtime-chain.98d42d89.mjs';
2
- export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach, h as getRunningMode, f as isFirstRun, j as isWatchMode, e as runOnce, v as vi, g as vitest, w as withCallback } from './chunk-runtime-hooks.453f8858.mjs';
1
+ export { b as bench, c as createExpect, d as describe, e as expect, i as it, s as suite, t as test } from './chunk-runtime-chain.2af36ddf.mjs';
2
+ export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach, h as getRunningMode, f as isFirstRun, j as isWatchMode, e as runOnce, v as vi, g as vitest, w as withCallback } from './chunk-runtime-hooks.75ce0575.mjs';
3
3
  import * as chai from 'chai';
4
4
  export { chai };
5
5
  export { assert, should } from 'chai';
6
6
  import 'util';
7
- import './chunk-mock-date.bc81a3ac.mjs';
7
+ import './chunk-mock-date.0d86eaa5.mjs';
8
8
  import 'path';
9
+ import './chunk-constants.6196597b.mjs';
9
10
  import 'tty';
11
+ import 'url';
10
12
  import 'local-pkg';
11
13
  import './vendor-_commonjsHelpers.4da45ef5.mjs';
12
- import './chunk-runtime-rpc.b50ab560.mjs';
13
- import './chunk-utils-global.fa20c2f6.mjs';
14
+ import './chunk-runtime-rpc.3fe371e9.mjs';
14
15
  import './chunk-utils-timers.b48455ed.mjs';
15
16
  import 'fs';
16
- import './chunk-utils-source-map.94107ee8.mjs';
17
+ import './chunk-utils-source-map.70ee97e1.mjs';
17
18
  import './spy.mjs';
18
19
  import 'tinyspy';
package/dist/loader.mjs CHANGED
@@ -1,13 +1,13 @@
1
1
  import { pathToFileURL } from 'url';
2
2
  import { readFile } from 'fs/promises';
3
- import { i as isNodeBuiltin, d as normalizeModuleId, h as hasCJSSyntax } from './chunk-vite-node-utils.f34df9d3.mjs';
4
- import './chunk-mock-date.bc81a3ac.mjs';
5
- import { g as getWorkerState } from './chunk-utils-global.fa20c2f6.mjs';
3
+ import { i as isNodeBuiltin, d as normalizeModuleId, h as hasCJSSyntax } from './chunk-vite-node-utils.68573626.mjs';
4
+ import { g as getWorkerState } from './chunk-mock-date.0d86eaa5.mjs';
6
5
  import 'module';
7
6
  import 'fs';
8
7
  import 'path';
9
8
  import 'assert';
10
9
  import 'util';
10
+ import './chunk-constants.6196597b.mjs';
11
11
  import 'tty';
12
12
  import 'local-pkg';
13
13
 
package/dist/node.d.ts CHANGED
@@ -1,10 +1,11 @@
1
- import { U as UserConfig, V as Vitest, a5 as ModuleCacheMap, a6 as ViteNodeRunnerOptions, a7 as ViteNodeRunner, a8 as TestSequencer } from './global-60f880c6.js';
2
- export { a8 as TestSequencer, aa as TestSequencerConstructor, V as Vitest, a9 as startVitest } from './global-60f880c6.js';
1
+ import { c as VitestRunMode, U as UserConfig, t as Vitest, am as ModuleCacheMap, an as ViteNodeRunnerOptions, ao as MockMap, ap as ViteNodeRunner, aq as TestSequencer } from './global-ea084c9f.js';
2
+ export { aq as TestSequencer, as as TestSequencerConstructor, t as Vitest, ar as startVitest } from './global-ea084c9f.js';
3
3
  import { UserConfig as UserConfig$1, Plugin } from 'vite';
4
- import { M as MockMap } from './mocker-5e2a8e41.js';
4
+ import 'tinybench';
5
5
  import 'fs';
6
+ import 'worker_threads';
6
7
 
7
- declare function createVitest(options: UserConfig, viteOverrides?: UserConfig$1): Promise<Vitest>;
8
+ declare function createVitest(mode: VitestRunMode, options: UserConfig, viteOverrides?: UserConfig$1): Promise<Vitest>;
8
9
 
9
10
  declare function VitestPlugin(options?: UserConfig, ctx?: Vitest): Promise<Plugin[]>;
10
11
 
package/dist/node.mjs CHANGED
@@ -1,34 +1,37 @@
1
- export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.27aee038.mjs';
2
- export { V as VitestRunner } from './chunk-runtime-mocker.23b62bfa.mjs';
3
- import './chunk-mock-date.bc81a3ac.mjs';
4
- import 'path';
1
+ export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.41bf722e.mjs';
2
+ export { V as VitestRunner } from './chunk-runtime-mocker.fc76f21d.mjs';
3
+ import './chunk-constants.6196597b.mjs';
5
4
  import 'tty';
6
- import 'local-pkg';
7
- import './chunk-defaults.02abff90.mjs';
8
- import 'fs';
9
- import 'module';
10
5
  import 'url';
6
+ import 'path';
7
+ import './chunk-integrations-coverage.99c020eb.mjs';
8
+ import 'local-pkg';
9
+ import './chunk-env-node.ceb43f1c.mjs';
10
+ import 'console';
11
+ import './chunk-mock-date.0d86eaa5.mjs';
11
12
  import 'vite';
12
13
  import 'process';
13
- import './chunk-constants.26dc9f85.mjs';
14
+ import 'fs';
14
15
  import 'os';
15
16
  import 'util';
16
17
  import 'stream';
17
18
  import 'events';
18
19
  import './vendor-_commonjsHelpers.4da45ef5.mjs';
19
- import './chunk-vite-node-client.fdd9592c.mjs';
20
+ import './chunk-vite-node-client.74ebe3d5.mjs';
21
+ import 'module';
20
22
  import 'vm';
21
- import './chunk-vite-node-utils.f34df9d3.mjs';
23
+ import './chunk-vite-node-utils.68573626.mjs';
22
24
  import 'assert';
23
25
  import 'debug';
26
+ import 'perf_hooks';
24
27
  import 'worker_threads';
25
28
  import 'tinypool';
26
- import 'perf_hooks';
27
- import './chunk-utils-source-map.94107ee8.mjs';
29
+ import './chunk-utils-source-map.70ee97e1.mjs';
28
30
  import './chunk-utils-timers.b48455ed.mjs';
29
31
  import 'crypto';
30
- import './vendor-index.61438b77.mjs';
31
- import './chunk-magic-string.efe26975.mjs';
32
+ import './vendor-index.13e3bda3.mjs';
33
+ import './vendor-index.731a22f2.mjs';
34
+ import './chunk-magic-string.56b2b543.mjs';
35
+ import 'strip-literal';
32
36
  import 'readline';
33
37
  import './vendor-index.ae96af6e.mjs';
34
- import './chunk-utils-global.fa20c2f6.mjs';
package/dist/suite.mjs CHANGED
@@ -1,15 +1,16 @@
1
1
  import 'util';
2
- import './chunk-mock-date.bc81a3ac.mjs';
3
- export { e as clearCollectorContext, o as createSuiteHooks, f as defaultSuite, d as describe, g as getCurrentSuite, i as it, s as suite, t as test } from './chunk-runtime-chain.98d42d89.mjs';
4
- import './chunk-utils-global.fa20c2f6.mjs';
2
+ import './chunk-mock-date.0d86eaa5.mjs';
3
+ export { b as bench, f as clearCollectorContext, q as createSuiteHooks, h as defaultSuite, d as describe, g as getCurrentSuite, i as it, s as suite, t as test } from './chunk-runtime-chain.2af36ddf.mjs';
5
4
  import 'path';
5
+ import './chunk-constants.6196597b.mjs';
6
6
  import 'tty';
7
+ import 'url';
7
8
  import 'local-pkg';
8
9
  import 'chai';
9
10
  import './vendor-_commonjsHelpers.4da45ef5.mjs';
10
- import './chunk-runtime-rpc.b50ab560.mjs';
11
+ import './chunk-runtime-rpc.3fe371e9.mjs';
11
12
  import './chunk-utils-timers.b48455ed.mjs';
12
13
  import 'fs';
13
- import './chunk-utils-source-map.94107ee8.mjs';
14
+ import './chunk-utils-source-map.70ee97e1.mjs';
14
15
  import './spy.mjs';
15
16
  import 'tinyspy';
@@ -0,0 +1,147 @@
1
+ import { c as commonjsGlobal } from './vendor-_commonjsHelpers.4da45ef5.mjs';
2
+
3
+ function _mergeNamespaces(n, m) {
4
+ m.forEach(function (e) {
5
+ e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
6
+ if (k !== 'default' && !(k in n)) {
7
+ var d = Object.getOwnPropertyDescriptor(e, k);
8
+ Object.defineProperty(n, k, d.get ? d : {
9
+ enumerable: true,
10
+ get: function () { return e[k]; }
11
+ });
12
+ }
13
+ });
14
+ });
15
+ return Object.freeze(n);
16
+ }
17
+
18
+ var eventTargetPolyfill = {};
19
+
20
+ const root =
21
+ (typeof globalThis !== "undefined" && globalThis) ||
22
+ (typeof self !== "undefined" && self) ||
23
+ (typeof commonjsGlobal !== "undefined" && commonjsGlobal);
24
+
25
+ function isConstructor(fn) {
26
+ try {
27
+ new fn();
28
+ } catch (error) {
29
+ return false;
30
+ }
31
+ return true;
32
+ }
33
+
34
+ if (typeof root.Event !== "function" || !isConstructor(root.Event)) {
35
+ root.Event = (function () {
36
+ function Event(type, options) {
37
+ this.bubbles = !!options && !!options.bubbles;
38
+ this.cancelable = !!options && !!options.cancelable;
39
+ this.composed = !!options && !!options.composed;
40
+ this.type = type;
41
+ }
42
+
43
+ return Event;
44
+ })();
45
+ }
46
+
47
+ if (typeof root.EventTarget === "undefined" || !isConstructor(root.Event)) {
48
+ root.EventTarget = (function () {
49
+ function EventTarget() {
50
+ this.__listeners = new Map();
51
+ }
52
+
53
+ EventTarget.prototype = Object.create(Object.prototype);
54
+
55
+ EventTarget.prototype.addEventListener = function (
56
+ type,
57
+ listener,
58
+ options
59
+ ) {
60
+ if (arguments.length < 2) {
61
+ throw new TypeError(
62
+ `TypeError: Failed to execute 'addEventListener' on 'EventTarget': 2 arguments required, but only ${arguments.length} present.`
63
+ );
64
+ }
65
+ const __listeners = this.__listeners;
66
+ const actualType = type.toString();
67
+ if (!__listeners.has(actualType)) {
68
+ __listeners.set(actualType, new Map());
69
+ }
70
+ const listenersForType = __listeners.get(actualType);
71
+ if (!listenersForType.has(listener)) {
72
+ // Any given listener is only registered once
73
+ listenersForType.set(listener, options);
74
+ }
75
+ };
76
+
77
+ EventTarget.prototype.removeEventListener = function (
78
+ type,
79
+ listener,
80
+ _options
81
+ ) {
82
+ if (arguments.length < 2) {
83
+ throw new TypeError(
84
+ `TypeError: Failed to execute 'addEventListener' on 'EventTarget': 2 arguments required, but only ${arguments.length} present.`
85
+ );
86
+ }
87
+ const __listeners = this.__listeners;
88
+ const actualType = type.toString();
89
+ if (__listeners.has(actualType)) {
90
+ const listenersForType = __listeners.get(actualType);
91
+ if (listenersForType.has(listener)) {
92
+ listenersForType.delete(listener);
93
+ }
94
+ }
95
+ };
96
+
97
+ EventTarget.prototype.dispatchEvent = function (event) {
98
+ if (!(event instanceof Event)) {
99
+ throw new TypeError(
100
+ `Failed to execute 'dispatchEvent' on 'EventTarget': parameter 1 is not of type 'Event'.`
101
+ );
102
+ }
103
+ const type = event.type;
104
+ const __listeners = this.__listeners;
105
+ const listenersForType = __listeners.get(type);
106
+ if (listenersForType) {
107
+ for (const [listener, options] of listenersForType.entries()) {
108
+ try {
109
+ if (typeof listener === "function") {
110
+ // Listener functions must be executed with the EventTarget as the `this` context.
111
+ listener.call(this, event);
112
+ } else if (listener && typeof listener.handleEvent === "function") {
113
+ // Listener objects have their handleEvent method called, if they have one
114
+ listener.handleEvent(event);
115
+ }
116
+ } catch (err) {
117
+ // We need to report the error to the global error handling event,
118
+ // but we do not want to break the loop that is executing the events.
119
+ // Unfortunately, this is the best we can do, which isn't great, because the
120
+ // native EventTarget will actually do this synchronously before moving to the next
121
+ // event in the loop.
122
+ setTimeout(() => {
123
+ throw err;
124
+ });
125
+ }
126
+ if (options && options.once) {
127
+ // If this was registered with { once: true }, we need
128
+ // to remove it now.
129
+ listenersForType.delete(listener);
130
+ }
131
+ }
132
+ }
133
+ // Since there are no cancellable events on a base EventTarget,
134
+ // this should always return true.
135
+ return true;
136
+ };
137
+
138
+ return EventTarget;
139
+ })();
140
+ }
141
+
142
+ var index = /*#__PURE__*/_mergeNamespaces({
143
+ __proto__: null,
144
+ 'default': eventTargetPolyfill
145
+ }, [eventTargetPolyfill]);
146
+
147
+ export { index as i };
@@ -0,0 +1,61 @@
1
+ var onetime$1 = {exports: {}};
2
+
3
+ var mimicFn$2 = {exports: {}};
4
+
5
+ const mimicFn$1 = (to, from) => {
6
+ for (const prop of Reflect.ownKeys(from)) {
7
+ Object.defineProperty(to, prop, Object.getOwnPropertyDescriptor(from, prop));
8
+ }
9
+
10
+ return to;
11
+ };
12
+
13
+ mimicFn$2.exports = mimicFn$1;
14
+ // TODO: Remove this for the next major release
15
+ mimicFn$2.exports.default = mimicFn$1;
16
+
17
+ const mimicFn = mimicFn$2.exports;
18
+
19
+ const calledFunctions = new WeakMap();
20
+
21
+ const onetime = (function_, options = {}) => {
22
+ if (typeof function_ !== 'function') {
23
+ throw new TypeError('Expected a function');
24
+ }
25
+
26
+ let returnValue;
27
+ let callCount = 0;
28
+ const functionName = function_.displayName || function_.name || '<anonymous>';
29
+
30
+ const onetime = function (...arguments_) {
31
+ calledFunctions.set(onetime, ++callCount);
32
+
33
+ if (callCount === 1) {
34
+ returnValue = function_.apply(this, arguments_);
35
+ function_ = null;
36
+ } else if (options.throw === true) {
37
+ throw new Error(`Function \`${functionName}\` can only be called once`);
38
+ }
39
+
40
+ return returnValue;
41
+ };
42
+
43
+ mimicFn(onetime, function_);
44
+ calledFunctions.set(onetime, callCount);
45
+
46
+ return onetime;
47
+ };
48
+
49
+ onetime$1.exports = onetime;
50
+ // TODO: Remove this for the next major release
51
+ onetime$1.exports.default = onetime;
52
+
53
+ onetime$1.exports.callCount = function_ => {
54
+ if (!calledFunctions.has(function_)) {
55
+ throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
56
+ }
57
+
58
+ return calledFunctions.get(function_);
59
+ };
60
+
61
+ export { onetime$1 as o };
@@ -1,20 +1,11 @@
1
- import { y as resolve } from './chunk-mock-date.bc81a3ac.mjs';
2
1
  import { Buffer } from 'buffer';
3
2
  import path from 'path';
4
3
  import childProcess from 'child_process';
5
4
  import process$1 from 'process';
6
5
  import { m as mergeStream, g as getStream, c as crossSpawn } from './vendor-index.62ce5c33.mjs';
7
- import _url from 'url';
6
+ import url from 'url';
8
7
  import require$$0, { constants } from 'os';
9
- import { s as signalExit } from './vendor-index.61438b77.mjs';
10
- import 'tty';
11
- import 'local-pkg';
12
- import './vendor-_commonjsHelpers.4da45ef5.mjs';
13
- import 'fs';
14
- import 'stream';
15
- import 'util';
16
- import 'assert';
17
- import 'events';
8
+ import { s as signalExit } from './vendor-index.731a22f2.mjs';
18
9
 
19
10
  function stripFinalNewline(input) {
20
11
  const LF = typeof input === 'string' ? '\n' : '\n'.charCodeAt();
@@ -52,7 +43,7 @@ function npmRunPath(options = {}) {
52
43
  } = options;
53
44
 
54
45
  let previous;
55
- const cwdString = cwd instanceof URL ? _url.fileURLToPath(cwd) : cwd;
46
+ const cwdString = cwd instanceof URL ? url.fileURLToPath(cwd) : cwd;
56
47
  let cwdPath = path.resolve(cwdString);
57
48
  const result = [];
58
49
 
@@ -1077,63 +1068,4 @@ function execa(file, args, options) {
1077
1068
  return mergePromise(spawned, handlePromiseOnce);
1078
1069
  }
1079
1070
 
1080
- class VitestGit {
1081
- constructor(cwd) {
1082
- this.cwd = cwd;
1083
- }
1084
- async resolveFilesWithGitCommand(args) {
1085
- let result;
1086
- try {
1087
- result = await execa("git", args, { cwd: this.root });
1088
- } catch (e) {
1089
- e.message = e.stderr;
1090
- throw e;
1091
- }
1092
- return result.stdout.split("\n").filter((s) => s !== "").map((changedPath) => resolve(this.root, changedPath));
1093
- }
1094
- async findChangedFiles(options) {
1095
- const root = await this.getRoot(this.cwd);
1096
- if (!root)
1097
- return null;
1098
- this.root = root;
1099
- const changedSince = options.changedSince;
1100
- if (typeof changedSince === "string") {
1101
- const [committed, staged2, unstaged2] = await Promise.all([
1102
- this.getFilesSince(changedSince),
1103
- this.getStagedFiles(),
1104
- this.getUnstagedFiles()
1105
- ]);
1106
- return [...committed, ...staged2, ...unstaged2];
1107
- }
1108
- const [staged, unstaged] = await Promise.all([
1109
- this.getStagedFiles(),
1110
- this.getUnstagedFiles()
1111
- ]);
1112
- return [...staged, ...unstaged];
1113
- }
1114
- getFilesSince(hash) {
1115
- return this.resolveFilesWithGitCommand(["diff", "--name-only", `${hash}...HEAD`]);
1116
- }
1117
- getStagedFiles() {
1118
- return this.resolveFilesWithGitCommand(["diff", "--cached", "--name-only"]);
1119
- }
1120
- getUnstagedFiles() {
1121
- return this.resolveFilesWithGitCommand([
1122
- "ls-files",
1123
- "--other",
1124
- "--modified",
1125
- "--exclude-standard"
1126
- ]);
1127
- }
1128
- async getRoot(cwd) {
1129
- const options = ["rev-parse", "--show-cdup"];
1130
- try {
1131
- const result = await execa("git", options, { cwd });
1132
- return resolve(cwd, result.stdout);
1133
- } catch {
1134
- return null;
1135
- }
1136
- }
1137
- }
1138
-
1139
- export { VitestGit };
1071
+ export { execa as e };
@@ -2,66 +2,6 @@ import { c as commonjsGlobal } from './vendor-_commonjsHelpers.4da45ef5.mjs';
2
2
  import assert$1 from 'assert';
3
3
  import require$$2 from 'events';
4
4
 
5
- var onetime$1 = {exports: {}};
6
-
7
- var mimicFn$2 = {exports: {}};
8
-
9
- const mimicFn$1 = (to, from) => {
10
- for (const prop of Reflect.ownKeys(from)) {
11
- Object.defineProperty(to, prop, Object.getOwnPropertyDescriptor(from, prop));
12
- }
13
-
14
- return to;
15
- };
16
-
17
- mimicFn$2.exports = mimicFn$1;
18
- // TODO: Remove this for the next major release
19
- mimicFn$2.exports.default = mimicFn$1;
20
-
21
- const mimicFn = mimicFn$2.exports;
22
-
23
- const calledFunctions = new WeakMap();
24
-
25
- const onetime = (function_, options = {}) => {
26
- if (typeof function_ !== 'function') {
27
- throw new TypeError('Expected a function');
28
- }
29
-
30
- let returnValue;
31
- let callCount = 0;
32
- const functionName = function_.displayName || function_.name || '<anonymous>';
33
-
34
- const onetime = function (...arguments_) {
35
- calledFunctions.set(onetime, ++callCount);
36
-
37
- if (callCount === 1) {
38
- returnValue = function_.apply(this, arguments_);
39
- function_ = null;
40
- } else if (options.throw === true) {
41
- throw new Error(`Function \`${functionName}\` can only be called once`);
42
- }
43
-
44
- return returnValue;
45
- };
46
-
47
- mimicFn(onetime, function_);
48
- calledFunctions.set(onetime, callCount);
49
-
50
- return onetime;
51
- };
52
-
53
- onetime$1.exports = onetime;
54
- // TODO: Remove this for the next major release
55
- onetime$1.exports.default = onetime;
56
-
57
- onetime$1.exports.callCount = function_ => {
58
- if (!calledFunctions.has(function_)) {
59
- throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
60
- }
61
-
62
- return calledFunctions.get(function_);
63
- };
64
-
65
5
  var signalExit = {exports: {}};
66
6
 
67
7
  var signals$1 = {exports: {}};
@@ -332,4 +272,4 @@ if (!processOk(process$1)) {
332
272
  };
333
273
  }
334
274
 
335
- export { onetime$1 as o, signalExit as s };
275
+ export { signalExit as s };