@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,354 @@
|
|
|
1
|
+
import { UserEventClickOptions, UserEventClearOptions, UserEventHoverOptions, UserEventFillOptions, UserEventUploadOptions, UserEventDragAndDropOptions, UserEventSelectOptions, LocatorScreenshotOptions, LocatorByRoleOptions, LocatorOptions } from './index.js';
|
|
2
|
+
|
|
3
|
+
type ClauseCombinator = '' | '>' | '+' | '~' | '>=';
|
|
4
|
+
type CSSFunctionArgument = CSSComplexSelector | number | string;
|
|
5
|
+
interface CSSFunction {
|
|
6
|
+
name: string;
|
|
7
|
+
args: CSSFunctionArgument[];
|
|
8
|
+
}
|
|
9
|
+
interface CSSSimpleSelector {
|
|
10
|
+
css?: string;
|
|
11
|
+
functions: CSSFunction[];
|
|
12
|
+
}
|
|
13
|
+
interface CSSComplexSelector {
|
|
14
|
+
simples: {
|
|
15
|
+
selector: CSSSimpleSelector;
|
|
16
|
+
combinator: ClauseCombinator;
|
|
17
|
+
}[];
|
|
18
|
+
}
|
|
19
|
+
type CSSComplexSelectorList = CSSComplexSelector[];
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Copyright (c) Microsoft Corporation.
|
|
23
|
+
*
|
|
24
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
25
|
+
* you may not use this file except in compliance with the License.
|
|
26
|
+
* You may obtain a copy of the License at
|
|
27
|
+
*
|
|
28
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
29
|
+
*
|
|
30
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
31
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
32
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
33
|
+
* See the License for the specific language governing permissions and
|
|
34
|
+
* limitations under the License.
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
interface NestedSelectorBody {
|
|
38
|
+
parsed: ParsedSelector;
|
|
39
|
+
distance?: number;
|
|
40
|
+
}
|
|
41
|
+
interface ParsedSelectorPart {
|
|
42
|
+
name: string;
|
|
43
|
+
body: string | CSSComplexSelectorList | NestedSelectorBody;
|
|
44
|
+
source: string;
|
|
45
|
+
}
|
|
46
|
+
interface ParsedSelector {
|
|
47
|
+
parts: ParsedSelectorPart[];
|
|
48
|
+
capture?: number;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Copyright (c) Microsoft Corporation.
|
|
53
|
+
*
|
|
54
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
55
|
+
* you may not use this file except in compliance with the License.
|
|
56
|
+
* You may obtain a copy of the License at
|
|
57
|
+
*
|
|
58
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
59
|
+
*
|
|
60
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
61
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
62
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
63
|
+
* See the License for the specific language governing permissions and
|
|
64
|
+
* limitations under the License.
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
interface GenerateSelectorOptions {
|
|
68
|
+
testIdAttributeName: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Copyright (c) Microsoft Corporation.
|
|
73
|
+
*
|
|
74
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
75
|
+
* you may not use this file except in compliance with the License.
|
|
76
|
+
* You may obtain a copy of the License at
|
|
77
|
+
*
|
|
78
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
79
|
+
*
|
|
80
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
81
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
82
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
83
|
+
* See the License for the specific language governing permissions and
|
|
84
|
+
* limitations under the License.
|
|
85
|
+
*/
|
|
86
|
+
|
|
87
|
+
interface ElementText {
|
|
88
|
+
full: string;
|
|
89
|
+
normalized: string;
|
|
90
|
+
immediate: string[];
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Copyright (c) Microsoft Corporation.
|
|
95
|
+
*
|
|
96
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
97
|
+
* you may not use this file except in compliance with the License.
|
|
98
|
+
* You may obtain a copy of the License at
|
|
99
|
+
*
|
|
100
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
101
|
+
*
|
|
102
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
103
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
104
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
105
|
+
* See the License for the specific language governing permissions and
|
|
106
|
+
* limitations under the License.
|
|
107
|
+
*/
|
|
108
|
+
|
|
109
|
+
interface QueryContext {
|
|
110
|
+
scope: Element | Document;
|
|
111
|
+
pierceShadow: boolean;
|
|
112
|
+
originalScope?: Element | Document;
|
|
113
|
+
}
|
|
114
|
+
type Selector = any;
|
|
115
|
+
interface SelectorEvaluator {
|
|
116
|
+
query: (context: QueryContext, selector: Selector) => Element[];
|
|
117
|
+
matches: (element: Element, selector: Selector, context: QueryContext) => boolean;
|
|
118
|
+
}
|
|
119
|
+
interface SelectorEngine$1 {
|
|
120
|
+
matches?: (element: Element, args: (string | number | Selector)[], context: QueryContext, evaluator: SelectorEvaluator) => boolean;
|
|
121
|
+
query?: (context: QueryContext, args: (string | number | Selector)[], evaluator: SelectorEvaluator) => Element[];
|
|
122
|
+
}
|
|
123
|
+
declare class SelectorEvaluatorImpl implements SelectorEvaluator {
|
|
124
|
+
private _engines;
|
|
125
|
+
private _cacheQueryCSS;
|
|
126
|
+
private _cacheMatches;
|
|
127
|
+
private _cacheQuery;
|
|
128
|
+
private _cacheMatchesSimple;
|
|
129
|
+
private _cacheMatchesParents;
|
|
130
|
+
private _cacheCallMatches;
|
|
131
|
+
private _cacheCallQuery;
|
|
132
|
+
private _cacheQuerySimple;
|
|
133
|
+
_cacheText: Map<Element | ShadowRoot, ElementText>;
|
|
134
|
+
private _scoreMap;
|
|
135
|
+
private _retainCacheCounter;
|
|
136
|
+
constructor(extraEngines: Map<string, SelectorEngine$1>);
|
|
137
|
+
begin(): void;
|
|
138
|
+
end(): void;
|
|
139
|
+
private _cached;
|
|
140
|
+
private _checkSelector;
|
|
141
|
+
matches(element: Element, s: Selector, context: QueryContext): boolean;
|
|
142
|
+
query(context: QueryContext, s: any): Element[];
|
|
143
|
+
_markScore(element: Element, score: number): void;
|
|
144
|
+
private _hasScopeClause;
|
|
145
|
+
private _expandContextForScopeMatching;
|
|
146
|
+
private _matchesSimple;
|
|
147
|
+
private _querySimple;
|
|
148
|
+
private _matchesParents;
|
|
149
|
+
private _matchesEngine;
|
|
150
|
+
private _queryEngine;
|
|
151
|
+
private _callMatches;
|
|
152
|
+
private _callQuery;
|
|
153
|
+
private _matchesCSS;
|
|
154
|
+
_queryCSS(context: QueryContext, css: string): Element[];
|
|
155
|
+
private _getEngine;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Copyright (c) Microsoft Corporation.
|
|
160
|
+
*
|
|
161
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
162
|
+
* you may not use this file except in compliance with the License.
|
|
163
|
+
* You may obtain a copy of the License at
|
|
164
|
+
*
|
|
165
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
166
|
+
*
|
|
167
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
168
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
169
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
170
|
+
* See the License for the specific language governing permissions and
|
|
171
|
+
* limitations under the License.
|
|
172
|
+
*/
|
|
173
|
+
interface ByRoleOptions {
|
|
174
|
+
checked?: boolean;
|
|
175
|
+
disabled?: boolean;
|
|
176
|
+
exact?: boolean;
|
|
177
|
+
expanded?: boolean;
|
|
178
|
+
includeHidden?: boolean;
|
|
179
|
+
level?: number;
|
|
180
|
+
name?: string | RegExp;
|
|
181
|
+
pressed?: boolean;
|
|
182
|
+
selected?: boolean;
|
|
183
|
+
}
|
|
184
|
+
declare function getByTestIdSelector(testIdAttributeName: string, testId: string | RegExp): string;
|
|
185
|
+
declare function getByLabelSelector(text: string | RegExp, options?: {
|
|
186
|
+
exact?: boolean;
|
|
187
|
+
}): string;
|
|
188
|
+
declare function getByAltTextSelector(text: string | RegExp, options?: {
|
|
189
|
+
exact?: boolean;
|
|
190
|
+
}): string;
|
|
191
|
+
declare function getByTitleSelector(text: string | RegExp, options?: {
|
|
192
|
+
exact?: boolean;
|
|
193
|
+
}): string;
|
|
194
|
+
declare function getByPlaceholderSelector(text: string | RegExp, options?: {
|
|
195
|
+
exact?: boolean;
|
|
196
|
+
}): string;
|
|
197
|
+
declare function getByTextSelector(text: string | RegExp, options?: {
|
|
198
|
+
exact?: boolean;
|
|
199
|
+
}): string;
|
|
200
|
+
declare function getByRoleSelector(role: string, options?: ByRoleOptions): string;
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Copyright (c) Microsoft Corporation.
|
|
204
|
+
*
|
|
205
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
206
|
+
* you may not use this file except in compliance with the License.
|
|
207
|
+
* You may obtain a copy of the License at
|
|
208
|
+
*
|
|
209
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
210
|
+
*
|
|
211
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
212
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
213
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
214
|
+
* See the License for the specific language governing permissions and
|
|
215
|
+
* limitations under the License.
|
|
216
|
+
*/
|
|
217
|
+
|
|
218
|
+
interface IvyaOptions {
|
|
219
|
+
testIdAttribute: string;
|
|
220
|
+
browser: 'webkit' | 'chromium' | 'firefox';
|
|
221
|
+
}
|
|
222
|
+
interface IvyaConfiguration {
|
|
223
|
+
testIdAttribute?: string;
|
|
224
|
+
browser: 'webkit' | 'chromium' | 'firefox';
|
|
225
|
+
}
|
|
226
|
+
declare class Ivya {
|
|
227
|
+
/** @internal */
|
|
228
|
+
_engines: Map<string, SelectorEngine>;
|
|
229
|
+
/** @internal */
|
|
230
|
+
_evaluator: SelectorEvaluatorImpl;
|
|
231
|
+
static options: IvyaOptions;
|
|
232
|
+
private static singleton;
|
|
233
|
+
static create(options: IvyaConfiguration): Ivya;
|
|
234
|
+
private constructor();
|
|
235
|
+
queryLocatorSelector(locator: string, root?: Node, strict?: boolean): Element | null;
|
|
236
|
+
queryLocatorSelectorAll(locator: string, root?: Node): Element[];
|
|
237
|
+
querySelector(selector: ParsedSelector, root: Node, strict?: boolean): Element | null;
|
|
238
|
+
queryAllByRole(text: string, options?: ByRoleOptions, container?: Node): Element[];
|
|
239
|
+
queryAllByLabelText(text: string | RegExp, options?: {
|
|
240
|
+
exact?: boolean;
|
|
241
|
+
}, container?: Node): Element[];
|
|
242
|
+
queryAllByTestId(text: string | RegExp, container?: Node): Element[];
|
|
243
|
+
queryAllByText(text: string | RegExp, options?: {
|
|
244
|
+
exact?: boolean;
|
|
245
|
+
}, container?: Node): Element[];
|
|
246
|
+
queryAllByTitle(text: string | RegExp, options?: {
|
|
247
|
+
exact?: boolean;
|
|
248
|
+
}, container?: Node): Element[];
|
|
249
|
+
queryAllByPlaceholder(text: string | RegExp, options?: {
|
|
250
|
+
exact?: boolean;
|
|
251
|
+
}, container?: Node): Element[];
|
|
252
|
+
queryAllByAltText(text: string | RegExp, options?: {
|
|
253
|
+
exact?: boolean;
|
|
254
|
+
}, container?: Node): Element[];
|
|
255
|
+
queryByRole(text: string, options?: ByRoleOptions, container?: Node): Element | null;
|
|
256
|
+
queryByLabelText(text: string | RegExp, options?: {
|
|
257
|
+
exact?: boolean;
|
|
258
|
+
}, container?: Node): Element | null;
|
|
259
|
+
queryByTestId(text: string | RegExp, container?: Node): Element | null;
|
|
260
|
+
queryByText(text: string | RegExp, options?: {
|
|
261
|
+
exact?: boolean;
|
|
262
|
+
}, container?: Node): Element | null;
|
|
263
|
+
queryByTitle(text: string | RegExp, options?: {
|
|
264
|
+
exact?: boolean;
|
|
265
|
+
}, container?: Node): Element | null;
|
|
266
|
+
queryByPlaceholder(text: string | RegExp, options?: {
|
|
267
|
+
exact?: boolean;
|
|
268
|
+
}, container?: Node): Element | null;
|
|
269
|
+
queryByAltText(text: string | RegExp, options?: {
|
|
270
|
+
exact?: boolean;
|
|
271
|
+
}, container?: Node): Element | null;
|
|
272
|
+
private strictModeViolationError;
|
|
273
|
+
generateSelectorSimple(targetElement: Element, options?: GenerateSelectorOptions): string;
|
|
274
|
+
parseSelector(selector: string): ParsedSelector;
|
|
275
|
+
previewNode(node: Node): string;
|
|
276
|
+
querySelectorAll(selector: ParsedSelector, root: Node): Element[];
|
|
277
|
+
private _queryEngineAll;
|
|
278
|
+
private _queryNth;
|
|
279
|
+
private _queryLayoutSelector;
|
|
280
|
+
private createStacklessError;
|
|
281
|
+
private _createTextEngine;
|
|
282
|
+
private _createAttributeEngine;
|
|
283
|
+
private _createCSSEngine;
|
|
284
|
+
private _createNamedAttributeEngine;
|
|
285
|
+
private _createVisibleEngine;
|
|
286
|
+
private _createControlEngine;
|
|
287
|
+
private _createHasEngine;
|
|
288
|
+
private _createHasNotEngine;
|
|
289
|
+
private _createInternalChainEngine;
|
|
290
|
+
private _createInternalLabelEngine;
|
|
291
|
+
private _createInternalHasTextEngine;
|
|
292
|
+
private _createInternalHasNotTextEngine;
|
|
293
|
+
}
|
|
294
|
+
type SelectorRoot = Element | ShadowRoot | Document;
|
|
295
|
+
interface SelectorEngine {
|
|
296
|
+
queryAll: (root: SelectorRoot, selector: string | any) => Element[];
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
declare function convertElementToCssSelector(element: Element): string;
|
|
300
|
+
declare function processTimeoutOptions<T extends {
|
|
301
|
+
timeout?: number;
|
|
302
|
+
}>(options_?: T): T | undefined;
|
|
303
|
+
declare function getIframeScale(): number;
|
|
304
|
+
|
|
305
|
+
declare const selectorEngine: Ivya;
|
|
306
|
+
declare abstract class Locator {
|
|
307
|
+
abstract selector: string;
|
|
308
|
+
private _parsedSelector;
|
|
309
|
+
protected _container?: Element | undefined;
|
|
310
|
+
protected _pwSelector?: string | undefined;
|
|
311
|
+
constructor();
|
|
312
|
+
click(options?: UserEventClickOptions): Promise<void>;
|
|
313
|
+
dblClick(options?: UserEventClickOptions): Promise<void>;
|
|
314
|
+
tripleClick(options?: UserEventClickOptions): Promise<void>;
|
|
315
|
+
clear(options?: UserEventClearOptions): Promise<void>;
|
|
316
|
+
hover(options?: UserEventHoverOptions): Promise<void>;
|
|
317
|
+
unhover(options?: UserEventHoverOptions): Promise<void>;
|
|
318
|
+
fill(text: string, options?: UserEventFillOptions): Promise<void>;
|
|
319
|
+
upload(files: string | string[] | File | File[], options?: UserEventUploadOptions): Promise<void>;
|
|
320
|
+
dropTo(target: Locator, options?: UserEventDragAndDropOptions): Promise<void>;
|
|
321
|
+
selectOptions(value: HTMLElement | HTMLElement[] | Locator | Locator[] | string | string[], options?: UserEventSelectOptions): Promise<void>;
|
|
322
|
+
screenshot(options: Omit<LocatorScreenshotOptions, "base64"> & {
|
|
323
|
+
base64: true;
|
|
324
|
+
}): Promise<{
|
|
325
|
+
path: string;
|
|
326
|
+
base64: string;
|
|
327
|
+
}>;
|
|
328
|
+
screenshot(options?: LocatorScreenshotOptions): Promise<string>;
|
|
329
|
+
protected abstract locator(selector: string): Locator;
|
|
330
|
+
protected abstract elementLocator(element: Element): Locator;
|
|
331
|
+
getByRole(role: string, options?: LocatorByRoleOptions): Locator;
|
|
332
|
+
getByAltText(text: string | RegExp, options?: LocatorOptions): Locator;
|
|
333
|
+
getByLabelText(text: string | RegExp, options?: LocatorOptions): Locator;
|
|
334
|
+
getByPlaceholder(text: string | RegExp, options?: LocatorOptions): Locator;
|
|
335
|
+
getByTestId(testId: string | RegExp): Locator;
|
|
336
|
+
getByText(text: string | RegExp, options?: LocatorOptions): Locator;
|
|
337
|
+
getByTitle(title: string | RegExp, options?: LocatorOptions): Locator;
|
|
338
|
+
filter(filter: LocatorOptions): Locator;
|
|
339
|
+
and(locator: Locator): Locator;
|
|
340
|
+
or(locator: Locator): Locator;
|
|
341
|
+
query(): HTMLElement | SVGElement | null;
|
|
342
|
+
element(): HTMLElement | SVGElement;
|
|
343
|
+
elements(): (HTMLElement | SVGElement)[];
|
|
344
|
+
get length(): number;
|
|
345
|
+
all(): Locator[];
|
|
346
|
+
nth(index: number): Locator;
|
|
347
|
+
first(): Locator;
|
|
348
|
+
last(): Locator;
|
|
349
|
+
toString(): string;
|
|
350
|
+
toJSON(): string;
|
|
351
|
+
protected triggerCommand<T>(command: string, ...args: any[]): Promise<T>;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
export { Locator, convertElementToCssSelector, getByAltTextSelector, getByLabelSelector, getByPlaceholderSelector, getByRoleSelector, getByTestIdSelector, getByTextSelector, getByTitleSelector, getIframeScale, processTimeoutOptions, selectorEngine };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{L as Locator,n as convertElementToCssSelector,q as getByAltTextSelector,r as getByLabelSelector,t as getByPlaceholderSelector,u as getByRoleSelector,v as getByTestIdSelector,w as getByTextSelector,x as getByTitleSelector,o as getIframeScale,p as processTimeoutOptions,s as selectorEngine}from"./index-D6m36C6U.js";import'../../browser.js';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Locator } from './context.js'
|
|
2
|
+
import type { TestingLibraryMatchers } from './jest-dom.js'
|
|
3
|
+
import type { Assertion, ExpectPollOptions } from '../../index.js'
|
|
4
|
+
|
|
5
|
+
declare module 'vitest' {
|
|
6
|
+
interface JestAssertion<T = any> extends TestingLibraryMatchers<void, T> {}
|
|
7
|
+
interface AsymmetricMatchersContaining extends TestingLibraryMatchers<void, void> {}
|
|
8
|
+
|
|
9
|
+
type Promisify<O> = {
|
|
10
|
+
[K in keyof O]: O[K] extends (...args: infer A) => infer R
|
|
11
|
+
? O extends R
|
|
12
|
+
? Promisify<O[K]>
|
|
13
|
+
: (...args: A) => Promise<R>
|
|
14
|
+
: O[K];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
type PromisifyDomAssertion<T> = Promisify<Assertion<T>>
|
|
18
|
+
|
|
19
|
+
interface ExpectStatic {
|
|
20
|
+
/**
|
|
21
|
+
* `expect.element(locator)` is a shorthand for `expect.poll(() => locator.element())`.
|
|
22
|
+
* You can set default timeout via `expect.poll.timeout` option in the config.
|
|
23
|
+
* @see {@link https://vitest.dev/api/expect#poll}
|
|
24
|
+
*/
|
|
25
|
+
element: <T extends HTMLElement | SVGElement | null | Locator>(element: T, options?: ExpectPollOptions) => PromisifyDomAssertion<Awaited<HTMLElement | SVGElement | null>>
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export {}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ScreenshotComparatorRegistry, ScreenshotMatcherOptions } from "../../../context.js";
|
|
2
|
+
export type ScreenshotMatcherArguments<ComparatorName extends keyof ScreenshotComparatorRegistry = keyof ScreenshotComparatorRegistry> = [name: string, testName: string, options: ScreenshotMatcherOptions<ComparatorName> & {
|
|
3
|
+
element: string;
|
|
4
|
+
screenshotOptions?: ScreenshotMatcherOptions<ComparatorName>["screenshotOptions"] & {
|
|
5
|
+
mask?: readonly string[];
|
|
6
|
+
};
|
|
7
|
+
}];
|
|
8
|
+
interface ScreenshotData {
|
|
9
|
+
path: string;
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
}
|
|
13
|
+
export type ScreenshotMatcherOutput = Promise<{
|
|
14
|
+
pass: false;
|
|
15
|
+
reference: ScreenshotData | null;
|
|
16
|
+
actual: ScreenshotData | null;
|
|
17
|
+
diff: ScreenshotData | null;
|
|
18
|
+
message: string;
|
|
19
|
+
} | {
|
|
20
|
+
pass: true;
|
|
21
|
+
}>;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
(function () {
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
let SOURCEMAPPING_URL = "sourceMa";
|
|
5
|
+
SOURCEMAPPING_URL += "ppingURL";
|
|
6
|
+
const isWindows = typeof process < "u" && process.platform === "win32";
|
|
7
|
+
function unwrapId(id) {
|
|
8
|
+
return id.startsWith("/@id/") ? id.slice(5).replace("__x00__", "\0") : id;
|
|
9
|
+
}
|
|
10
|
+
const windowsSlashRE = /\\/g;
|
|
11
|
+
function slash(p) {
|
|
12
|
+
return p.replace(windowsSlashRE, "/");
|
|
13
|
+
}
|
|
14
|
+
const postfixRE = /[?#].*$/;
|
|
15
|
+
function cleanUrl(url) {
|
|
16
|
+
return url.replace(postfixRE, "");
|
|
17
|
+
}
|
|
18
|
+
const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
19
|
+
function normalizeWindowsPath(input = "") {
|
|
20
|
+
return input && input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
21
|
+
}
|
|
22
|
+
const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
23
|
+
function cwd() {
|
|
24
|
+
return typeof process < "u" && typeof process.cwd == "function" ? process.cwd().replace(/\\/g, "/") : "/";
|
|
25
|
+
}
|
|
26
|
+
const resolve = function(...arguments_) {
|
|
27
|
+
arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
|
|
28
|
+
let resolvedPath = "", resolvedAbsolute = false;
|
|
29
|
+
for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
30
|
+
let path = index >= 0 ? arguments_[index] : cwd();
|
|
31
|
+
!path || path.length === 0 || (resolvedPath = `${path}/${resolvedPath}`, resolvedAbsolute = isAbsolute(path));
|
|
32
|
+
}
|
|
33
|
+
return resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute), resolvedAbsolute && !isAbsolute(resolvedPath) ? `/${resolvedPath}` : resolvedPath.length > 0 ? resolvedPath : ".";
|
|
34
|
+
};
|
|
35
|
+
function normalizeString(path, allowAboveRoot) {
|
|
36
|
+
let res = "", lastSegmentLength = 0, lastSlash = -1, dots = 0, char = null;
|
|
37
|
+
for (let index = 0; index <= path.length; ++index) {
|
|
38
|
+
if (index < path.length) char = path[index];
|
|
39
|
+
else if (char === "/") break;
|
|
40
|
+
else char = "/";
|
|
41
|
+
if (char === "/") {
|
|
42
|
+
if (!(lastSlash === index - 1 || dots === 1)) if (dots === 2) {
|
|
43
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
44
|
+
if (res.length > 2) {
|
|
45
|
+
let lastSlashIndex = res.lastIndexOf("/");
|
|
46
|
+
lastSlashIndex === -1 ? (res = "", lastSegmentLength = 0) : (res = res.slice(0, lastSlashIndex), lastSegmentLength = res.length - 1 - res.lastIndexOf("/")), lastSlash = index, dots = 0;
|
|
47
|
+
continue;
|
|
48
|
+
} else if (res.length > 0) {
|
|
49
|
+
res = "", lastSegmentLength = 0, lastSlash = index, dots = 0;
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
allowAboveRoot && (res += res.length > 0 ? "/.." : "..", lastSegmentLength = 2);
|
|
54
|
+
} else res.length > 0 ? res += `/${path.slice(lastSlash + 1, index)}` : res = path.slice(lastSlash + 1, index), lastSegmentLength = index - lastSlash - 1;
|
|
55
|
+
lastSlash = index, dots = 0;
|
|
56
|
+
} else char === "." && dots !== -1 ? ++dots : dots = -1;
|
|
57
|
+
}
|
|
58
|
+
return res;
|
|
59
|
+
}
|
|
60
|
+
const isAbsolute = function(p) {
|
|
61
|
+
return _IS_ABSOLUTE_RE.test(p);
|
|
62
|
+
}, decodeBase64 = typeof atob < "u" ? atob : (str) => Buffer.from(str, "base64").toString("utf-8");
|
|
63
|
+
const posixResolve = resolve;
|
|
64
|
+
const intToChar = new Uint8Array(64), charToInt = new Uint8Array(128);
|
|
65
|
+
for (let i = 0; i < 64; i++) {
|
|
66
|
+
let c = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(i);
|
|
67
|
+
intToChar[i] = c, charToInt[c] = i;
|
|
68
|
+
}
|
|
69
|
+
var DecodedMap = class {
|
|
70
|
+
_encoded;
|
|
71
|
+
_decoded;
|
|
72
|
+
_decodedMemo;
|
|
73
|
+
url;
|
|
74
|
+
version;
|
|
75
|
+
names = [];
|
|
76
|
+
resolvedSources;
|
|
77
|
+
constructor(map, from) {
|
|
78
|
+
this.map = map;
|
|
79
|
+
let { mappings, names, sources } = map;
|
|
80
|
+
this.version = map.version, this.names = names || [], this._encoded = mappings || "", this._decodedMemo = memoizedState(), this.url = from, this.resolvedSources = (sources || []).map((s) => posixResolve(s || "", from));
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
function memoizedState() {
|
|
84
|
+
return {
|
|
85
|
+
lastKey: -1,
|
|
86
|
+
lastNeedle: -1,
|
|
87
|
+
lastIndex: -1
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
const MODULE_RUNNER_SOURCEMAPPING_REGEXP = /* @__PURE__ */ RegExp(`//# ${SOURCEMAPPING_URL}=data:application/json;base64,(.+)`);
|
|
91
|
+
var EvaluatedModuleNode = class {
|
|
92
|
+
importers = /* @__PURE__ */ new Set();
|
|
93
|
+
imports = /* @__PURE__ */ new Set();
|
|
94
|
+
evaluated = false;
|
|
95
|
+
meta;
|
|
96
|
+
promise;
|
|
97
|
+
exports;
|
|
98
|
+
file;
|
|
99
|
+
map;
|
|
100
|
+
constructor(id, url) {
|
|
101
|
+
this.id = id, this.url = url, this.file = cleanUrl(id);
|
|
102
|
+
}
|
|
103
|
+
}, EvaluatedModules = class {
|
|
104
|
+
idToModuleMap = /* @__PURE__ */ new Map();
|
|
105
|
+
fileToModulesMap = /* @__PURE__ */ new Map();
|
|
106
|
+
urlToIdModuleMap = /* @__PURE__ */ new Map();
|
|
107
|
+
getModuleById(id) {
|
|
108
|
+
return this.idToModuleMap.get(id);
|
|
109
|
+
}
|
|
110
|
+
getModulesByFile(file) {
|
|
111
|
+
return this.fileToModulesMap.get(file);
|
|
112
|
+
}
|
|
113
|
+
getModuleByUrl(url) {
|
|
114
|
+
return this.urlToIdModuleMap.get(unwrapId(url));
|
|
115
|
+
}
|
|
116
|
+
ensureModule(id, url) {
|
|
117
|
+
if (id = normalizeModuleId(id), this.idToModuleMap.has(id)) {
|
|
118
|
+
let moduleNode$1 = this.idToModuleMap.get(id);
|
|
119
|
+
return this.urlToIdModuleMap.set(url, moduleNode$1), moduleNode$1;
|
|
120
|
+
}
|
|
121
|
+
let moduleNode = new EvaluatedModuleNode(id, url);
|
|
122
|
+
this.idToModuleMap.set(id, moduleNode), this.urlToIdModuleMap.set(url, moduleNode);
|
|
123
|
+
let fileModules = this.fileToModulesMap.get(moduleNode.file) || /* @__PURE__ */ new Set();
|
|
124
|
+
return fileModules.add(moduleNode), this.fileToModulesMap.set(moduleNode.file, fileModules), moduleNode;
|
|
125
|
+
}
|
|
126
|
+
invalidateModule(node) {
|
|
127
|
+
node.evaluated = false, node.meta = void 0, node.map = void 0, node.promise = void 0, node.exports = void 0, node.imports.clear();
|
|
128
|
+
}
|
|
129
|
+
getModuleSourceMapById(id) {
|
|
130
|
+
let mod = this.getModuleById(id);
|
|
131
|
+
if (!mod) return null;
|
|
132
|
+
if (mod.map) return mod.map;
|
|
133
|
+
if (!mod.meta || !("code" in mod.meta)) return null;
|
|
134
|
+
let pattern = `//# ${SOURCEMAPPING_URL}=data:application/json;base64,`, lastIndex = mod.meta.code.lastIndexOf(pattern);
|
|
135
|
+
if (lastIndex === -1) return null;
|
|
136
|
+
let mapString = MODULE_RUNNER_SOURCEMAPPING_REGEXP.exec(mod.meta.code.slice(lastIndex))?.[1];
|
|
137
|
+
return mapString ? (mod.map = new DecodedMap(JSON.parse(decodeBase64(mapString)), mod.file), mod.map) : null;
|
|
138
|
+
}
|
|
139
|
+
clear() {
|
|
140
|
+
this.idToModuleMap.clear(), this.fileToModulesMap.clear(), this.urlToIdModuleMap.clear();
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
const prefixedBuiltins = new Set([
|
|
144
|
+
"node:sea",
|
|
145
|
+
"node:sqlite",
|
|
146
|
+
"node:test",
|
|
147
|
+
"node:test/reporters"
|
|
148
|
+
]);
|
|
149
|
+
function normalizeModuleId(file) {
|
|
150
|
+
if (prefixedBuiltins.has(file)) return file;
|
|
151
|
+
let unixFile = slash(file).replace(/^\/@fs\//, isWindows ? "" : "/").replace(/^node:/, "").replace(/^\/+/, "/");
|
|
152
|
+
return unixFile.replace(/^file:\/+/, isWindows ? "" : "/");
|
|
153
|
+
}
|
|
154
|
+
const customizationHookNamespace = "vite-module-runner:import-meta-resolve/v1/"; `
|
|
155
|
+
|
|
156
|
+
export async function resolve(specifier, context, nextResolve) {
|
|
157
|
+
if (specifier.startsWith(${JSON.stringify(customizationHookNamespace)})) {
|
|
158
|
+
const data = specifier.slice(${JSON.stringify(customizationHookNamespace)}.length)
|
|
159
|
+
const [parsedSpecifier, parsedImporter] = JSON.parse(data)
|
|
160
|
+
specifier = parsedSpecifier
|
|
161
|
+
context.parentURL = parsedImporter
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return nextResolve(specifier, context)
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
`;
|
|
168
|
+
new Proxy({}, { get(_, p) {
|
|
169
|
+
throw Error(`[module runner] Dynamic access of "import.meta.env" is not supported. Please, use "import.meta.env.${String(p)}" instead.`);
|
|
170
|
+
} });
|
|
171
|
+
|
|
172
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
173
|
+
function getBrowserState() {
|
|
174
|
+
// @ts-expect-error not typed global
|
|
175
|
+
return window.__vitest_browser_runner__;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const config = getBrowserState().config;
|
|
179
|
+
const sessionId = getBrowserState().sessionId;
|
|
180
|
+
const state = {
|
|
181
|
+
ctx: {
|
|
182
|
+
rpc: null,
|
|
183
|
+
pool: "browser",
|
|
184
|
+
workerId: 1,
|
|
185
|
+
config,
|
|
186
|
+
projectName: config.name || "",
|
|
187
|
+
files: [],
|
|
188
|
+
environment: {
|
|
189
|
+
name: "browser",
|
|
190
|
+
options: null
|
|
191
|
+
},
|
|
192
|
+
providedContext: {},
|
|
193
|
+
invalidates: []
|
|
194
|
+
},
|
|
195
|
+
onCancel: null,
|
|
196
|
+
config,
|
|
197
|
+
environment: {
|
|
198
|
+
name: "browser",
|
|
199
|
+
viteEnvironment: "client",
|
|
200
|
+
setup() {
|
|
201
|
+
throw new Error("Not called in the browser");
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
onCleanup: (fn) => getBrowserState().cleanups.push(fn),
|
|
205
|
+
evaluatedModules: new EvaluatedModules(),
|
|
206
|
+
resolvingModules: new Set(),
|
|
207
|
+
moduleExecutionInfo: new Map(),
|
|
208
|
+
metaEnv: null,
|
|
209
|
+
rpc: null,
|
|
210
|
+
durations: {
|
|
211
|
+
environment: 0,
|
|
212
|
+
prepare: performance.now()
|
|
213
|
+
},
|
|
214
|
+
providedContext: {}
|
|
215
|
+
};
|
|
216
|
+
// @ts-expect-error not typed global
|
|
217
|
+
globalThis.__vitest_browser__ = true;
|
|
218
|
+
// @ts-expect-error not typed global
|
|
219
|
+
globalThis.__vitest_worker__ = state;
|
|
220
|
+
getBrowserState().cdp = createCdp();
|
|
221
|
+
function rpc() {
|
|
222
|
+
return state.rpc;
|
|
223
|
+
}
|
|
224
|
+
function createCdp() {
|
|
225
|
+
const listenersMap = new WeakMap();
|
|
226
|
+
function getId(listener) {
|
|
227
|
+
const id = listenersMap.get(listener) || crypto.randomUUID();
|
|
228
|
+
listenersMap.set(listener, id);
|
|
229
|
+
return id;
|
|
230
|
+
}
|
|
231
|
+
const listeners = {};
|
|
232
|
+
const cdp = {
|
|
233
|
+
send(method, params) {
|
|
234
|
+
return rpc().sendCdpEvent(sessionId, method, params);
|
|
235
|
+
},
|
|
236
|
+
on(event, listener) {
|
|
237
|
+
const listenerId = getId(listener);
|
|
238
|
+
listeners[event] = listeners[event] || [];
|
|
239
|
+
listeners[event].push(listener);
|
|
240
|
+
rpc().trackCdpEvent(sessionId, "on", event, listenerId).catch(error);
|
|
241
|
+
return cdp;
|
|
242
|
+
},
|
|
243
|
+
once(event, listener) {
|
|
244
|
+
const listenerId = getId(listener);
|
|
245
|
+
const handler = (data) => {
|
|
246
|
+
listener(data);
|
|
247
|
+
cdp.off(event, listener);
|
|
248
|
+
};
|
|
249
|
+
listeners[event] = listeners[event] || [];
|
|
250
|
+
listeners[event].push(handler);
|
|
251
|
+
rpc().trackCdpEvent(sessionId, "once", event, listenerId).catch(error);
|
|
252
|
+
return cdp;
|
|
253
|
+
},
|
|
254
|
+
off(event, listener) {
|
|
255
|
+
const listenerId = getId(listener);
|
|
256
|
+
if (listeners[event]) {
|
|
257
|
+
listeners[event] = listeners[event].filter((l) => l !== listener);
|
|
258
|
+
}
|
|
259
|
+
rpc().trackCdpEvent(sessionId, "off", event, listenerId).catch(error);
|
|
260
|
+
return cdp;
|
|
261
|
+
},
|
|
262
|
+
emit(event, payload) {
|
|
263
|
+
if (listeners[event]) {
|
|
264
|
+
listeners[event].forEach((l) => {
|
|
265
|
+
try {
|
|
266
|
+
l(payload);
|
|
267
|
+
} catch (err) {
|
|
268
|
+
error(err);
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
return cdp;
|
|
275
|
+
}
|
|
276
|
+
function error(err) {
|
|
277
|
+
window.dispatchEvent(new ErrorEvent("error", { error: err }));
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
})();
|