@voidzero-dev/vite-plus-test 0.1.8 → 0.1.10
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 +181 -1
- package/dist/@vitest/browser/client/.vite/manifest.json +6 -6
- package/dist/@vitest/browser/client/__vitest__/assets/index-Da0hb3oU.css +1 -0
- package/dist/@vitest/browser/client/__vitest__/assets/index-Di71CKDo.js +63 -0
- package/dist/@vitest/browser/client/__vitest__/favicon.ico +0 -0
- package/dist/@vitest/browser/client/__vitest__/favicon.svg +49 -4
- package/dist/@vitest/browser/client/__vitest__/index.html +2 -2
- package/dist/@vitest/browser/client/__vitest_browser__/{orchestrator-S_3e_uzt.js → orchestrator-CXs6qrFe.js} +70 -28
- package/dist/@vitest/browser/client/__vitest_browser__/{tester-k74mgIRa.js → tester-K5NNxh1O.js} +167 -58
- package/dist/@vitest/browser/client/__vitest_browser__/{utils-uxqdqUz8.js → utils-C2ISqq1C.js} +2 -2
- package/dist/@vitest/browser/client/favicon.svg +49 -4
- package/dist/@vitest/browser/client/orchestrator.html +2 -2
- package/dist/@vitest/browser/client/tester/tester.html +2 -2
- package/dist/@vitest/browser/client.js +20 -13
- package/dist/@vitest/browser/context.d.ts +160 -10
- package/dist/@vitest/browser/context.js +108 -22
- package/dist/@vitest/browser/expect-element.js +23 -28
- package/dist/@vitest/browser/index-5Pe7X7sp.js +7 -0
- package/dist/@vitest/browser/index.d.ts +20 -2
- package/dist/@vitest/browser/index.js +5706 -159
- package/dist/@vitest/browser/locators.d.ts +14 -3
- package/dist/@vitest/browser/locators.js +1 -1
- package/dist/@vitest/browser-playwright/index.d.ts +22 -5
- package/dist/@vitest/browser-playwright/index.js +169 -61
- package/dist/@vitest/browser-preview/index.d.ts +14 -1
- package/dist/@vitest/browser-preview/locators.js +31 -18
- package/dist/@vitest/browser-webdriverio/index.d.ts +17 -3
- package/dist/@vitest/browser-webdriverio/index.js +22 -2
- package/dist/@vitest/browser-webdriverio/locators.js +84 -7
- package/dist/@vitest/expect/index.d.ts +172 -54
- package/dist/@vitest/expect/index.js +124 -67
- package/dist/@vitest/mocker/auto-register.js +1 -0
- package/dist/@vitest/mocker/automock.d.ts +1 -0
- package/dist/@vitest/mocker/automock.js +5 -0
- package/dist/@vitest/mocker/browser.d.ts +4 -4
- package/dist/@vitest/mocker/browser.js +1 -0
- package/dist/@vitest/mocker/chunk-automock.js +182 -14
- package/dist/@vitest/mocker/chunk-helpers.js +44 -0
- package/dist/@vitest/mocker/chunk-hoistMocks.js +659 -0
- package/dist/@vitest/mocker/chunk-mocker.js +41 -30
- package/dist/@vitest/mocker/chunk-registry.js +21 -7
- package/dist/@vitest/mocker/chunk-utils.js +18 -7
- package/dist/@vitest/mocker/hoistMocks.d-w2ILr1dG.d.ts +739 -0
- package/dist/@vitest/mocker/{index.d-C-sLYZi-.d.ts → index.d-B41z0AuW.d.ts} +1 -1
- package/dist/@vitest/mocker/index.d.ts +2 -2
- package/dist/@vitest/mocker/index.js +18 -3
- package/dist/@vitest/mocker/{mocker.d-TnKRhz7N.d.ts → mocker.d-QEntlm6J.d.ts} +10 -5
- package/dist/@vitest/mocker/node.d.ts +5 -734
- package/dist/@vitest/mocker/node.js +29 -587
- package/dist/@vitest/mocker/redirect.js +4 -4
- package/dist/@vitest/mocker/register.d.ts +3 -3
- package/dist/@vitest/mocker/register.js +1 -0
- package/dist/@vitest/mocker/transforms.d.ts +6 -0
- package/dist/@vitest/mocker/transforms.js +8 -0
- package/dist/@vitest/mocker/{types.d-B8CCKmHt.d.ts → types.d-BjI5eAwu.d.ts} +23 -7
- package/dist/@vitest/pretty-format/index.d.ts +11 -1
- package/dist/@vitest/pretty-format/index.js +33 -4
- package/dist/@vitest/runner/chunk-tasks.js +305 -37
- package/dist/@vitest/runner/index.d.ts +5 -6
- package/dist/@vitest/runner/index.js +1146 -455
- package/dist/@vitest/runner/{tasks.d-C7UxawJ9.d.ts → tasks.d-D2GKpdwQ.d.ts} +726 -55
- package/dist/@vitest/runner/types.d.ts +2 -182
- package/dist/@vitest/runner/utils.d.ts +16 -8
- package/dist/@vitest/runner/utils.js +1 -1
- package/dist/@vitest/snapshot/{environment.d-DHdQ1Csl.d.ts → environment.d-DOJxxZV9.d.ts} +2 -7
- package/dist/@vitest/snapshot/environment.d.ts +2 -1
- package/dist/@vitest/snapshot/environment.js +1 -1
- package/dist/@vitest/snapshot/index.d.ts +4 -3
- package/dist/@vitest/snapshot/index.js +21 -550
- package/dist/@vitest/snapshot/manager.d.ts +3 -2
- package/dist/@vitest/snapshot/manager.js +1 -1
- package/dist/@vitest/snapshot/{rawSnapshot.d-lFsMJFUd.d.ts → rawSnapshot.d-U2kJUxDr.d.ts} +1 -1
- package/dist/@vitest/spy/index.d.ts +34 -4
- package/dist/@vitest/spy/index.js +69 -19
- package/dist/@vitest/utils/diff.js +11 -9
- package/dist/@vitest/utils/display.d.ts +2 -1
- package/dist/@vitest/utils/display.js +38 -5
- package/dist/@vitest/utils/error.d.ts +2 -1
- package/dist/@vitest/utils/error.js +1 -2
- package/dist/@vitest/utils/helpers.d.ts +4 -1
- package/dist/@vitest/utils/helpers.js +43 -1
- package/dist/@vitest/utils/resolver.js +1 -2
- package/dist/@vitest/utils/serialize.js +6 -6
- package/dist/@vitest/utils/source-map/node.d.ts +6 -0
- package/dist/@vitest/utils/source-map/node.js +23 -0
- package/dist/@vitest/utils/source-map.js +15 -5
- package/dist/browser.d.ts +3 -2
- package/dist/browser.js +2 -2
- package/dist/chunks/acorn.B2iPLyUM.js +5958 -0
- package/dist/chunks/{base.CJ0Y4ePK.js → base.DM0-RqVb.js} +54 -16
- package/dist/chunks/{benchmark.B3N2zMcH.js → benchmark.D0SlKNbZ.js} +1 -1
- package/dist/chunks/{browser.d.ChKACdzH.d.ts → browser.d.X3SXoOCV.d.ts} +4 -1
- package/dist/chunks/{cac.DVeoLl0M.js → cac.CWGDZnXT.js} +979 -20
- package/dist/chunks/{cli-api.B7PN_QUv.js → cli-api.DuT9iuvY.js} +8764 -7898
- package/dist/chunks/{config.d.Cy95HiCx.d.ts → config.d.EJLVE3es.d.ts} +30 -15
- package/dist/chunks/{console.Cf-YriPC.js → console.3WNpx0tS.js} +3 -2
- package/dist/chunks/{constants.D_Q9UYh-.js → constants.CPYnjOGj.js} +4 -2
- package/dist/chunks/coverage.Bri33R1t.js +1050 -0
- package/dist/chunks/{creator.DAmOKTvJ.js → creator.DgVhQm5q.js} +35 -4
- package/dist/chunks/{defaults.BOqNVLsY.js → defaults.CdU2lD-q.js} +4 -3
- package/dist/chunks/{global.d.B15mdLcR.d.ts → global.d.x-ILCfAE.d.ts} +1 -2
- package/dist/chunks/{globals.DOayXfHP.js → globals.BXNGLnTL.js} +11 -10
- package/dist/chunks/{coverage.AVPTjMgw.js → index.BCY_7LL2.js} +5 -959
- package/dist/chunks/{index.C5r1PdPD.js → index.CEzQDJGb.js} +1 -1
- package/dist/chunks/{index.D3XRDfWc.js → index.CMESou6r.js} +26 -1
- package/dist/chunks/{index.6Qv1eEA6.js → index.DGNSnENe.js} +95 -9
- package/dist/chunks/{index.M8mOzt4Y.js → index.DXMFO5MJ.js} +3279 -2914
- package/dist/chunks/{index.Z5E_ObnR.js → index.DlDSLQD3.js} +7 -3
- package/dist/chunks/{index.CyBMJtT7.js → index.EY6TCHpo.js} +10 -8
- package/dist/chunks/{index.D4KonVSU.js → index.og1WyBLx.js} +18 -3
- package/dist/chunks/{init-forks._y3TW739.js → init-forks.DeArv0jT.js} +1 -1
- package/dist/chunks/{init-threads.DBO2kn-p.js → init-threads.-2OUl4Nn.js} +1 -1
- package/dist/chunks/{init.B6MLFIaN.js → init.DICorXCo.js} +52 -13
- package/dist/chunks/native.DPzPHdi5.js +148 -0
- package/dist/chunks/nativeModuleMocker.DndvSdL6.js +206 -0
- package/dist/chunks/nativeModuleRunner.BIakptoF.js +36 -0
- package/dist/chunks/{node.Ce0vMQM7.js → node.COQbm6gK.js} +1 -1
- package/dist/chunks/{plugin.d.CtqpEehP.d.ts → plugin.d.BuW-flqo.d.ts} +1 -1
- package/dist/chunks/{reporters.d.CWXNI2jG.d.ts → reporters.d.DVUYHHhe.d.ts} +328 -79
- package/dist/chunks/rpc.MzXet3jl.js +144 -0
- package/dist/chunks/{rpc.d.RH3apGEf.d.ts → rpc.d.BFMWpdph.d.ts} +10 -2
- package/dist/chunks/{setup-common.Cm-kSBVi.js → setup-common.B41N_kPE.js} +3 -3
- package/dist/chunks/{startModuleRunner.DEj0jb3e.js → startVitestModuleRunner.C3ZR-4J3.js} +265 -405
- package/dist/chunks/{suite.d.BJWk38HB.d.ts → suite.d.udJtyAgw.d.ts} +1 -1
- package/dist/chunks/{vi.2VT5v0um.js → test.CTcmp4Su.js} +538 -181
- package/dist/chunks/{utils.DvEY5TfP.js → utils.BX5Fg8C4.js} +8 -1
- package/dist/chunks/{vm.D3epNOPZ.js → vm.Dh2rTtmP.js} +48 -8
- package/dist/chunks/{worker.d.Dyxm8DEL.d.ts → worker.d.B84sVRy0.d.ts} +2 -2
- package/dist/cli.js +6 -5
- package/dist/client/.vite/manifest.json +6 -6
- package/dist/client/__vitest__/assets/index-Da0hb3oU.css +1 -0
- package/dist/client/__vitest__/assets/index-Di71CKDo.js +63 -0
- package/dist/client/__vitest__/favicon.ico +0 -0
- package/dist/client/__vitest__/favicon.svg +49 -4
- package/dist/client/__vitest__/index.html +2 -2
- package/dist/client/__vitest_browser__/{orchestrator-S_3e_uzt.js → orchestrator-CXs6qrFe.js} +70 -28
- package/dist/client/__vitest_browser__/{tester-k74mgIRa.js → tester-K5NNxh1O.js} +167 -58
- package/dist/client/__vitest_browser__/{utils-uxqdqUz8.js → utils-C2ISqq1C.js} +2 -2
- package/dist/client/favicon.svg +49 -4
- package/dist/client/orchestrator.html +2 -2
- package/dist/client/tester/tester.html +2 -2
- package/dist/client.js +20 -13
- package/dist/config.cjs +3 -2
- package/dist/config.d.ts +13 -12
- package/dist/config.js +2 -2
- package/dist/context.js +108 -22
- package/dist/coverage.d.ts +12 -8
- package/dist/coverage.js +8 -5
- package/dist/environments.js +3 -1
- package/dist/expect-element.js +23 -23
- package/dist/index-5Pe7X7sp.js +7 -0
- package/dist/index.d.ts +66 -27
- package/dist/index.js +10 -9
- package/dist/locators.d.ts +14 -3
- package/dist/locators.js +1 -1
- package/dist/module-evaluator.d.ts +11 -1
- package/dist/module-evaluator.js +43 -26
- package/dist/node.d.ts +28 -14
- package/dist/node.js +42 -40
- package/dist/nodejs-worker-loader.js +41 -0
- package/dist/plugins/mocker-transforms.mjs +2 -0
- package/dist/plugins/utils-source-map-node.mjs +2 -0
- package/dist/reporters.d.ts +8 -8
- package/dist/reporters.js +7 -5
- package/dist/runners.d.ts +24 -5
- package/dist/runners.js +6 -6
- package/dist/runtime.d.ts +6 -0
- package/dist/runtime.js +35 -0
- package/dist/snapshot.js +4 -2
- package/dist/suite.d.ts +1 -1
- package/dist/suite.js +4 -2
- package/dist/vendor/blazediff_core.d.mts +1 -0
- package/dist/vendor/blazediff_core.mjs +117 -0
- package/dist/vendor/chai.mjs +4 -249
- package/dist/vendor/convert-source-map.d.mts +1 -0
- package/dist/vendor/convert-source-map.mjs +150 -0
- package/dist/vendor/expect-type.d.mts +14 -7
- package/dist/vendor/expect-type.mjs +5 -5
- package/dist/vendor/std-env.d.mts +131 -40
- package/dist/vendor/std-env.mjs +114 -117
- package/dist/worker.d.ts +6 -6
- package/dist/worker.js +27 -21
- package/dist/workers/forks.js +23 -17
- package/dist/workers/runVmTests.js +18 -16
- package/dist/workers/threads.js +23 -17
- package/dist/workers/vmForks.js +15 -12
- package/dist/workers/vmThreads.js +15 -12
- package/globals.d.ts +2 -0
- package/package.json +36 -27
- package/suppress-warnings.cjs +1 -0
- package/dist/@vitest/browser/client/__vitest__/assets/index-BUCFJtth.js +0 -57
- package/dist/@vitest/browser/client/__vitest__/assets/index-DlhE0rqZ.css +0 -1
- package/dist/@vitest/browser/index-D6m36C6U.js +0 -11
- package/dist/@vitest/utils/chunk-_commonjsHelpers.js +0 -5
- package/dist/@vitest/utils/highlight.d.ts +0 -9
- package/dist/@vitest/utils/highlight.js +0 -538
- package/dist/chunks/date.Bq6ZW5rf.js +0 -73
- package/dist/chunks/rpc.BoxB0q7B.js +0 -76
- package/dist/chunks/test.B8ej_ZHS.js +0 -254
- package/dist/client/__vitest__/assets/index-BUCFJtth.js +0 -57
- package/dist/client/__vitest__/assets/index-DlhE0rqZ.css +0 -1
- package/dist/index-D6m36C6U.js +0 -6
- package/dist/mocker.d.ts +0 -1
- package/dist/mocker.js +0 -1
- package/dist/module-runner.js +0 -17
package/dist/config.d.ts
CHANGED
|
@@ -1,22 +1,19 @@
|
|
|
1
|
-
import { HookHandler,
|
|
1
|
+
import { HookHandler, UserConfig, ConfigEnv } from '@voidzero-dev/vite-plus-core';
|
|
2
2
|
export { ConfigEnv, Plugin, UserConfig as ViteUserConfig, mergeConfig } from '@voidzero-dev/vite-plus-core';
|
|
3
|
-
import { I as InlineConfig,
|
|
4
|
-
export {
|
|
5
|
-
import { V as VitestPluginContext } from './chunks/plugin.d.
|
|
6
|
-
import { F as FakeTimerInstallOpts } from './chunks/config.d.
|
|
7
|
-
|
|
3
|
+
import { I as InlineConfig, C as CoverageV8Options, R as ResolvedCoverageOptions, U as UserWorkspaceConfig, b as UserProjectConfigFn, c as UserProjectConfigExport } from './chunks/reporters.d.DVUYHHhe.js';
|
|
4
|
+
export { a as TestProjectConfiguration, d as TestProjectInlineConfiguration, e as TestUserConfig, W as WatcherTriggerPattern } from './chunks/reporters.d.DVUYHHhe.js';
|
|
5
|
+
import { V as VitestPluginContext } from './chunks/plugin.d.BuW-flqo.js';
|
|
6
|
+
import { F as FakeTimerInstallOpts } from './chunks/config.d.EJLVE3es.js';
|
|
7
|
+
export { TestTagDefinition } from './@vitest/runner/index.js';
|
|
8
8
|
import './@vitest/utils/index.js';
|
|
9
|
-
import './chunks/rpc.d.
|
|
9
|
+
import './chunks/rpc.d.BFMWpdph.js';
|
|
10
10
|
import './@vitest/snapshot/index.js';
|
|
11
11
|
import '@voidzero-dev/vite-plus-core/module-runner';
|
|
12
12
|
import './chunks/traces.d.402V_yFI.js';
|
|
13
13
|
import 'node:stream';
|
|
14
|
-
import './chunks/browser.d.
|
|
15
|
-
import './chunks/worker.d.
|
|
14
|
+
import './chunks/browser.d.X3SXoOCV.js';
|
|
15
|
+
import './chunks/worker.d.B84sVRy0.js';
|
|
16
16
|
import './chunks/environment.d.CrsxCzP1.js';
|
|
17
|
-
import './@vitest/mocker/index.js';
|
|
18
|
-
import './@vitest/utils/source-map.js';
|
|
19
|
-
import './@vitest/browser/index.js';
|
|
20
17
|
import './@vitest/pretty-format/index.js';
|
|
21
18
|
import './@vitest/utils/diff.js';
|
|
22
19
|
import './@vitest/expect/index.js';
|
|
@@ -24,6 +21,9 @@ import 'vitest/optional-types.js';
|
|
|
24
21
|
import './chunks/benchmark.d.DAaHLpsq.js';
|
|
25
22
|
import './@vitest/runner/utils.js';
|
|
26
23
|
import './vendor/tinybench.mjs';
|
|
24
|
+
import './@vitest/mocker/index.js';
|
|
25
|
+
import './@vitest/utils/source-map.js';
|
|
26
|
+
import './@vitest/browser/index.js';
|
|
27
27
|
import './chunks/coverage.d.BZtK59WP.js';
|
|
28
28
|
import './@vitest/snapshot/manager.js';
|
|
29
29
|
import 'node:console';
|
|
@@ -84,6 +84,7 @@ declare const configDefaults: Readonly<{
|
|
|
84
84
|
};
|
|
85
85
|
slowTestThreshold: number;
|
|
86
86
|
disableConsoleIntercept: boolean;
|
|
87
|
+
detectAsyncLeaks: boolean;
|
|
87
88
|
}>;
|
|
88
89
|
|
|
89
90
|
type ViteUserConfigFnObject = (env: ConfigEnv) => UserConfig;
|
package/dist/config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { c as configDefaults, a as coverageConfigDefaults, d as defaultExclude, b as defaultInclude } from './chunks/defaults.
|
|
1
|
+
export { c as configDefaults, a as coverageConfigDefaults, d as defaultExclude, b as defaultInclude } from './chunks/defaults.CdU2lD-q.js';
|
|
2
2
|
export { mergeConfig } from '@voidzero-dev/vite-plus-core';
|
|
3
|
-
export { d as defaultBrowserPort } from './chunks/constants.
|
|
3
|
+
export { d as defaultBrowserPort } from './chunks/constants.CPYnjOGj.js';
|
|
4
4
|
import 'node:os';
|
|
5
5
|
import './chunks/env.D4Lgay0q.js';
|
|
6
6
|
import './vendor/std-env.mjs';
|
package/dist/context.js
CHANGED
|
@@ -23,9 +23,11 @@ function ensureAwaited(promise) {
|
|
|
23
23
|
return (promiseResult ||= promise(sourceError)).then(onFulfilled, onRejected);
|
|
24
24
|
},
|
|
25
25
|
catch(onRejected) {
|
|
26
|
+
awaited = true;
|
|
26
27
|
return (promiseResult ||= promise(sourceError)).catch(onRejected);
|
|
27
28
|
},
|
|
28
29
|
finally(onFinally) {
|
|
30
|
+
awaited = true;
|
|
29
31
|
return (promiseResult ||= promise(sourceError)).finally(onFinally);
|
|
30
32
|
},
|
|
31
33
|
[Symbol.toStringTag]: "Promise"
|
|
@@ -46,7 +48,6 @@ function getWorkerState() {
|
|
|
46
48
|
return state;
|
|
47
49
|
}
|
|
48
50
|
|
|
49
|
-
const provider$1 = getBrowserState().provider;
|
|
50
51
|
/* @__NO_SIDE_EFFECTS__ */
|
|
51
52
|
function convertElementToCssSelector(element) {
|
|
52
53
|
if (!element || !(element instanceof Element)) {
|
|
@@ -119,9 +120,9 @@ function getParent(el) {
|
|
|
119
120
|
}
|
|
120
121
|
return parent;
|
|
121
122
|
}
|
|
122
|
-
const now = Date.now;
|
|
123
|
+
const now = globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now;
|
|
123
124
|
function processTimeoutOptions(options_) {
|
|
124
|
-
if (options_ && options_.timeout != null
|
|
125
|
+
if (options_ && options_.timeout != null) {
|
|
125
126
|
return options_;
|
|
126
127
|
}
|
|
127
128
|
// if there is a default action timeout, use it
|
|
@@ -141,7 +142,7 @@ function processTimeoutOptions(options_) {
|
|
|
141
142
|
options_ = options_ || {};
|
|
142
143
|
const currentTime = now();
|
|
143
144
|
const endTime = startTime + timeout;
|
|
144
|
-
const remainingTime = endTime - currentTime;
|
|
145
|
+
const remainingTime = Math.floor(endTime - currentTime);
|
|
145
146
|
if (remainingTime <= 0) {
|
|
146
147
|
return options_;
|
|
147
148
|
}
|
|
@@ -149,7 +150,9 @@ function processTimeoutOptions(options_) {
|
|
|
149
150
|
options_.timeout = remainingTime - 100;
|
|
150
151
|
return options_;
|
|
151
152
|
}
|
|
152
|
-
|
|
153
|
+
const provider$1 = getBrowserState().provider;
|
|
154
|
+
const kElementLocator = Symbol.for("$$vitest:locator-resolved");
|
|
155
|
+
async function convertToSelector(elementOrLocator, options) {
|
|
153
156
|
if (!elementOrLocator) {
|
|
154
157
|
throw new Error("Expected element or locator to be defined.");
|
|
155
158
|
}
|
|
@@ -157,7 +160,11 @@ function convertToSelector(elementOrLocator) {
|
|
|
157
160
|
return convertElementToCssSelector(elementOrLocator);
|
|
158
161
|
}
|
|
159
162
|
if (isLocator(elementOrLocator)) {
|
|
160
|
-
|
|
163
|
+
if (provider$1 === "playwright" || kElementLocator in elementOrLocator) {
|
|
164
|
+
return elementOrLocator.selector;
|
|
165
|
+
}
|
|
166
|
+
const element = await elementOrLocator.findElement(options);
|
|
167
|
+
return convertElementToCssSelector(element);
|
|
161
168
|
}
|
|
162
169
|
throw new Error("Expected element or locator to be an instance of Element or Locator.");
|
|
163
170
|
}
|
|
@@ -165,6 +172,36 @@ const kLocator = Symbol.for("$$vitest:locator");
|
|
|
165
172
|
function isLocator(element) {
|
|
166
173
|
return !!element && typeof element === "object" && kLocator in element;
|
|
167
174
|
}
|
|
175
|
+
const DEFAULT_WHEEL_DELTA = 100;
|
|
176
|
+
function resolveUserEventWheelOptions(options) {
|
|
177
|
+
let delta;
|
|
178
|
+
if (options.delta) {
|
|
179
|
+
delta = options.delta;
|
|
180
|
+
} else {
|
|
181
|
+
switch (options.direction) {
|
|
182
|
+
case "up": {
|
|
183
|
+
delta = { y: -DEFAULT_WHEEL_DELTA };
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
case "down": {
|
|
187
|
+
delta = { y: DEFAULT_WHEEL_DELTA };
|
|
188
|
+
break;
|
|
189
|
+
}
|
|
190
|
+
case "left": {
|
|
191
|
+
delta = { x: -DEFAULT_WHEEL_DELTA };
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
case "right": {
|
|
195
|
+
delta = { x: DEFAULT_WHEEL_DELTA };
|
|
196
|
+
break;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return {
|
|
201
|
+
delta,
|
|
202
|
+
times: options.times
|
|
203
|
+
};
|
|
204
|
+
}
|
|
168
205
|
|
|
169
206
|
// this file should not import anything directly, only types and utils
|
|
170
207
|
// @ts-expect-error not typed global
|
|
@@ -186,10 +223,10 @@ function createUserEvent(__tl_user_event_base__, options) {
|
|
|
186
223
|
setup() {
|
|
187
224
|
return createUserEvent();
|
|
188
225
|
},
|
|
189
|
-
|
|
226
|
+
cleanup() {
|
|
190
227
|
// avoid cleanup rpc call if there is nothing to cleanup
|
|
191
228
|
if (!keyboard.unreleased.length) {
|
|
192
|
-
return;
|
|
229
|
+
return Promise.resolve();
|
|
193
230
|
}
|
|
194
231
|
return ensureAwaited(async (error) => {
|
|
195
232
|
await triggerCommand("__vitest_cleanup", [keyboard], error);
|
|
@@ -205,6 +242,9 @@ function createUserEvent(__tl_user_event_base__, options) {
|
|
|
205
242
|
tripleClick(element, options) {
|
|
206
243
|
return convertToLocator(element).tripleClick(options);
|
|
207
244
|
},
|
|
245
|
+
wheel(elementOrOptions, options) {
|
|
246
|
+
return convertToLocator(elementOrOptions).wheel(options);
|
|
247
|
+
},
|
|
208
248
|
selectOptions(element, value, options) {
|
|
209
249
|
return convertToLocator(element).selectOptions(value, options);
|
|
210
250
|
},
|
|
@@ -228,9 +268,9 @@ function createUserEvent(__tl_user_event_base__, options) {
|
|
|
228
268
|
const targetLocator = convertToLocator(target);
|
|
229
269
|
return sourceLocator.dropTo(targetLocator, options);
|
|
230
270
|
},
|
|
231
|
-
|
|
271
|
+
type(element, text, options) {
|
|
232
272
|
return ensureAwaited(async (error) => {
|
|
233
|
-
const selector = convertToSelector(element);
|
|
273
|
+
const selector = await convertToSelector(element, options);
|
|
234
274
|
const { unreleased } = await triggerCommand("__vitest_type", [
|
|
235
275
|
selector,
|
|
236
276
|
text,
|
|
@@ -245,20 +285,20 @@ function createUserEvent(__tl_user_event_base__, options) {
|
|
|
245
285
|
tab(options = {}) {
|
|
246
286
|
return ensureAwaited((error) => triggerCommand("__vitest_tab", [options], error));
|
|
247
287
|
},
|
|
248
|
-
|
|
288
|
+
keyboard(text) {
|
|
249
289
|
return ensureAwaited(async (error) => {
|
|
250
290
|
const { unreleased } = await triggerCommand("__vitest_keyboard", [text, keyboard], error);
|
|
251
291
|
keyboard.unreleased = unreleased;
|
|
252
292
|
});
|
|
253
293
|
},
|
|
254
|
-
|
|
255
|
-
|
|
294
|
+
copy() {
|
|
295
|
+
return userEvent.keyboard(`{${modifier}>}{c}{/${modifier}}`);
|
|
256
296
|
},
|
|
257
|
-
|
|
258
|
-
|
|
297
|
+
cut() {
|
|
298
|
+
return userEvent.keyboard(`{${modifier}>}{x}{/${modifier}}`);
|
|
259
299
|
},
|
|
260
|
-
|
|
261
|
-
|
|
300
|
+
paste() {
|
|
301
|
+
return userEvent.keyboard(`{${modifier}>}{v}{/${modifier}}`);
|
|
262
302
|
}
|
|
263
303
|
};
|
|
264
304
|
return userEvent;
|
|
@@ -339,6 +379,26 @@ function createPreviewUserEvent(userEventBase, options) {
|
|
|
339
379
|
},
|
|
340
380
|
async paste() {
|
|
341
381
|
await userEvent.paste(clipboardData);
|
|
382
|
+
},
|
|
383
|
+
async wheel(element, options) {
|
|
384
|
+
const resolvedElement = isLocator(element) ? element.element() : element;
|
|
385
|
+
const resolvedOptions = resolveUserEventWheelOptions(options);
|
|
386
|
+
const rect = resolvedElement.getBoundingClientRect();
|
|
387
|
+
const centerX = rect.left + rect.width / 2;
|
|
388
|
+
const centerY = rect.top + rect.height / 2;
|
|
389
|
+
const wheelEvent = new WheelEvent("wheel", {
|
|
390
|
+
clientX: centerX,
|
|
391
|
+
clientY: centerY,
|
|
392
|
+
deltaY: resolvedOptions.delta.y ?? 0,
|
|
393
|
+
deltaX: resolvedOptions.delta.x ?? 0,
|
|
394
|
+
deltaMode: 0,
|
|
395
|
+
bubbles: true,
|
|
396
|
+
cancelable: true
|
|
397
|
+
});
|
|
398
|
+
const times = options.times ?? 1;
|
|
399
|
+
for (let count = 0; count < times; count += 1) {
|
|
400
|
+
resolvedElement.dispatchEvent(wheelEvent);
|
|
401
|
+
}
|
|
342
402
|
}
|
|
343
403
|
};
|
|
344
404
|
for (const [name, fn] of Object.entries(vitestUserEvent)) {
|
|
@@ -390,18 +450,47 @@ const page = {
|
|
|
390
450
|
screenshotIds[repeatCount] ??= {};
|
|
391
451
|
screenshotIds[repeatCount][taskName] = number + 1;
|
|
392
452
|
const name = options.path || `${taskName.replace(/[^a-z0-9]/gi, "-")}-${number}.png`;
|
|
453
|
+
const [element, ...mask] = await Promise.all([options.element ? convertToSelector(options.element, options) : undefined, ..."mask" in options ? options.mask.map((el) => convertToSelector(el, options)) : []]);
|
|
393
454
|
const normalizedOptions = "mask" in options ? {
|
|
394
455
|
...options,
|
|
395
|
-
mask
|
|
456
|
+
mask
|
|
396
457
|
} : options;
|
|
397
458
|
return ensureAwaited((error) => triggerCommand("__vitest_screenshot", [name, processTimeoutOptions(
|
|
398
459
|
{
|
|
399
460
|
...normalizedOptions,
|
|
400
|
-
element
|
|
461
|
+
element
|
|
401
462
|
}
|
|
402
463
|
/** TODO */
|
|
403
464
|
)], error));
|
|
404
465
|
},
|
|
466
|
+
mark(name, bodyOrOptions, options) {
|
|
467
|
+
const currentTest = getWorkerState().current;
|
|
468
|
+
const hasActiveTrace = !!currentTest && getBrowserState().activeTraceTaskIds.has(currentTest.id);
|
|
469
|
+
if (typeof bodyOrOptions === "function") {
|
|
470
|
+
return ensureAwaited(async (error) => {
|
|
471
|
+
if (hasActiveTrace) {
|
|
472
|
+
await triggerCommand("__vitest_groupTraceStart", [{
|
|
473
|
+
name,
|
|
474
|
+
stack: options?.stack ?? error?.stack
|
|
475
|
+
}], error);
|
|
476
|
+
}
|
|
477
|
+
try {
|
|
478
|
+
return await bodyOrOptions();
|
|
479
|
+
} finally {
|
|
480
|
+
if (hasActiveTrace) {
|
|
481
|
+
await triggerCommand("__vitest_groupTraceEnd", [], error);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
if (!hasActiveTrace) {
|
|
487
|
+
return Promise.resolve();
|
|
488
|
+
}
|
|
489
|
+
return ensureAwaited((error) => triggerCommand("__vitest_markTrace", [{
|
|
490
|
+
name,
|
|
491
|
+
stack: bodyOrOptions?.stack ?? error?.stack
|
|
492
|
+
}], error));
|
|
493
|
+
},
|
|
405
494
|
getByRole() {
|
|
406
495
|
throw new Error(`Method "getByRole" is not supported by the "${provider}" provider.`);
|
|
407
496
|
},
|
|
@@ -524,9 +613,6 @@ function getElementError(selector, container) {
|
|
|
524
613
|
error.name = "VitestBrowserElementError";
|
|
525
614
|
return error;
|
|
526
615
|
}
|
|
527
|
-
/**
|
|
528
|
-
* @experimental
|
|
529
|
-
*/
|
|
530
616
|
function configurePrettyDOM(options) {
|
|
531
617
|
defaultOptions = options;
|
|
532
618
|
}
|
package/dist/coverage.d.ts
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { R as ResolvedCoverageOptions, V as Vitest,
|
|
1
|
+
import { R as ResolvedCoverageOptions, V as Vitest, aY as CoverageMap, am as ReportContext, T as TestProject } from './chunks/reporters.d.DVUYHHhe.js';
|
|
2
2
|
import { TransformResult } from '@voidzero-dev/vite-plus-core';
|
|
3
|
-
import { A as AfterSuiteRunMeta } from './chunks/rpc.d.
|
|
3
|
+
import { A as AfterSuiteRunMeta } from './chunks/rpc.d.BFMWpdph.js';
|
|
4
4
|
import './@vitest/runner/index.js';
|
|
5
5
|
import './@vitest/utils/index.js';
|
|
6
6
|
import 'node:stream';
|
|
7
|
-
import './chunks/browser.d.
|
|
7
|
+
import './chunks/browser.d.X3SXoOCV.js';
|
|
8
8
|
import './chunks/traces.d.402V_yFI.js';
|
|
9
|
-
import './chunks/worker.d.
|
|
9
|
+
import './chunks/worker.d.B84sVRy0.js';
|
|
10
10
|
import '@voidzero-dev/vite-plus-core/module-runner';
|
|
11
|
-
import './chunks/config.d.
|
|
11
|
+
import './chunks/config.d.EJLVE3es.js';
|
|
12
12
|
import './@vitest/pretty-format/index.js';
|
|
13
13
|
import './@vitest/snapshot/index.js';
|
|
14
14
|
import './@vitest/utils/diff.js';
|
|
15
15
|
import './chunks/environment.d.CrsxCzP1.js';
|
|
16
|
-
import './@vitest/mocker/index.js';
|
|
17
|
-
import './@vitest/utils/source-map.js';
|
|
18
|
-
import './@vitest/browser/index.js';
|
|
19
16
|
import './@vitest/expect/index.js';
|
|
20
17
|
import 'vitest/optional-types.js';
|
|
21
18
|
import './chunks/benchmark.d.DAaHLpsq.js';
|
|
22
19
|
import './@vitest/runner/utils.js';
|
|
23
20
|
import './vendor/tinybench.mjs';
|
|
21
|
+
import './@vitest/mocker/index.js';
|
|
22
|
+
import './@vitest/utils/source-map.js';
|
|
23
|
+
import './@vitest/browser/index.js';
|
|
24
24
|
import './chunks/coverage.d.BZtK59WP.js';
|
|
25
25
|
import './@vitest/snapshot/manager.js';
|
|
26
26
|
import 'node:console';
|
|
@@ -57,10 +57,12 @@ declare class BaseCoverageProvider<Options extends ResolvedCoverageOptions<"ista
|
|
|
57
57
|
version: string;
|
|
58
58
|
options: Options;
|
|
59
59
|
globCache: Map<string, boolean>;
|
|
60
|
+
autoUpdateMarker: string;
|
|
60
61
|
coverageFiles: CoverageFiles;
|
|
61
62
|
pendingPromises: Promise<void>[];
|
|
62
63
|
coverageFilesDirectory: string;
|
|
63
64
|
roots: string[];
|
|
65
|
+
changedFiles?: string[];
|
|
64
66
|
_initialize(ctx: Vitest): void;
|
|
65
67
|
/**
|
|
66
68
|
* Check if file matches `coverage.include` but not `coverage.exclude`
|
|
@@ -88,6 +90,7 @@ declare class BaseCoverageProvider<Options extends ResolvedCoverageOptions<"ista
|
|
|
88
90
|
};
|
|
89
91
|
}): Promise<void>;
|
|
90
92
|
cleanAfterRun(): Promise<void>;
|
|
93
|
+
onTestRunStart(): Promise<void>;
|
|
91
94
|
onTestFailure(): Promise<void>;
|
|
92
95
|
reportCoverage(coverageMap: unknown, { allTestsRun }: ReportContext): Promise<void>;
|
|
93
96
|
reportThresholds(coverageMap: CoverageMap, allTestsRun: boolean | undefined): Promise<void>;
|
|
@@ -112,6 +115,7 @@ declare class BaseCoverageProvider<Options extends ResolvedCoverageOptions<"ista
|
|
|
112
115
|
mergeReports(coverageMaps: unknown[]): Promise<void>;
|
|
113
116
|
hasTerminalReporter(reporters: ResolvedCoverageOptions["reporter"]): boolean;
|
|
114
117
|
toSlices<T>(array: T[], size: number): T[][];
|
|
118
|
+
transformFile(url: string, project: TestProject, viteEnvironment: string): Promise<TransformResult | null | undefined>;
|
|
115
119
|
createUncoveredFileTransformer(ctx: Vitest): (filename: string) => Promise<TransformResult | null | undefined>;
|
|
116
120
|
}
|
|
117
121
|
|
package/dist/coverage.js
CHANGED
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
export { B as BaseCoverageProvider } from './chunks/coverage.
|
|
1
|
+
export { B as BaseCoverageProvider } from './chunks/coverage.Bri33R1t.js';
|
|
2
2
|
import 'node:fs';
|
|
3
|
+
import 'node:module';
|
|
3
4
|
import 'node:path';
|
|
5
|
+
import 'node:url';
|
|
4
6
|
import './@vitest/utils/helpers.js';
|
|
5
7
|
import './vendor/pathe.mjs';
|
|
6
8
|
import './vendor/picomatch.mjs';
|
|
7
9
|
import './vendor/tinyglobby.mjs';
|
|
8
10
|
import './vendor/tinyrainbow.mjs';
|
|
9
|
-
import './chunks/defaults.
|
|
11
|
+
import './chunks/defaults.CdU2lD-q.js';
|
|
10
12
|
import 'node:os';
|
|
11
13
|
import './chunks/env.D4Lgay0q.js';
|
|
12
14
|
import './vendor/std-env.mjs';
|
|
13
15
|
import 'node:crypto';
|
|
14
|
-
import '
|
|
15
|
-
import 'node:module';
|
|
16
|
+
import './chunks/index.BCY_7LL2.js';
|
|
16
17
|
import 'node:process';
|
|
17
18
|
import 'node:fs/promises';
|
|
18
19
|
import 'node:assert';
|
|
19
20
|
import 'node:v8';
|
|
20
21
|
import 'node:util';
|
|
21
22
|
import '@voidzero-dev/vite-plus-core';
|
|
22
|
-
import './chunks/constants.
|
|
23
|
+
import './chunks/constants.CPYnjOGj.js';
|
|
23
24
|
import './chunks/coverage.D_JHT54q.js';
|
|
25
|
+
|
|
26
|
+
console.warn("Importing from \"vitest/coverage\" is deprecated since Vitest 4.1. Please use \"vitest/node\" instead.");
|
package/dist/environments.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
export { e as builtinEnvironments, p as populateGlobal } from './chunks/index.
|
|
1
|
+
export { e as builtinEnvironments, p as populateGlobal } from './chunks/index.EY6TCHpo.js';
|
|
2
2
|
import 'node:url';
|
|
3
3
|
import 'node:console';
|
|
4
|
+
|
|
5
|
+
console.warn("Importing from \"vitest/environments\" is deprecated since Vitest 4.1. Please use \"vitest/runtime\" instead.");
|