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.
- package/LICENSE.md +61 -33
- package/dist/browser.d.ts +5 -5
- package/dist/browser.mjs +12 -10
- package/dist/{chunk-api-setup.7a6ba7fb.mjs → chunk-api-setup.5fc06d1d.mjs} +94 -91
- package/dist/chunk-constants.6196597b.mjs +284 -0
- package/dist/chunk-env-node.ceb43f1c.mjs +403 -0
- package/dist/{chunk-install-pkg.6c6dc0c2.mjs → chunk-install-pkg.e081fc1b.mjs} +2 -1
- package/dist/chunk-integrations-coverage.99c020eb.mjs +166 -0
- package/dist/{chunk-integrations-globals.44a8f047.mjs → chunk-integrations-globals.ef598c23.mjs} +8 -9
- package/dist/{chunk-magic-string.efe26975.mjs → chunk-magic-string.56b2b543.mjs} +30 -10
- package/dist/chunk-mock-date.0d86eaa5.mjs +332 -0
- package/dist/chunk-node-git.6f289b0a.mjs +84 -0
- package/dist/{chunk-runtime-chain.98d42d89.mjs → chunk-runtime-chain.2af36ddf.mjs} +507 -172
- package/dist/{chunk-runtime-error.87a2b5a2.mjs → chunk-runtime-error.ed9b4f70.mjs} +208 -76
- package/dist/{chunk-runtime-hooks.453f8858.mjs → chunk-runtime-hooks.75ce0575.mjs} +18 -12
- package/dist/{chunk-runtime-mocker.23b62bfa.mjs → chunk-runtime-mocker.fc76f21d.mjs} +18 -11
- package/dist/{chunk-runtime-rpc.b50ab560.mjs → chunk-runtime-rpc.3fe371e9.mjs} +1 -2
- package/dist/{chunk-utils-source-map.94107ee8.mjs → chunk-utils-source-map.70ee97e1.mjs} +11 -4
- package/dist/{chunk-vite-node-client.fdd9592c.mjs → chunk-vite-node-client.74ebe3d5.mjs} +97 -31
- package/dist/{chunk-vite-node-debug.09afb76f.mjs → chunk-vite-node-debug.2d8a1dc3.mjs} +3 -3
- package/dist/{chunk-vite-node-externalize.27aee038.mjs → chunk-vite-node-externalize.41bf722e.mjs} +644 -222
- package/dist/{chunk-vite-node-utils.f34df9d3.mjs → chunk-vite-node-utils.68573626.mjs} +60 -42
- package/dist/cli-wrapper.mjs +128 -0
- package/dist/cli.mjs +29 -20
- package/dist/config.cjs +5 -2
- package/dist/config.d.ts +8 -4
- package/dist/config.mjs +4 -3
- package/dist/entry.mjs +20 -15
- package/dist/environments.d.ts +23 -0
- package/dist/environments.mjs +3 -0
- package/dist/{global-60f880c6.d.ts → global-ea084c9f.d.ts} +627 -178
- package/dist/{index-4a906fa4.d.ts → index-5f09f4d0.d.ts} +3 -50
- package/dist/index.d.ts +6 -6
- package/dist/index.mjs +7 -6
- package/dist/loader.mjs +3 -3
- package/dist/node.d.ts +5 -4
- package/dist/node.mjs +19 -16
- package/dist/suite.mjs +6 -5
- package/dist/vendor-index.0557b03a.mjs +147 -0
- package/dist/vendor-index.13e3bda3.mjs +61 -0
- package/dist/{chunk-node-git.c2be9c49.mjs → vendor-index.4aeeb598.mjs} +4 -72
- package/dist/{vendor-index.61438b77.mjs → vendor-index.731a22f2.mjs} +1 -61
- package/dist/worker.mjs +20 -18
- package/package.json +19 -16
- package/vitest.mjs +1 -1
- package/dist/chunk-constants.26dc9f85.mjs +0 -38
- package/dist/chunk-defaults.02abff90.mjs +0 -680
- package/dist/chunk-mock-date.bc81a3ac.mjs +0 -555
- package/dist/chunk-utils-global.fa20c2f6.mjs +0 -5
- package/dist/mocker-5e2a8e41.d.ts +0 -3
package/LICENSE.md
CHANGED
|
@@ -529,6 +529,35 @@ Repository: https://github.com/mathiasbynens/emoji-regex.git
|
|
|
529
529
|
|
|
530
530
|
---------------------------------------
|
|
531
531
|
|
|
532
|
+
## event-target-polyfill
|
|
533
|
+
License: MIT
|
|
534
|
+
By: Ben Lesh
|
|
535
|
+
Repository: git+https://github.com/benlesh/event-target-polyfill.git
|
|
536
|
+
|
|
537
|
+
> MIT License
|
|
538
|
+
>
|
|
539
|
+
> Copyright (c) 2020 Ben Lesh
|
|
540
|
+
>
|
|
541
|
+
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
542
|
+
> of this software and associated documentation files (the "Software"), to deal
|
|
543
|
+
> in the Software without restriction, including without limitation the rights
|
|
544
|
+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
545
|
+
> copies of the Software, and to permit persons to whom the Software is
|
|
546
|
+
> furnished to do so, subject to the following conditions:
|
|
547
|
+
>
|
|
548
|
+
> The above copyright notice and this permission notice shall be included in all
|
|
549
|
+
> copies or substantial portions of the Software.
|
|
550
|
+
>
|
|
551
|
+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
552
|
+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
553
|
+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
554
|
+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
555
|
+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
556
|
+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
557
|
+
> SOFTWARE.
|
|
558
|
+
|
|
559
|
+
---------------------------------------
|
|
560
|
+
|
|
532
561
|
## execa
|
|
533
562
|
License: MIT
|
|
534
563
|
By: Sindre Sorhus
|
|
@@ -898,7 +927,7 @@ Repository: ehmicky/human-signals
|
|
|
898
927
|
> same "printed page" as the copyright notice for easier
|
|
899
928
|
> identification within third-party archives.
|
|
900
929
|
>
|
|
901
|
-
> Copyright
|
|
930
|
+
> Copyright 2021 ehmicky <ehmicky@gmail.com>
|
|
902
931
|
>
|
|
903
932
|
> Licensed under the Apache License, Version 2.0 (the "License");
|
|
904
933
|
> you may not use this file except in compliance with the License.
|
|
@@ -1058,35 +1087,6 @@ Repository: git+https://github.com/isaacs/isexe.git
|
|
|
1058
1087
|
|
|
1059
1088
|
---------------------------------------
|
|
1060
1089
|
|
|
1061
|
-
## jsonc-parser
|
|
1062
|
-
License: MIT
|
|
1063
|
-
By: Microsoft Corporation
|
|
1064
|
-
Repository: https://github.com/microsoft/node-jsonc-parser
|
|
1065
|
-
|
|
1066
|
-
> The MIT License (MIT)
|
|
1067
|
-
>
|
|
1068
|
-
> Copyright (c) Microsoft
|
|
1069
|
-
>
|
|
1070
|
-
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1071
|
-
> of this software and associated documentation files (the "Software"), to deal
|
|
1072
|
-
> in the Software without restriction, including without limitation the rights
|
|
1073
|
-
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1074
|
-
> copies of the Software, and to permit persons to whom the Software is
|
|
1075
|
-
> furnished to do so, subject to the following conditions:
|
|
1076
|
-
>
|
|
1077
|
-
> The above copyright notice and this permission notice shall be included in all
|
|
1078
|
-
> copies or substantial portions of the Software.
|
|
1079
|
-
>
|
|
1080
|
-
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1081
|
-
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1082
|
-
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1083
|
-
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1084
|
-
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1085
|
-
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1086
|
-
> SOFTWARE.
|
|
1087
|
-
|
|
1088
|
-
---------------------------------------
|
|
1089
|
-
|
|
1090
1090
|
## kleur
|
|
1091
1091
|
License: MIT
|
|
1092
1092
|
By: Luke Edwards
|
|
@@ -1310,7 +1310,7 @@ Repository: sindresorhus/npm-run-path
|
|
|
1310
1310
|
|
|
1311
1311
|
> MIT License
|
|
1312
1312
|
>
|
|
1313
|
-
> Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
|
1313
|
+
> Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
1314
1314
|
>
|
|
1315
1315
|
> 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:
|
|
1316
1316
|
>
|
|
@@ -1395,7 +1395,7 @@ Repository: sindresorhus/path-key
|
|
|
1395
1395
|
|
|
1396
1396
|
> MIT License
|
|
1397
1397
|
>
|
|
1398
|
-
> Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
|
1398
|
+
> Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
1399
1399
|
>
|
|
1400
1400
|
> 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:
|
|
1401
1401
|
>
|
|
@@ -1911,7 +1911,7 @@ Repository: sindresorhus/strip-final-newline
|
|
|
1911
1911
|
|
|
1912
1912
|
> MIT License
|
|
1913
1913
|
>
|
|
1914
|
-
> Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
|
1914
|
+
> Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
1915
1915
|
>
|
|
1916
1916
|
> 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:
|
|
1917
1917
|
>
|
|
@@ -1977,6 +1977,34 @@ Repository: git+ssh://git@github.com/chaijs/type-detect.git
|
|
|
1977
1977
|
|
|
1978
1978
|
---------------------------------------
|
|
1979
1979
|
|
|
1980
|
+
## ufo
|
|
1981
|
+
License: MIT
|
|
1982
|
+
Repository: unjs/ufo
|
|
1983
|
+
|
|
1984
|
+
> MIT License
|
|
1985
|
+
>
|
|
1986
|
+
> Copyright (c) 2020 Nuxt Contrib
|
|
1987
|
+
>
|
|
1988
|
+
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1989
|
+
> of this software and associated documentation files (the "Software"), to deal
|
|
1990
|
+
> in the Software without restriction, including without limitation the rights
|
|
1991
|
+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1992
|
+
> copies of the Software, and to permit persons to whom the Software is
|
|
1993
|
+
> furnished to do so, subject to the following conditions:
|
|
1994
|
+
>
|
|
1995
|
+
> The above copyright notice and this permission notice shall be included in all
|
|
1996
|
+
> copies or substantial portions of the Software.
|
|
1997
|
+
>
|
|
1998
|
+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1999
|
+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
2000
|
+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
2001
|
+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
2002
|
+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
2003
|
+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
2004
|
+
> SOFTWARE.
|
|
2005
|
+
|
|
2006
|
+
---------------------------------------
|
|
2007
|
+
|
|
1980
2008
|
## vite-node
|
|
1981
2009
|
License: MIT
|
|
1982
2010
|
By: Anthony Fu
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export { E as EnhancedSpy,
|
|
2
|
-
import { R as ResolvedConfig } from './global-
|
|
3
|
-
export { A as ApiConfig,
|
|
1
|
+
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, n as createExpect, e as describe, m as expect, i as it, d as suite, t as test } from './index-5f09f4d0.js';
|
|
2
|
+
import { R as ResolvedConfig } from './global-ea084c9f.js';
|
|
3
|
+
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';
|
|
4
4
|
import * as chai from 'chai';
|
|
5
5
|
export { chai };
|
|
6
6
|
export { assert, should } from 'chai';
|
|
7
|
-
|
|
8
|
-
import './mocker-5e2a8e41.js';
|
|
7
|
+
export { Bench as BenchFactory, Options as BenchOptions, Task as BenchTask, TaskResult as BenchTaskResult } from 'tinybench';
|
|
9
8
|
import 'tinyspy';
|
|
10
9
|
import 'vite';
|
|
11
10
|
import 'fs';
|
|
11
|
+
import 'worker_threads';
|
|
12
12
|
|
|
13
13
|
declare function startTests(paths: string[], config: ResolvedConfig): Promise<void>;
|
|
14
14
|
|
package/dist/browser.mjs
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
export { c as createExpect, d as describe,
|
|
2
|
-
export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach } from './chunk-runtime-hooks.
|
|
3
|
-
export { a as setupGlobalEnv, s as startTests } from './chunk-runtime-error.
|
|
1
|
+
export { 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 } from './chunk-runtime-hooks.75ce0575.mjs';
|
|
3
|
+
export { a as setupGlobalEnv, s as startTests } from './chunk-runtime-error.ed9b4f70.mjs';
|
|
4
4
|
import * as chai from 'chai';
|
|
5
5
|
export { chai };
|
|
6
6
|
export { assert, should } from 'chai';
|
|
7
7
|
import 'util';
|
|
8
|
-
import './chunk-mock-date.
|
|
8
|
+
import './chunk-mock-date.0d86eaa5.mjs';
|
|
9
9
|
import 'path';
|
|
10
|
+
import './chunk-constants.6196597b.mjs';
|
|
10
11
|
import 'tty';
|
|
12
|
+
import 'url';
|
|
11
13
|
import 'local-pkg';
|
|
12
14
|
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
13
|
-
import './chunk-runtime-rpc.
|
|
14
|
-
import './chunk-utils-global.fa20c2f6.mjs';
|
|
15
|
+
import './chunk-runtime-rpc.3fe371e9.mjs';
|
|
15
16
|
import './chunk-utils-timers.b48455ed.mjs';
|
|
16
17
|
import 'fs';
|
|
17
|
-
import './chunk-utils-source-map.
|
|
18
|
+
import './chunk-utils-source-map.70ee97e1.mjs';
|
|
18
19
|
import './spy.mjs';
|
|
19
20
|
import 'tinyspy';
|
|
20
|
-
import '
|
|
21
|
-
import '
|
|
22
|
-
import '
|
|
21
|
+
import 'perf_hooks';
|
|
22
|
+
import './chunk-integrations-coverage.99c020eb.mjs';
|
|
23
|
+
import './chunk-env-node.ceb43f1c.mjs';
|
|
24
|
+
import 'console';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { promises } from 'fs';
|
|
2
|
-
import { c as createBirpc } from './chunk-vite-node-client.
|
|
2
|
+
import { c as createBirpc } from './chunk-vite-node-client.74ebe3d5.mjs';
|
|
3
3
|
import require$$0$1 from 'stream';
|
|
4
4
|
import require$$0 from 'zlib';
|
|
5
5
|
import require$$3 from 'net';
|
|
@@ -8,19 +8,19 @@ import require$$5 from 'crypto';
|
|
|
8
8
|
import require$$2 from 'events';
|
|
9
9
|
import require$$1 from 'https';
|
|
10
10
|
import require$$2$1 from 'http';
|
|
11
|
-
import
|
|
12
|
-
import { A as API_PATH } from './chunk-constants.
|
|
13
|
-
import {
|
|
11
|
+
import url from 'url';
|
|
12
|
+
import { A as API_PATH } from './chunk-constants.6196597b.mjs';
|
|
13
|
+
import { i as interpretSourcePos, p as parseStacktrace } from './chunk-utils-source-map.70ee97e1.mjs';
|
|
14
14
|
import 'module';
|
|
15
15
|
import 'vm';
|
|
16
|
-
import './chunk-
|
|
16
|
+
import './chunk-vite-node-utils.68573626.mjs';
|
|
17
17
|
import 'path';
|
|
18
|
-
import 'tty';
|
|
19
|
-
import 'local-pkg';
|
|
20
|
-
import './chunk-vite-node-utils.f34df9d3.mjs';
|
|
21
18
|
import 'assert';
|
|
22
19
|
import 'util';
|
|
23
20
|
import 'debug';
|
|
21
|
+
import 'tty';
|
|
22
|
+
import './chunk-mock-date.0d86eaa5.mjs';
|
|
23
|
+
import 'local-pkg';
|
|
24
24
|
|
|
25
25
|
/*! (c) 2020 Andrea Giammarchi */
|
|
26
26
|
|
|
@@ -2514,7 +2514,7 @@ const http$1 = require$$2$1;
|
|
|
2514
2514
|
const net = require$$3;
|
|
2515
2515
|
const tls = require$$4;
|
|
2516
2516
|
const { randomBytes, createHash: createHash$1 } = require$$5;
|
|
2517
|
-
const { URL: URL$1 } =
|
|
2517
|
+
const { URL: URL$1 } = url;
|
|
2518
2518
|
|
|
2519
2519
|
const PerMessageDeflate$1 = permessageDeflate;
|
|
2520
2520
|
const Receiver = receiver;
|
|
@@ -4417,94 +4417,97 @@ function setup(ctx) {
|
|
|
4417
4417
|
});
|
|
4418
4418
|
});
|
|
4419
4419
|
function setupClient(ws) {
|
|
4420
|
-
const rpc = createBirpc(
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4420
|
+
const rpc = createBirpc(
|
|
4421
|
+
{
|
|
4422
|
+
async onWatcherStart() {
|
|
4423
|
+
await ctx.report("onWatcherStart");
|
|
4424
|
+
},
|
|
4425
|
+
async onFinished() {
|
|
4426
|
+
await ctx.report("onFinished");
|
|
4427
|
+
},
|
|
4428
|
+
async onCollected(files) {
|
|
4429
|
+
ctx.state.collectFiles(files);
|
|
4430
|
+
await ctx.report("onCollected", files);
|
|
4431
|
+
},
|
|
4432
|
+
async onTaskUpdate(packs) {
|
|
4433
|
+
ctx.state.updateTasks(packs);
|
|
4434
|
+
await ctx.report("onTaskUpdate", packs);
|
|
4435
|
+
},
|
|
4436
|
+
getFiles() {
|
|
4437
|
+
return ctx.state.getFiles();
|
|
4438
|
+
},
|
|
4439
|
+
async getPaths() {
|
|
4440
|
+
return await ctx.state.getPaths();
|
|
4441
|
+
},
|
|
4442
|
+
readFile(id) {
|
|
4443
|
+
return promises.readFile(id, "utf-8");
|
|
4444
|
+
},
|
|
4445
|
+
writeFile(id, content) {
|
|
4446
|
+
return promises.writeFile(id, content, "utf-8");
|
|
4447
|
+
},
|
|
4448
|
+
async rerun(files) {
|
|
4449
|
+
await ctx.rerunFiles(files);
|
|
4450
|
+
},
|
|
4451
|
+
getConfig() {
|
|
4452
|
+
return ctx.config;
|
|
4453
|
+
},
|
|
4454
|
+
async getTransformResult(id) {
|
|
4455
|
+
const result = await ctx.vitenode.transformRequest(id);
|
|
4456
|
+
if (result) {
|
|
4457
|
+
try {
|
|
4458
|
+
result.source = result.source || await promises.readFile(id, "utf-8");
|
|
4459
|
+
} catch {
|
|
4460
|
+
}
|
|
4461
|
+
return result;
|
|
4459
4462
|
}
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
return seen.get(mod);
|
|
4475
|
-
let id2 = clearId(mod.id);
|
|
4476
|
-
seen.set(mod, id2);
|
|
4477
|
-
const rewrote = await ctx.vitenode.shouldExternalize(id2);
|
|
4478
|
-
if (rewrote) {
|
|
4479
|
-
id2 = rewrote;
|
|
4480
|
-
externalized.add(id2);
|
|
4463
|
+
},
|
|
4464
|
+
async getModuleGraph(id) {
|
|
4465
|
+
const graph = {};
|
|
4466
|
+
const externalized = /* @__PURE__ */ new Set();
|
|
4467
|
+
const inlined = /* @__PURE__ */ new Set();
|
|
4468
|
+
function clearId(id2) {
|
|
4469
|
+
return (id2 == null ? void 0 : id2.replace(/\?v=\w+$/, "")) || "";
|
|
4470
|
+
}
|
|
4471
|
+
async function get(mod, seen = /* @__PURE__ */ new Map()) {
|
|
4472
|
+
if (!mod || !mod.id)
|
|
4473
|
+
return;
|
|
4474
|
+
if (seen.has(mod))
|
|
4475
|
+
return seen.get(mod);
|
|
4476
|
+
let id2 = clearId(mod.id);
|
|
4481
4477
|
seen.set(mod, id2);
|
|
4482
|
-
|
|
4483
|
-
|
|
4478
|
+
const rewrote = await ctx.vitenode.shouldExternalize(id2);
|
|
4479
|
+
if (rewrote) {
|
|
4480
|
+
id2 = rewrote;
|
|
4481
|
+
externalized.add(id2);
|
|
4482
|
+
seen.set(mod, id2);
|
|
4483
|
+
} else {
|
|
4484
|
+
inlined.add(id2);
|
|
4485
|
+
}
|
|
4486
|
+
const mods = Array.from(mod.importedModules).filter((i) => i.id && !i.id.includes("/vitest/dist/"));
|
|
4487
|
+
graph[id2] = (await Promise.all(mods.map((m) => get(m, seen)))).filter(Boolean);
|
|
4488
|
+
return id2;
|
|
4484
4489
|
}
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4490
|
+
await get(ctx.server.moduleGraph.getModuleById(id));
|
|
4491
|
+
return {
|
|
4492
|
+
graph,
|
|
4493
|
+
externalized: Array.from(externalized),
|
|
4494
|
+
inlined: Array.from(inlined)
|
|
4495
|
+
};
|
|
4496
|
+
},
|
|
4497
|
+
updateSnapshot(file) {
|
|
4498
|
+
if (!file)
|
|
4499
|
+
return ctx.updateSnapshot();
|
|
4500
|
+
return ctx.updateSnapshot([file.filepath]);
|
|
4488
4501
|
}
|
|
4489
|
-
await get(ctx.server.moduleGraph.getModuleById(id));
|
|
4490
|
-
return {
|
|
4491
|
-
graph,
|
|
4492
|
-
externalized: Array.from(externalized),
|
|
4493
|
-
inlined: Array.from(inlined)
|
|
4494
|
-
};
|
|
4495
4502
|
},
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4503
|
+
{
|
|
4504
|
+
post: (msg) => ws.send(msg),
|
|
4505
|
+
on: (fn) => ws.on("message", fn),
|
|
4506
|
+
eventNames: ["onUserConsoleLog", "onFinished", "onCollected"],
|
|
4507
|
+
serialize: stringify,
|
|
4508
|
+
deserialize: parse$3
|
|
4500
4509
|
}
|
|
4501
|
-
|
|
4502
|
-
post: (msg) => ws.send(msg),
|
|
4503
|
-
on: (fn) => ws.on("message", fn),
|
|
4504
|
-
eventNames: ["onUserConsoleLog", "onFinished", "onCollected"],
|
|
4505
|
-
serialize: stringify,
|
|
4506
|
-
deserialize: parse$3
|
|
4507
|
-
});
|
|
4510
|
+
);
|
|
4508
4511
|
clients.set(ws, rpc);
|
|
4509
4512
|
ws.on("close", () => {
|
|
4510
4513
|
clients.delete(ws);
|