@voidzero-dev/vite-plus-test 0.0.0-0bfcc90f.20260209-0731
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 +691 -0
- package/browser/context.d.ts +4 -0
- package/browser/context.js +20 -0
- package/config.d.ts +3 -0
- package/coverage.d.ts +1 -0
- package/dist/@vitest/browser/client/.vite/manifest.json +24 -0
- package/dist/@vitest/browser/client/__vitest__/assets/index-BUCFJtth.js +57 -0
- package/dist/@vitest/browser/client/__vitest__/assets/index-DlhE0rqZ.css +1 -0
- package/dist/@vitest/browser/client/__vitest__/bg.png +0 -0
- package/dist/@vitest/browser/client/__vitest__/favicon.ico +0 -0
- package/dist/@vitest/browser/client/__vitest__/favicon.svg +5 -0
- package/dist/@vitest/browser/client/__vitest__/index.html +32 -0
- package/dist/@vitest/browser/client/__vitest_browser__/orchestrator-S_3e_uzt.js +345 -0
- package/dist/@vitest/browser/client/__vitest_browser__/tester-k74mgIRa.js +2171 -0
- package/dist/@vitest/browser/client/__vitest_browser__/utils-uxqdqUz8.js +223 -0
- package/dist/@vitest/browser/client/error-catcher.js +82 -0
- package/dist/@vitest/browser/client/esm-client-injector.js +67 -0
- package/dist/@vitest/browser/client/favicon.svg +5 -0
- package/dist/@vitest/browser/client/orchestrator.html +35 -0
- package/dist/@vitest/browser/client/tester/tester.html +13 -0
- package/dist/@vitest/browser/client.js +456 -0
- package/dist/@vitest/browser/context.d.ts +792 -0
- package/dist/@vitest/browser/context.js +541 -0
- package/dist/@vitest/browser/expect-element.js +32 -0
- package/dist/@vitest/browser/index-D6m36C6U.js +11 -0
- package/dist/@vitest/browser/index.d.ts +73 -0
- package/dist/@vitest/browser/index.js +3513 -0
- package/dist/@vitest/browser/jest-dom.d.ts +724 -0
- package/dist/@vitest/browser/locators.d.ts +354 -0
- package/dist/@vitest/browser/locators.js +1 -0
- package/dist/@vitest/browser/matchers.d.ts +29 -0
- package/dist/@vitest/browser/shared/screenshotMatcher/types.d.ts +22 -0
- package/dist/@vitest/browser/state.js +280 -0
- package/dist/@vitest/browser/types.d.ts +69 -0
- package/dist/@vitest/browser-playwright/context.d.ts +1 -0
- package/dist/@vitest/browser-playwright/index.d.ts +106 -0
- package/dist/@vitest/browser-playwright/index.js +1111 -0
- package/dist/@vitest/browser-playwright/locators.js +114 -0
- package/dist/@vitest/browser-preview/context.d.ts +1 -0
- package/dist/@vitest/browser-preview/index.d.ts +19 -0
- package/dist/@vitest/browser-preview/index.js +148 -0
- package/dist/@vitest/browser-preview/locators.js +79 -0
- package/dist/@vitest/browser-webdriverio/context.d.ts +1 -0
- package/dist/@vitest/browser-webdriverio/index.d.ts +63 -0
- package/dist/@vitest/browser-webdriverio/index.js +600 -0
- package/dist/@vitest/browser-webdriverio/locators.js +163 -0
- package/dist/@vitest/expect/index.d.ts +807 -0
- package/dist/@vitest/expect/index.js +1875 -0
- package/dist/@vitest/mocker/auto-register.d.ts +2 -0
- package/dist/@vitest/mocker/auto-register.js +9 -0
- package/dist/@vitest/mocker/automock.d.ts +12 -0
- package/dist/@vitest/mocker/automock.js +1 -0
- package/dist/@vitest/mocker/browser.d.ts +53 -0
- package/dist/@vitest/mocker/browser.js +91 -0
- package/dist/@vitest/mocker/chunk-automock.js +354 -0
- package/dist/@vitest/mocker/chunk-interceptor-native.js +15 -0
- package/dist/@vitest/mocker/chunk-mocker.js +521 -0
- package/dist/@vitest/mocker/chunk-pathe.M-eThtNZ.js +174 -0
- package/dist/@vitest/mocker/chunk-registry.js +185 -0
- package/dist/@vitest/mocker/chunk-utils.js +16 -0
- package/dist/@vitest/mocker/index.d-C-sLYZi-.d.ts +25 -0
- package/dist/@vitest/mocker/index.d.ts +2 -0
- package/dist/@vitest/mocker/index.js +185 -0
- package/dist/@vitest/mocker/mocker.d-TnKRhz7N.d.ts +81 -0
- package/dist/@vitest/mocker/node.d.ts +800 -0
- package/dist/@vitest/mocker/node.js +966 -0
- package/dist/@vitest/mocker/redirect.d.ts +3 -0
- package/dist/@vitest/mocker/redirect.js +79 -0
- package/dist/@vitest/mocker/register.d.ts +9 -0
- package/dist/@vitest/mocker/register.js +41 -0
- package/dist/@vitest/mocker/types.d-B8CCKmHt.d.ts +107 -0
- package/dist/@vitest/pretty-format/index.d.ts +124 -0
- package/dist/@vitest/pretty-format/index.js +1022 -0
- package/dist/@vitest/runner/chunk-tasks.js +340 -0
- package/dist/@vitest/runner/index.d.ts +180 -0
- package/dist/@vitest/runner/index.js +2114 -0
- package/dist/@vitest/runner/tasks.d-C7UxawJ9.d.ts +834 -0
- package/dist/@vitest/runner/types.d.ts +183 -0
- package/dist/@vitest/runner/types.js +1 -0
- package/dist/@vitest/runner/utils.d.ts +45 -0
- package/dist/@vitest/runner/utils.js +5 -0
- package/dist/@vitest/snapshot/environment.d-DHdQ1Csl.d.ts +22 -0
- package/dist/@vitest/snapshot/environment.d.ts +16 -0
- package/dist/@vitest/snapshot/environment.js +40 -0
- package/dist/@vitest/snapshot/index.d.ts +130 -0
- package/dist/@vitest/snapshot/index.js +1437 -0
- package/dist/@vitest/snapshot/manager.d.ts +18 -0
- package/dist/@vitest/snapshot/manager.js +73 -0
- package/dist/@vitest/snapshot/rawSnapshot.d-lFsMJFUd.d.ts +61 -0
- package/dist/@vitest/spy/index.d.ts +384 -0
- package/dist/@vitest/spy/index.js +433 -0
- package/dist/@vitest/utils/chunk-_commonjsHelpers.js +5 -0
- package/dist/@vitest/utils/chunk-pathe.M-eThtNZ.js +156 -0
- package/dist/@vitest/utils/constants.d.ts +21 -0
- package/dist/@vitest/utils/constants.js +49 -0
- package/dist/@vitest/utils/diff.d.ts +93 -0
- package/dist/@vitest/utils/diff.js +2199 -0
- package/dist/@vitest/utils/display.d.ts +29 -0
- package/dist/@vitest/utils/display.js +742 -0
- package/dist/@vitest/utils/error.d.ts +7 -0
- package/dist/@vitest/utils/error.js +42 -0
- package/dist/@vitest/utils/helpers.d.ts +73 -0
- package/dist/@vitest/utils/helpers.js +295 -0
- package/dist/@vitest/utils/highlight.d.ts +9 -0
- package/dist/@vitest/utils/highlight.js +538 -0
- package/dist/@vitest/utils/index.d.ts +5 -0
- package/dist/@vitest/utils/index.js +1 -0
- package/dist/@vitest/utils/offset.d.ts +5 -0
- package/dist/@vitest/utils/offset.js +32 -0
- package/dist/@vitest/utils/resolver.d.ts +7 -0
- package/dist/@vitest/utils/resolver.js +71 -0
- package/dist/@vitest/utils/serialize.d.ts +3 -0
- package/dist/@vitest/utils/serialize.js +118 -0
- package/dist/@vitest/utils/source-map.d.ts +55 -0
- package/dist/@vitest/utils/source-map.js +478 -0
- package/dist/@vitest/utils/timers.d.ts +33 -0
- package/dist/@vitest/utils/timers.js +49 -0
- package/dist/@vitest/utils/types.d-BCElaP-c.d.ts +53 -0
- package/dist/@vitest/utils/types.d.ts +34 -0
- package/dist/@vitest/utils/types.js +1 -0
- package/dist/browser-compat.js +3 -0
- package/dist/browser.d.ts +46 -0
- package/dist/browser.js +20 -0
- package/dist/chunks/_commonjsHelpers.D26ty3Ew.js +6 -0
- package/dist/chunks/base.CJ0Y4ePK.js +165 -0
- package/dist/chunks/benchmark.B3N2zMcH.js +40 -0
- package/dist/chunks/benchmark.d.DAaHLpsq.d.ts +24 -0
- package/dist/chunks/browser.d.ChKACdzH.d.ts +59 -0
- package/dist/chunks/cac.DVeoLl0M.js +1409 -0
- package/dist/chunks/cli-api.B7PN_QUv.js +13672 -0
- package/dist/chunks/config.d.Cy95HiCx.d.ts +210 -0
- package/dist/chunks/console.Cf-YriPC.js +146 -0
- package/dist/chunks/constants.D_Q9UYh-.js +36 -0
- package/dist/chunks/coverage.AVPTjMgw.js +3292 -0
- package/dist/chunks/coverage.D_JHT54q.js +25 -0
- package/dist/chunks/coverage.d.BZtK59WP.d.ts +37 -0
- package/dist/chunks/creator.DAmOKTvJ.js +673 -0
- package/dist/chunks/date.Bq6ZW5rf.js +73 -0
- package/dist/chunks/defaults.BOqNVLsY.js +74 -0
- package/dist/chunks/env.D4Lgay0q.js +8 -0
- package/dist/chunks/environment.d.CrsxCzP1.d.ts +29 -0
- package/dist/chunks/evaluatedModules.Dg1zASAC.js +17 -0
- package/dist/chunks/evaluatedModules.d.BxJ5omdx.d.ts +7 -0
- package/dist/chunks/git.Bm2pzPAa.js +71 -0
- package/dist/chunks/global.d.B15mdLcR.d.ts +99 -0
- package/dist/chunks/globals.DOayXfHP.js +30 -0
- package/dist/chunks/index.6Qv1eEA6.js +109 -0
- package/dist/chunks/index.C5r1PdPD.js +231 -0
- package/dist/chunks/index.Chj8NDwU.js +206 -0
- package/dist/chunks/index.CyBMJtT7.js +727 -0
- package/dist/chunks/index.D3XRDfWc.js +213 -0
- package/dist/chunks/index.D4KonVSU.js +6343 -0
- package/dist/chunks/index.M8mOzt4Y.js +3839 -0
- package/dist/chunks/index.Z5E_ObnR.js +37 -0
- package/dist/chunks/init-forks._y3TW739.js +41 -0
- package/dist/chunks/init-threads.DBO2kn-p.js +18 -0
- package/dist/chunks/init.B6MLFIaN.js +334 -0
- package/dist/chunks/inspector.CvyFGlXm.js +53 -0
- package/dist/chunks/modules.BJuCwlRJ.js +36 -0
- package/dist/chunks/node.Ce0vMQM7.js +14 -0
- package/dist/chunks/plugin.d.CtqpEehP.d.ts +38 -0
- package/dist/chunks/reporters.d.CWXNI2jG.d.ts +3271 -0
- package/dist/chunks/rpc.BoxB0q7B.js +76 -0
- package/dist/chunks/rpc.d.RH3apGEf.d.ts +64 -0
- package/dist/chunks/setup-common.Cm-kSBVi.js +60 -0
- package/dist/chunks/startModuleRunner.DEj0jb3e.js +861 -0
- package/dist/chunks/suite.d.BJWk38HB.d.ts +10 -0
- package/dist/chunks/test.B8ej_ZHS.js +254 -0
- package/dist/chunks/traces.CCmnQaNT.js +217 -0
- package/dist/chunks/traces.d.402V_yFI.d.ts +18 -0
- package/dist/chunks/utils.DvEY5TfP.js +52 -0
- package/dist/chunks/vi.2VT5v0um.js +3919 -0
- package/dist/chunks/vm.D3epNOPZ.js +744 -0
- package/dist/chunks/worker.d.Dyxm8DEL.d.ts +255 -0
- package/dist/cli.js +28 -0
- package/dist/client/.vite/manifest.json +24 -0
- package/dist/client/__vitest__/assets/index-BUCFJtth.js +57 -0
- package/dist/client/__vitest__/assets/index-DlhE0rqZ.css +1 -0
- package/dist/client/__vitest__/bg.png +0 -0
- package/dist/client/__vitest__/favicon.ico +0 -0
- package/dist/client/__vitest__/favicon.svg +5 -0
- package/dist/client/__vitest__/index.html +32 -0
- package/dist/client/__vitest_browser__/orchestrator-S_3e_uzt.js +345 -0
- package/dist/client/__vitest_browser__/tester-k74mgIRa.js +2171 -0
- package/dist/client/__vitest_browser__/utils-uxqdqUz8.js +223 -0
- package/dist/client/error-catcher.js +82 -0
- package/dist/client/esm-client-injector.js +67 -0
- package/dist/client/favicon.svg +5 -0
- package/dist/client/orchestrator.html +35 -0
- package/dist/client/tester/tester.html +13 -0
- package/dist/client.js +456 -0
- package/dist/config.cjs +94 -0
- package/dist/config.d.ts +104 -0
- package/dist/config.js +15 -0
- package/dist/context.js +541 -0
- package/dist/coverage.d.ts +118 -0
- package/dist/coverage.js +23 -0
- package/dist/dummy.js +2 -0
- package/dist/environments.d.ts +22 -0
- package/dist/environments.js +3 -0
- package/dist/expect-element.js +27 -0
- package/dist/index-D6m36C6U.js +6 -0
- package/dist/index-node.js +7 -0
- package/dist/index.d.ts +510 -0
- package/dist/index.js +19 -0
- package/dist/locators.d.ts +354 -0
- package/dist/locators.js +1 -0
- package/dist/mocker.d.ts +1 -0
- package/dist/mocker.js +1 -0
- package/dist/module-evaluator.d.ts +124 -0
- package/dist/module-evaluator.js +343 -0
- package/dist/module-runner-stub.js +44 -0
- package/dist/module-runner.js +17 -0
- package/dist/node.d.ts +251 -0
- package/dist/node.js +98 -0
- package/dist/path.js +7 -0
- package/dist/plugins/browser-client.mjs +2 -0
- package/dist/plugins/browser-context.mjs +2 -0
- package/dist/plugins/browser-locators.mjs +2 -0
- package/dist/plugins/browser-playwright.mjs +2 -0
- package/dist/plugins/browser-preview.mjs +2 -0
- package/dist/plugins/browser-webdriverio.mjs +2 -0
- package/dist/plugins/browser.mjs +2 -0
- package/dist/plugins/expect.mjs +2 -0
- package/dist/plugins/mocker-automock.mjs +2 -0
- package/dist/plugins/mocker-browser.mjs +2 -0
- package/dist/plugins/mocker-node.mjs +2 -0
- package/dist/plugins/mocker-redirect.mjs +2 -0
- package/dist/plugins/mocker-register.mjs +2 -0
- package/dist/plugins/mocker.mjs +2 -0
- package/dist/plugins/pretty-format.mjs +2 -0
- package/dist/plugins/runner-types.mjs +2 -0
- package/dist/plugins/runner-utils.mjs +2 -0
- package/dist/plugins/runner.mjs +2 -0
- package/dist/plugins/snapshot-environment.mjs +2 -0
- package/dist/plugins/snapshot-manager.mjs +2 -0
- package/dist/plugins/snapshot.mjs +2 -0
- package/dist/plugins/spy.mjs +2 -0
- package/dist/plugins/utils-constants.mjs +2 -0
- package/dist/plugins/utils-diff.mjs +2 -0
- package/dist/plugins/utils-display.mjs +2 -0
- package/dist/plugins/utils-error.mjs +2 -0
- package/dist/plugins/utils-helpers.mjs +2 -0
- package/dist/plugins/utils-highlight.mjs +2 -0
- package/dist/plugins/utils-offset.mjs +2 -0
- package/dist/plugins/utils-resolver.mjs +2 -0
- package/dist/plugins/utils-serialize.mjs +2 -0
- package/dist/plugins/utils-source-map.mjs +2 -0
- package/dist/plugins/utils-timers.mjs +2 -0
- package/dist/plugins/utils.mjs +2 -0
- package/dist/reporters.d.ts +27 -0
- package/dist/reporters.js +24 -0
- package/dist/runners.d.ts +50 -0
- package/dist/runners.js +19 -0
- package/dist/shared/screenshotMatcher/types.d.ts +22 -0
- package/dist/snapshot.d.ts +9 -0
- package/dist/snapshot.js +4 -0
- package/dist/spy.js +1 -0
- package/dist/state.js +280 -0
- package/dist/suite.d.ts +5 -0
- package/dist/suite.js +6 -0
- package/dist/types.d.ts +69 -0
- package/dist/vendor/chai.d.mts +1 -0
- package/dist/vendor/chai.mjs +3577 -0
- package/dist/vendor/es-module-lexer.d.mts +193 -0
- package/dist/vendor/es-module-lexer.mjs +79 -0
- package/dist/vendor/estree-walker.d.mts +583 -0
- package/dist/vendor/estree-walker.mjs +339 -0
- package/dist/vendor/expect-type.d.mts +1574 -0
- package/dist/vendor/expect-type.mjs +214 -0
- package/dist/vendor/magic-string.d.mts +261 -0
- package/dist/vendor/magic-string.mjs +1700 -0
- package/dist/vendor/obug.d.mts +56 -0
- package/dist/vendor/obug.mjs +276 -0
- package/dist/vendor/pathe.d.mts +46 -0
- package/dist/vendor/pathe.mjs +496 -0
- package/dist/vendor/picomatch.d.mts +1 -0
- package/dist/vendor/picomatch.mjs +1855 -0
- package/dist/vendor/shared-3g9mwCWP.mjs +31 -0
- package/dist/vendor/std-env.d.mts +88 -0
- package/dist/vendor/std-env.mjs +159 -0
- package/dist/vendor/tinybench.d.mts +317 -0
- package/dist/vendor/tinybench.mjs +504 -0
- package/dist/vendor/tinyexec.d.mts +72 -0
- package/dist/vendor/tinyexec.mjs +637 -0
- package/dist/vendor/tinyglobby.d.mts +157 -0
- package/dist/vendor/tinyglobby.mjs +832 -0
- package/dist/vendor/tinyrainbow.d.mts +60 -0
- package/dist/vendor/tinyrainbow.mjs +93 -0
- package/dist/vendor/vitest_browser.mjs +2 -0
- package/dist/vendor/vitest_internal_browser.mjs +2 -0
- package/dist/vendor/vitest_runner.mjs +2 -0
- package/dist/vendor/vitest_runners.mjs +2 -0
- package/dist/worker.d.ts +32 -0
- package/dist/worker.js +48 -0
- package/dist/workers/forks.js +54 -0
- package/dist/workers/runVmTests.js +95 -0
- package/dist/workers/threads.js +55 -0
- package/dist/workers/vmForks.js +36 -0
- package/dist/workers/vmThreads.js +37 -0
- package/environments.d.ts +1 -0
- package/globals.d.ts +20 -0
- package/import-meta.d.ts +5 -0
- package/importMeta.d.ts +4 -0
- package/index.cjs +5 -0
- package/index.d.cts +1 -0
- package/jsdom.d.ts +6 -0
- package/mocker.d.ts +1 -0
- package/node.d.ts +1 -0
- package/optional-types.d.ts +7 -0
- package/package.json +335 -0
- package/reporters.d.ts +1 -0
- package/runners.d.ts +1 -0
- package/snapshot.d.ts +1 -0
- package/suite.d.ts +1 -0
- package/suppress-warnings.cjs +21 -0
- package/vitest.mjs +2 -0
- package/worker.d.ts +1 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/* Ported from https://github.com/boblauer/MockDate/blob/master/src/mockdate.ts */
|
|
2
|
+
/*
|
|
3
|
+
The MIT License (MIT)
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2014 Bob Lauer
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
in the Software without restriction, including without limitation the rights
|
|
10
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
furnished to do so, subject to the following conditions:
|
|
13
|
+
|
|
14
|
+
The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
SOFTWARE.
|
|
24
|
+
*/
|
|
25
|
+
const RealDate = Date;
|
|
26
|
+
let now = null;
|
|
27
|
+
class MockDate extends RealDate {
|
|
28
|
+
constructor(y, m, d, h, M, s, ms) {
|
|
29
|
+
super();
|
|
30
|
+
let date;
|
|
31
|
+
switch (arguments.length) {
|
|
32
|
+
case 0:
|
|
33
|
+
if (now !== null) date = new RealDate(now.valueOf());
|
|
34
|
+
else date = new RealDate();
|
|
35
|
+
break;
|
|
36
|
+
case 1:
|
|
37
|
+
date = new RealDate(y);
|
|
38
|
+
break;
|
|
39
|
+
default:
|
|
40
|
+
d = typeof d === "undefined" ? 1 : d;
|
|
41
|
+
h = h || 0;
|
|
42
|
+
M = M || 0;
|
|
43
|
+
s = s || 0;
|
|
44
|
+
ms = ms || 0;
|
|
45
|
+
date = new RealDate(y, m, d, h, M, s, ms);
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
Object.setPrototypeOf(date, MockDate.prototype);
|
|
49
|
+
return date;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
MockDate.UTC = RealDate.UTC;
|
|
53
|
+
MockDate.now = function() {
|
|
54
|
+
return new MockDate().valueOf();
|
|
55
|
+
};
|
|
56
|
+
MockDate.parse = function(dateString) {
|
|
57
|
+
return RealDate.parse(dateString);
|
|
58
|
+
};
|
|
59
|
+
MockDate.toString = function() {
|
|
60
|
+
return RealDate.toString();
|
|
61
|
+
};
|
|
62
|
+
function mockDate(date) {
|
|
63
|
+
const dateObj = new RealDate(date.valueOf());
|
|
64
|
+
if (Number.isNaN(dateObj.getTime())) throw new TypeError(`mockdate: The time set is an invalid date: ${date}`);
|
|
65
|
+
// @ts-expect-error global
|
|
66
|
+
globalThis.Date = MockDate;
|
|
67
|
+
now = dateObj.valueOf();
|
|
68
|
+
}
|
|
69
|
+
function resetDate() {
|
|
70
|
+
globalThis.Date = RealDate;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export { RealDate as R, mockDate as m, resetDate as r };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import nodeos__default from 'node:os';
|
|
2
|
+
import './env.D4Lgay0q.js';
|
|
3
|
+
import { isCI } from '../vendor/std-env.mjs';
|
|
4
|
+
|
|
5
|
+
const defaultInclude = ["**/*.{test,spec}.?(c|m)[jt]s?(x)"];
|
|
6
|
+
const defaultExclude = ["**/node_modules/**", "**/.git/**"];
|
|
7
|
+
const benchmarkConfigDefaults = {
|
|
8
|
+
include: ["**/*.{bench,benchmark}.?(c|m)[jt]s?(x)"],
|
|
9
|
+
exclude: defaultExclude,
|
|
10
|
+
includeSource: [],
|
|
11
|
+
reporters: ["default"],
|
|
12
|
+
includeSamples: false
|
|
13
|
+
};
|
|
14
|
+
// These are the generic defaults for coverage. Providers may also set some provider specific defaults.
|
|
15
|
+
const coverageConfigDefaults = {
|
|
16
|
+
provider: "v8",
|
|
17
|
+
enabled: false,
|
|
18
|
+
clean: true,
|
|
19
|
+
cleanOnRerun: true,
|
|
20
|
+
reportsDirectory: "./coverage",
|
|
21
|
+
exclude: [],
|
|
22
|
+
reportOnFailure: false,
|
|
23
|
+
reporter: [
|
|
24
|
+
["text", {}],
|
|
25
|
+
["html", {}],
|
|
26
|
+
["clover", {}],
|
|
27
|
+
["json", {}]
|
|
28
|
+
],
|
|
29
|
+
allowExternal: false,
|
|
30
|
+
excludeAfterRemap: false,
|
|
31
|
+
processingConcurrency: Math.min(20, nodeos__default.availableParallelism?.() ?? nodeos__default.cpus().length)
|
|
32
|
+
};
|
|
33
|
+
const fakeTimersDefaults = {
|
|
34
|
+
loopLimit: 1e4,
|
|
35
|
+
shouldClearNativeTimers: true
|
|
36
|
+
};
|
|
37
|
+
const configDefaults = Object.freeze({
|
|
38
|
+
allowOnly: !isCI,
|
|
39
|
+
isolate: true,
|
|
40
|
+
watch: !isCI && process.stdin.isTTY,
|
|
41
|
+
globals: false,
|
|
42
|
+
environment: "node",
|
|
43
|
+
clearMocks: false,
|
|
44
|
+
restoreMocks: false,
|
|
45
|
+
mockReset: false,
|
|
46
|
+
unstubGlobals: false,
|
|
47
|
+
unstubEnvs: false,
|
|
48
|
+
include: defaultInclude,
|
|
49
|
+
exclude: defaultExclude,
|
|
50
|
+
teardownTimeout: 1e4,
|
|
51
|
+
forceRerunTriggers: ["**/package.json/**", "**/{vitest,vite}.config.*/**"],
|
|
52
|
+
update: false,
|
|
53
|
+
reporters: [],
|
|
54
|
+
silent: false,
|
|
55
|
+
hideSkippedTests: false,
|
|
56
|
+
api: false,
|
|
57
|
+
ui: false,
|
|
58
|
+
uiBase: "/__vitest__/",
|
|
59
|
+
open: !isCI,
|
|
60
|
+
css: { include: [] },
|
|
61
|
+
coverage: coverageConfigDefaults,
|
|
62
|
+
fakeTimers: fakeTimersDefaults,
|
|
63
|
+
maxConcurrency: 5,
|
|
64
|
+
dangerouslyIgnoreUnhandledErrors: false,
|
|
65
|
+
typecheck: {
|
|
66
|
+
checker: "tsc",
|
|
67
|
+
include: ["**/*.{test,spec}-d.?(c|m)[jt]s?(x)"],
|
|
68
|
+
exclude: defaultExclude
|
|
69
|
+
},
|
|
70
|
+
slowTestThreshold: 300,
|
|
71
|
+
disableConsoleIntercept: false
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
export { coverageConfigDefaults as a, defaultInclude as b, configDefaults as c, defaultExclude as d, benchmarkConfigDefaults as e };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { isCI } from '../vendor/std-env.mjs';
|
|
2
|
+
|
|
3
|
+
const isNode = typeof process < "u" && typeof process.stdout < "u" && !process.versions?.deno && !globalThis.window;
|
|
4
|
+
const isDeno = typeof process < "u" && typeof process.stdout < "u" && process.versions?.deno !== void 0;
|
|
5
|
+
const isWindows = (isNode || isDeno) && process.platform === "win32";
|
|
6
|
+
const isTTY = (isNode || isDeno) && process.stdout?.isTTY && !isCI;
|
|
7
|
+
|
|
8
|
+
export { isWindows as a, isTTY as i };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Awaitable } from '../@vitest/utils/index.js';
|
|
2
|
+
|
|
3
|
+
interface EnvironmentReturn {
|
|
4
|
+
teardown: (global: any) => Awaitable<void>;
|
|
5
|
+
}
|
|
6
|
+
interface VmEnvironmentReturn {
|
|
7
|
+
getVmContext: () => {
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
};
|
|
10
|
+
teardown: () => Awaitable<void>;
|
|
11
|
+
}
|
|
12
|
+
interface Environment {
|
|
13
|
+
name: string;
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated use `viteEnvironment` instead. Uses `name` by default
|
|
16
|
+
*/
|
|
17
|
+
transformMode?: "web" | "ssr";
|
|
18
|
+
/**
|
|
19
|
+
* Environment initiated by the Vite server. It is usually available
|
|
20
|
+
* as `vite.server.environments.${name}`.
|
|
21
|
+
*
|
|
22
|
+
* By default, fallbacks to `name`.
|
|
23
|
+
*/
|
|
24
|
+
viteEnvironment?: "client" | "ssr" | ({} & string);
|
|
25
|
+
setupVM?: (options: Record<string, any>) => Awaitable<VmEnvironmentReturn>;
|
|
26
|
+
setup: (global: any, options: Record<string, any>) => Awaitable<EnvironmentReturn>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type { Environment as E, VmEnvironmentReturn as V, EnvironmentReturn as a };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { dirname, resolve } from '../vendor/pathe.mjs';
|
|
2
|
+
import { EvaluatedModules } from '@voidzero-dev/vite-plus-core/module-runner';
|
|
3
|
+
|
|
4
|
+
// TODO: this is not needed in Vite 7.2+
|
|
5
|
+
class VitestEvaluatedModules extends EvaluatedModules {
|
|
6
|
+
getModuleSourceMapById(id) {
|
|
7
|
+
const map = super.getModuleSourceMapById(id);
|
|
8
|
+
if (map != null && !("_patched" in map)) {
|
|
9
|
+
map._patched = true;
|
|
10
|
+
const dir = dirname(map.url);
|
|
11
|
+
map.resolvedSources = (map.map.sources || []).map((s) => resolve(dir, s || ""));
|
|
12
|
+
}
|
|
13
|
+
return map;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { VitestEvaluatedModules as V };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { resolve } from '../vendor/pathe.mjs';
|
|
2
|
+
import { x } from '../vendor/tinyexec.mjs';
|
|
3
|
+
|
|
4
|
+
class VitestGit {
|
|
5
|
+
root;
|
|
6
|
+
constructor(cwd) {
|
|
7
|
+
this.cwd = cwd;
|
|
8
|
+
}
|
|
9
|
+
async resolveFilesWithGitCommand(args) {
|
|
10
|
+
let result;
|
|
11
|
+
try {
|
|
12
|
+
result = await x("git", args, { nodeOptions: { cwd: this.root } });
|
|
13
|
+
} catch (e) {
|
|
14
|
+
e.message = e.stderr;
|
|
15
|
+
throw e;
|
|
16
|
+
}
|
|
17
|
+
return result.stdout.split("\n").filter((s) => s !== "").map((changedPath) => resolve(this.root, changedPath));
|
|
18
|
+
}
|
|
19
|
+
async findChangedFiles(options) {
|
|
20
|
+
const root = await this.getRoot(this.cwd);
|
|
21
|
+
if (!root) return null;
|
|
22
|
+
this.root = root;
|
|
23
|
+
const changedSince = options.changedSince;
|
|
24
|
+
if (typeof changedSince === "string") {
|
|
25
|
+
const [committed, staged, unstaged] = await Promise.all([
|
|
26
|
+
this.getFilesSince(changedSince),
|
|
27
|
+
this.getStagedFiles(),
|
|
28
|
+
this.getUnstagedFiles()
|
|
29
|
+
]);
|
|
30
|
+
return [
|
|
31
|
+
...committed,
|
|
32
|
+
...staged,
|
|
33
|
+
...unstaged
|
|
34
|
+
];
|
|
35
|
+
}
|
|
36
|
+
const [staged, unstaged] = await Promise.all([this.getStagedFiles(), this.getUnstagedFiles()]);
|
|
37
|
+
return [...staged, ...unstaged];
|
|
38
|
+
}
|
|
39
|
+
getFilesSince(hash) {
|
|
40
|
+
return this.resolveFilesWithGitCommand([
|
|
41
|
+
"diff",
|
|
42
|
+
"--name-only",
|
|
43
|
+
`${hash}...HEAD`
|
|
44
|
+
]);
|
|
45
|
+
}
|
|
46
|
+
getStagedFiles() {
|
|
47
|
+
return this.resolveFilesWithGitCommand([
|
|
48
|
+
"diff",
|
|
49
|
+
"--cached",
|
|
50
|
+
"--name-only"
|
|
51
|
+
]);
|
|
52
|
+
}
|
|
53
|
+
getUnstagedFiles() {
|
|
54
|
+
return this.resolveFilesWithGitCommand([
|
|
55
|
+
"ls-files",
|
|
56
|
+
"--other",
|
|
57
|
+
"--modified",
|
|
58
|
+
"--exclude-standard"
|
|
59
|
+
]);
|
|
60
|
+
}
|
|
61
|
+
async getRoot(cwd) {
|
|
62
|
+
const args = ["rev-parse", "--show-cdup"];
|
|
63
|
+
try {
|
|
64
|
+
return resolve(cwd, (await x("git", args, { nodeOptions: { cwd } })).stdout.trim());
|
|
65
|
+
} catch {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export { VitestGit };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { PromisifyAssertion, Tester, ExpectStatic } from '../@vitest/expect/index.js';
|
|
2
|
+
import { Plugin } from '../@vitest/pretty-format/index.js';
|
|
3
|
+
import { SnapshotState } from '../@vitest/snapshot/index.js';
|
|
4
|
+
import { B as BenchmarkResult } from './benchmark.d.DAaHLpsq.js';
|
|
5
|
+
import { U as UserConsoleLog } from './rpc.d.RH3apGEf.js';
|
|
6
|
+
|
|
7
|
+
interface SnapshotMatcher<T> {
|
|
8
|
+
<U extends { [P in keyof T] : any }>(snapshot: Partial<U>, hint?: string): void;
|
|
9
|
+
(hint?: string): void;
|
|
10
|
+
}
|
|
11
|
+
interface InlineSnapshotMatcher<T> {
|
|
12
|
+
<U extends { [P in keyof T] : any }>(properties: Partial<U>, snapshot?: string, hint?: string): void;
|
|
13
|
+
(hint?: string): void;
|
|
14
|
+
}
|
|
15
|
+
declare module "../@vitest/expect/index.js" {
|
|
16
|
+
interface MatcherState {
|
|
17
|
+
environment: string;
|
|
18
|
+
snapshotState: SnapshotState;
|
|
19
|
+
}
|
|
20
|
+
interface ExpectPollOptions {
|
|
21
|
+
interval?: number;
|
|
22
|
+
timeout?: number;
|
|
23
|
+
message?: string;
|
|
24
|
+
}
|
|
25
|
+
interface ExpectStatic {
|
|
26
|
+
assert: Chai.AssertStatic;
|
|
27
|
+
unreachable: (message?: string) => never;
|
|
28
|
+
soft: <T>(actual: T, message?: string) => Assertion<T>;
|
|
29
|
+
poll: <T>(actual: () => T, options?: ExpectPollOptions) => PromisifyAssertion<Awaited<T>>;
|
|
30
|
+
addEqualityTesters: (testers: Array<Tester>) => void;
|
|
31
|
+
assertions: (expected: number) => void;
|
|
32
|
+
hasAssertions: () => void;
|
|
33
|
+
addSnapshotSerializer: (plugin: Plugin) => void;
|
|
34
|
+
}
|
|
35
|
+
interface Assertion<T> {
|
|
36
|
+
matchSnapshot: SnapshotMatcher<T>;
|
|
37
|
+
toMatchSnapshot: SnapshotMatcher<T>;
|
|
38
|
+
toMatchInlineSnapshot: InlineSnapshotMatcher<T>;
|
|
39
|
+
/**
|
|
40
|
+
* Checks that an error thrown by a function matches a previously recorded snapshot.
|
|
41
|
+
*
|
|
42
|
+
* @param hint - Optional custom error message.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* expect(functionWithError).toThrowErrorMatchingSnapshot();
|
|
46
|
+
*/
|
|
47
|
+
toThrowErrorMatchingSnapshot: (hint?: string) => void;
|
|
48
|
+
/**
|
|
49
|
+
* Checks that an error thrown by a function matches an inline snapshot within the test file.
|
|
50
|
+
* Useful for keeping snapshots close to the test code.
|
|
51
|
+
*
|
|
52
|
+
* @param snapshot - Optional inline snapshot string to match.
|
|
53
|
+
* @param hint - Optional custom error message.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* const throwError = () => { throw new Error('Error occurred') };
|
|
57
|
+
* expect(throwError).toThrowErrorMatchingInlineSnapshot(`"Error occurred"`);
|
|
58
|
+
*/
|
|
59
|
+
toThrowErrorMatchingInlineSnapshot: (snapshot?: string, hint?: string) => void;
|
|
60
|
+
/**
|
|
61
|
+
* Compares the received value to a snapshot saved in a specified file.
|
|
62
|
+
* Useful for cases where snapshot content is large or needs to be shared across tests.
|
|
63
|
+
*
|
|
64
|
+
* @param filepath - Path to the snapshot file.
|
|
65
|
+
* @param hint - Optional custom error message.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* await expect(largeData).toMatchFileSnapshot('path/to/snapshot.json');
|
|
69
|
+
*/
|
|
70
|
+
toMatchFileSnapshot: (filepath: string, hint?: string) => Promise<void>;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
declare module "../@vitest/runner/index.js" {
|
|
74
|
+
interface TestContext {
|
|
75
|
+
/**
|
|
76
|
+
* `expect` instance bound to the current test.
|
|
77
|
+
*
|
|
78
|
+
* This API is useful for running snapshot tests concurrently because global expect cannot track them.
|
|
79
|
+
*/
|
|
80
|
+
readonly expect: ExpectStatic;
|
|
81
|
+
/** @internal */
|
|
82
|
+
_local: boolean;
|
|
83
|
+
}
|
|
84
|
+
interface TaskMeta {
|
|
85
|
+
typecheck?: boolean;
|
|
86
|
+
benchmark?: boolean;
|
|
87
|
+
failScreenshotPath?: string;
|
|
88
|
+
}
|
|
89
|
+
interface File {
|
|
90
|
+
prepareDuration?: number;
|
|
91
|
+
environmentLoad?: number;
|
|
92
|
+
}
|
|
93
|
+
interface TaskBase {
|
|
94
|
+
logs?: UserConsoleLog[];
|
|
95
|
+
}
|
|
96
|
+
interface TaskResult {
|
|
97
|
+
benchmark?: BenchmarkResult;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { g as globalApis } from './constants.D_Q9UYh-.js';
|
|
2
|
+
import { i as index } from './index.Z5E_ObnR.js';
|
|
3
|
+
import './vi.2VT5v0um.js';
|
|
4
|
+
import '../@vitest/expect/index.js';
|
|
5
|
+
import '../@vitest/runner/index.js';
|
|
6
|
+
import './utils.DvEY5TfP.js';
|
|
7
|
+
import '../@vitest/utils/timers.js';
|
|
8
|
+
import '../@vitest/runner/utils.js';
|
|
9
|
+
import '../@vitest/snapshot/index.js';
|
|
10
|
+
import '../@vitest/utils/error.js';
|
|
11
|
+
import '../@vitest/utils/helpers.js';
|
|
12
|
+
import '../@vitest/spy/index.js';
|
|
13
|
+
import '../@vitest/utils/offset.js';
|
|
14
|
+
import '../@vitest/utils/source-map.js';
|
|
15
|
+
import './_commonjsHelpers.D26ty3Ew.js';
|
|
16
|
+
import './date.Bq6ZW5rf.js';
|
|
17
|
+
import './benchmark.B3N2zMcH.js';
|
|
18
|
+
import './evaluatedModules.Dg1zASAC.js';
|
|
19
|
+
import '../vendor/pathe.mjs';
|
|
20
|
+
import '@voidzero-dev/vite-plus-core/module-runner';
|
|
21
|
+
import '../vendor/expect-type.mjs';
|
|
22
|
+
|
|
23
|
+
function registerApiGlobally() {
|
|
24
|
+
globalApis.forEach((api) => {
|
|
25
|
+
// @ts-expect-error I know what I am doing :P
|
|
26
|
+
globalThis[api] = index[api];
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { registerApiGlobally };
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { chai } from '../@vitest/expect/index.js';
|
|
2
|
+
import { l as loadDiffConfig, b as loadSnapshotSerializers, t as takeCoverageInsideWorker } from './setup-common.Cm-kSBVi.js';
|
|
3
|
+
import { r as rpc } from './rpc.BoxB0q7B.js';
|
|
4
|
+
import { g as getWorkerState } from './utils.DvEY5TfP.js';
|
|
5
|
+
import { V as VitestTestRunner, N as NodeBenchmarkRunner } from './test.B8ej_ZHS.js';
|
|
6
|
+
|
|
7
|
+
function setupChaiConfig(config) {
|
|
8
|
+
Object.assign(chai.config, config);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
async function resolveSnapshotEnvironment(config, executor) {
|
|
12
|
+
if (!config.snapshotEnvironment) {
|
|
13
|
+
const { VitestNodeSnapshotEnvironment } = await import('./node.Ce0vMQM7.js');
|
|
14
|
+
return new VitestNodeSnapshotEnvironment();
|
|
15
|
+
}
|
|
16
|
+
const mod = await executor.import(config.snapshotEnvironment);
|
|
17
|
+
if (typeof mod.default !== "object" || !mod.default) throw new Error("Snapshot environment module must have a default export object with a shape of `SnapshotEnvironment`");
|
|
18
|
+
return mod.default;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async function getTestRunnerConstructor(config, moduleRunner) {
|
|
22
|
+
if (!config.runner) return config.mode === "test" ? VitestTestRunner : NodeBenchmarkRunner;
|
|
23
|
+
const mod = await moduleRunner.import(config.runner);
|
|
24
|
+
if (!mod.default && typeof mod.default !== "function") throw new Error(`Runner must export a default function, but got ${typeof mod.default} imported from ${config.runner}`);
|
|
25
|
+
return mod.default;
|
|
26
|
+
}
|
|
27
|
+
async function resolveTestRunner(config, moduleRunner, traces) {
|
|
28
|
+
const testRunner = new (await (getTestRunnerConstructor(config, moduleRunner)))(config);
|
|
29
|
+
// inject private executor to every runner
|
|
30
|
+
Object.defineProperty(testRunner, "moduleRunner", {
|
|
31
|
+
value: moduleRunner,
|
|
32
|
+
enumerable: false,
|
|
33
|
+
configurable: false
|
|
34
|
+
});
|
|
35
|
+
if (!testRunner.config) testRunner.config = config;
|
|
36
|
+
if (!testRunner.importFile) throw new Error("Runner must implement \"importFile\" method.");
|
|
37
|
+
if ("__setTraces" in testRunner) testRunner.__setTraces(traces);
|
|
38
|
+
const [diffOptions] = await Promise.all([loadDiffConfig(config, moduleRunner), loadSnapshotSerializers(config, moduleRunner)]);
|
|
39
|
+
testRunner.config.diffOptions = diffOptions;
|
|
40
|
+
// patch some methods, so custom runners don't need to call RPC
|
|
41
|
+
const originalOnTaskUpdate = testRunner.onTaskUpdate;
|
|
42
|
+
testRunner.onTaskUpdate = async (task, events) => {
|
|
43
|
+
const p = rpc().onTaskUpdate(task, events);
|
|
44
|
+
await originalOnTaskUpdate?.call(testRunner, task, events);
|
|
45
|
+
return p;
|
|
46
|
+
};
|
|
47
|
+
// patch some methods, so custom runners don't need to call RPC
|
|
48
|
+
const originalOnTestAnnotate = testRunner.onTestAnnotate;
|
|
49
|
+
testRunner.onTestAnnotate = async (test, annotation) => {
|
|
50
|
+
const p = rpc().onTaskArtifactRecord(test.id, {
|
|
51
|
+
type: "internal:annotation",
|
|
52
|
+
location: annotation.location,
|
|
53
|
+
annotation
|
|
54
|
+
});
|
|
55
|
+
const overriddenResult = await originalOnTestAnnotate?.call(testRunner, test, annotation);
|
|
56
|
+
const vitestResult = await p;
|
|
57
|
+
return overriddenResult || vitestResult.annotation;
|
|
58
|
+
};
|
|
59
|
+
const originalOnTestArtifactRecord = testRunner.onTestArtifactRecord;
|
|
60
|
+
testRunner.onTestArtifactRecord = async (test, artifact) => {
|
|
61
|
+
const p = rpc().onTaskArtifactRecord(test.id, artifact);
|
|
62
|
+
const overriddenResult = await originalOnTestArtifactRecord?.call(testRunner, test, artifact);
|
|
63
|
+
const vitestResult = await p;
|
|
64
|
+
return overriddenResult || vitestResult;
|
|
65
|
+
};
|
|
66
|
+
const originalOnCollectStart = testRunner.onCollectStart;
|
|
67
|
+
testRunner.onCollectStart = async (file) => {
|
|
68
|
+
await rpc().onQueued(file);
|
|
69
|
+
await originalOnCollectStart?.call(testRunner, file);
|
|
70
|
+
};
|
|
71
|
+
const originalOnCollected = testRunner.onCollected;
|
|
72
|
+
testRunner.onCollected = async (files) => {
|
|
73
|
+
const state = getWorkerState();
|
|
74
|
+
files.forEach((file) => {
|
|
75
|
+
file.prepareDuration = state.durations.prepare;
|
|
76
|
+
file.environmentLoad = state.durations.environment;
|
|
77
|
+
// should be collected only for a single test file in a batch
|
|
78
|
+
state.durations.prepare = 0;
|
|
79
|
+
state.durations.environment = 0;
|
|
80
|
+
});
|
|
81
|
+
rpc().onCollected(files);
|
|
82
|
+
await originalOnCollected?.call(testRunner, files);
|
|
83
|
+
};
|
|
84
|
+
const originalOnAfterRun = testRunner.onAfterRunFiles;
|
|
85
|
+
testRunner.onAfterRunFiles = async (files) => {
|
|
86
|
+
const state = getWorkerState();
|
|
87
|
+
const coverage = await takeCoverageInsideWorker(config.coverage, moduleRunner);
|
|
88
|
+
if (coverage) rpc().onAfterSuiteRun({
|
|
89
|
+
coverage,
|
|
90
|
+
testFiles: files.map((file) => file.name).sort(),
|
|
91
|
+
environment: state.environment.viteEnvironment || state.environment.name,
|
|
92
|
+
projectName: state.ctx.projectName
|
|
93
|
+
});
|
|
94
|
+
await originalOnAfterRun?.call(testRunner, files);
|
|
95
|
+
};
|
|
96
|
+
const originalOnAfterRunTask = testRunner.onAfterRunTask;
|
|
97
|
+
testRunner.onAfterRunTask = async (test) => {
|
|
98
|
+
if (config.bail && test.result?.state === "fail") {
|
|
99
|
+
if (1 + await rpc().getCountOfFailedTests() >= config.bail) {
|
|
100
|
+
rpc().onCancel("test-failure");
|
|
101
|
+
testRunner.cancel?.("test-failure");
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
await originalOnAfterRunTask?.call(testRunner, test);
|
|
105
|
+
};
|
|
106
|
+
return testRunner;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export { resolveSnapshotEnvironment as a, resolveTestRunner as r, setupChaiConfig as s };
|