@quickpickle/vitest-browser 0.0.2
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/CHANGELOG.md +15 -0
- package/LICENSE +21 -0
- package/README.md +4 -0
- package/dist/VitestBrowserWorld.cjs +179 -0
- package/dist/VitestBrowserWorld.cjs.map +1 -0
- package/dist/VitestBrowserWorld.d.ts +103 -0
- package/dist/VitestBrowserWorld.mjs +176 -0
- package/dist/VitestBrowserWorld.mjs.map +1 -0
- package/dist/actions.steps.cjs +157 -0
- package/dist/actions.steps.cjs.map +1 -0
- package/dist/actions.steps.d.ts +1 -0
- package/dist/actions.steps.mjs +155 -0
- package/dist/actions.steps.mjs.map +1 -0
- package/dist/frameworks/ReactBrowserWorld.cjs +38 -0
- package/dist/frameworks/ReactBrowserWorld.cjs.map +1 -0
- package/dist/frameworks/ReactBrowserWorld.d.ts +10 -0
- package/dist/frameworks/ReactBrowserWorld.mjs +36 -0
- package/dist/frameworks/ReactBrowserWorld.mjs.map +1 -0
- package/dist/frameworks/SvelteBrowserWorld.cjs +17 -0
- package/dist/frameworks/SvelteBrowserWorld.cjs.map +1 -0
- package/dist/frameworks/SvelteBrowserWorld.d.ts +9 -0
- package/dist/frameworks/SvelteBrowserWorld.mjs +15 -0
- package/dist/frameworks/SvelteBrowserWorld.mjs.map +1 -0
- package/dist/frameworks/VueBrowserWorld.cjs +25 -0
- package/dist/frameworks/VueBrowserWorld.cjs.map +1 -0
- package/dist/frameworks/VueBrowserWorld.d.ts +10 -0
- package/dist/frameworks/VueBrowserWorld.mjs +23 -0
- package/dist/frameworks/VueBrowserWorld.mjs.map +1 -0
- package/dist/frameworks/react.cjs +11 -0
- package/dist/frameworks/react.cjs.map +1 -0
- package/dist/frameworks/react.d.ts +1 -0
- package/dist/frameworks/react.mjs +9 -0
- package/dist/frameworks/react.mjs.map +1 -0
- package/dist/frameworks/svelte.cjs +10 -0
- package/dist/frameworks/svelte.cjs.map +1 -0
- package/dist/frameworks/svelte.d.ts +1 -0
- package/dist/frameworks/svelte.mjs +8 -0
- package/dist/frameworks/svelte.mjs.map +1 -0
- package/dist/frameworks/vue.cjs +10 -0
- package/dist/frameworks/vue.cjs.map +1 -0
- package/dist/frameworks/vue.d.ts +1 -0
- package/dist/frameworks/vue.mjs +8 -0
- package/dist/frameworks/vue.mjs.map +1 -0
- package/dist/outcomes.steps.cjs +186 -0
- package/dist/outcomes.steps.cjs.map +1 -0
- package/dist/outcomes.steps.d.ts +1 -0
- package/dist/outcomes.steps.mjs +184 -0
- package/dist/outcomes.steps.mjs.map +1 -0
- package/package.json +103 -0
- package/rollup.config.js +58 -0
- package/src/VitestBrowserWorld.ts +205 -0
- package/src/actions.steps.ts +169 -0
- package/src/frameworks/ReactBrowserWorld.ts +41 -0
- package/src/frameworks/SvelteBrowserWorld.ts +15 -0
- package/src/frameworks/VueBrowserWorld.ts +23 -0
- package/src/frameworks/react.ts +4 -0
- package/src/frameworks/svelte.ts +4 -0
- package/src/frameworks/vue.ts +4 -0
- package/src/outcomes.steps.ts +190 -0
- package/tests/react/Hello.tsx +23 -0
- package/tests/react/react.feature +15 -0
- package/tests/svelte/Hello.svelte +31 -0
- package/tests/svelte/svelte.feature +16 -0
- package/tests/vue/Hello.vue +31 -0
- package/tests/vue/vue.feature +16 -0
- package/tsconfig.json +17 -0
- package/vite.config.ts +8 -0
- package/vitest.workspace.ts +95 -0
- package/world.ts +7 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var quickpickle = require('quickpickle');
|
|
4
|
+
var vitest = require('vitest');
|
|
5
|
+
|
|
6
|
+
/// <reference types="@vitest/browser/providers/playwright" />
|
|
7
|
+
/**
|
|
8
|
+
* RENDERING COMPONENTS
|
|
9
|
+
*/
|
|
10
|
+
quickpickle.Given('I render (the ){string}( component)', async (world, name) => {
|
|
11
|
+
await world.render(name);
|
|
12
|
+
});
|
|
13
|
+
quickpickle.Given('I render (the ){string}( component) with the following props/properties:', async (world, name, props) => {
|
|
14
|
+
let propsObj = props.raw().reduce((acc, row) => {
|
|
15
|
+
let value;
|
|
16
|
+
try {
|
|
17
|
+
value = JSON.parse(row[1]);
|
|
18
|
+
}
|
|
19
|
+
catch (e) {
|
|
20
|
+
value = row[1];
|
|
21
|
+
}
|
|
22
|
+
acc[row[0]] = value;
|
|
23
|
+
return acc;
|
|
24
|
+
}, {});
|
|
25
|
+
await world.render(name, propsObj);
|
|
26
|
+
});
|
|
27
|
+
// ================
|
|
28
|
+
// Interaction
|
|
29
|
+
quickpickle.When('I click/press/tap/touch (on ){string}', async function (world, identifier) {
|
|
30
|
+
let locator = world.page.getByText(identifier, { exact: true });
|
|
31
|
+
await locator.click({ timeout: world.worldConfig.stepTimeout });
|
|
32
|
+
});
|
|
33
|
+
quickpickle.When('I click/press/tap/touch (on )the {string} {word}', async function (world, identifier, role) {
|
|
34
|
+
let locator = world.getLocator(world.page, identifier, role);
|
|
35
|
+
await locator.click({ timeout: world.worldConfig.stepTimeout });
|
|
36
|
+
});
|
|
37
|
+
quickpickle.When('I focus/select/activate (on ){string}', async function (world, identifier) {
|
|
38
|
+
let locator = world.page.getByText(identifier, { exact: true });
|
|
39
|
+
locator.element()?.focus();
|
|
40
|
+
await vitest.expect(locator).toHaveFocus();
|
|
41
|
+
});
|
|
42
|
+
quickpickle.When('I focus/select/activate (on )the {string} {word}', async function (world, identifier, role) {
|
|
43
|
+
let locator = world.getLocator(world.page, identifier, role);
|
|
44
|
+
locator.element().focus();
|
|
45
|
+
await vitest.expect(locator).toHaveFocus();
|
|
46
|
+
});
|
|
47
|
+
// ================
|
|
48
|
+
// Typing
|
|
49
|
+
quickpickle.When("for/in/on (the ){string} I type {string}", async function (world, identifier, value) {
|
|
50
|
+
const locator = world.getLocator(world.page, identifier, 'input');
|
|
51
|
+
const element = locator.element();
|
|
52
|
+
element.focus();
|
|
53
|
+
await world.userEvent.keyboard(value);
|
|
54
|
+
});
|
|
55
|
+
quickpickle.When("for/in/on (the ){string} {word} I type {string}", async function (world, identifier, role, value) {
|
|
56
|
+
const locator = world.getLocator(world.page, identifier, role);
|
|
57
|
+
const element = locator.element();
|
|
58
|
+
element.focus();
|
|
59
|
+
await world.userEvent.keyboard(value);
|
|
60
|
+
});
|
|
61
|
+
quickpickle.When('I type the following keys: {}', async function (world, keys) {
|
|
62
|
+
for (let key of keys.split(' ')) {
|
|
63
|
+
if (key !== '{{' && key !== '[[' && !key.match(/^[\{\[].+[\}\]]$/))
|
|
64
|
+
key = `{${key}}`;
|
|
65
|
+
await world.userEvent.keyboard(key);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
quickpickle.When("for/in/on (the ){string} I type the following keys: {}", async function (world, identifier, keys) {
|
|
69
|
+
const locator = world.getLocator(world.page, identifier, 'input');
|
|
70
|
+
const element = locator.element();
|
|
71
|
+
element.focus();
|
|
72
|
+
for (let key of keys.split(' ')) {
|
|
73
|
+
if (key !== '{{' && key !== '[[' && !key.match(/^[\{\[].+[\}\]]$/))
|
|
74
|
+
key = `{${key}}`;
|
|
75
|
+
await world.userEvent.keyboard(key);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
quickpickle.When("for/in/on (the ){string} {word} I type the following keys: {}", async function (world, identifier, role, keys) {
|
|
79
|
+
const locator = world.getLocator(world.page, identifier, role);
|
|
80
|
+
const element = locator.element();
|
|
81
|
+
element.focus();
|
|
82
|
+
for (let key of keys.split(' ')) {
|
|
83
|
+
if (key !== '{{' && key !== '[[' && !key.match(/^[\{\[].+[\}\]]$/))
|
|
84
|
+
key = `{${key}}`;
|
|
85
|
+
await world.userEvent.keyboard(key);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
// ================
|
|
89
|
+
// Forms
|
|
90
|
+
quickpickle.When("for/in/on (the ){string} I enter/fill/select (in ){string}", async function (world, identifier, value) {
|
|
91
|
+
let locator = world.getLocator(world.page, identifier, 'input');
|
|
92
|
+
await world.setValue(locator, value);
|
|
93
|
+
});
|
|
94
|
+
quickpickle.When("for/in/on (the ){string} {word} I enter/fill/select (in ){string}", async function (world, identifier, role, value) {
|
|
95
|
+
let locator = world.getLocator(world.page, identifier, role);
|
|
96
|
+
await world.setValue(locator, value);
|
|
97
|
+
});
|
|
98
|
+
quickpickle.When("for/in/on (the ){string} I enter/fill/select (in )the following( text):", async function (world, identifier, value) {
|
|
99
|
+
let locator = world.getLocator(world.page, identifier, 'input');
|
|
100
|
+
await world.setValue(locator, value.toString());
|
|
101
|
+
});
|
|
102
|
+
quickpickle.When("for/in/on (the ){string} {word} I enter/fill/select (in )the following( text):", async function (world, identifier, role, value) {
|
|
103
|
+
let locator = world.getLocator(world.page, identifier, role);
|
|
104
|
+
await world.setValue(locator, value.toString());
|
|
105
|
+
});
|
|
106
|
+
quickpickle.When('I enter/fill (in )the following( fields):', async function (world, table) {
|
|
107
|
+
let rows = table.raw();
|
|
108
|
+
let hasRole = rows[0].length === 3;
|
|
109
|
+
for (let row of table.raw()) {
|
|
110
|
+
let [identifier, role, value] = row;
|
|
111
|
+
if (!hasRole) {
|
|
112
|
+
value = role;
|
|
113
|
+
role = 'input';
|
|
114
|
+
}
|
|
115
|
+
let locator = world.getLocator(world.page, identifier, role);
|
|
116
|
+
await world.setValue(locator, value);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
quickpickle.When('I check (the ){string}( radio)( checkbox)( box)', async function (world, indentifier) {
|
|
120
|
+
let locator = world.getLocator(world.page, indentifier, 'input');
|
|
121
|
+
await world.setValue(locator, 'on');
|
|
122
|
+
});
|
|
123
|
+
quickpickle.When('I uncheck (the ){string}( checkbox)( box)', async function (world, indentifier) {
|
|
124
|
+
let locator = world.getLocator(world.page, indentifier, 'input');
|
|
125
|
+
await world.setValue(locator, 'off');
|
|
126
|
+
});
|
|
127
|
+
// ================
|
|
128
|
+
// Waiting
|
|
129
|
+
// When('I wait for {string} to be attached/detatched/visible/hidden', async function (world:VitestBrowserWorld, text) {
|
|
130
|
+
// let state = world.info.step?.match(/(attached|detatched|visible|hidden)$/)![0] as 'attached'|'detached'|'visible'|'hidden'
|
|
131
|
+
// let locator = world.page.getByText(text)
|
|
132
|
+
// await locator.waitFor({ state, timeout:world.worldConfig.stepTimeout })
|
|
133
|
+
// })
|
|
134
|
+
// When('I wait for a/an/the {string} {word} to be attached/detatched/visible/hidden', async function (world:VitestBrowserWorld, identifier, role) {
|
|
135
|
+
// let state = world.info.step?.match(/(attached|detatched|visible|hidden)$/)![0] as 'attached'|'detached'|'visible'|'hidden'
|
|
136
|
+
// let locator = world.getLocator(world.page, identifier, role)
|
|
137
|
+
// await locator.waitFor({ state, timeout:world.worldConfig.stepTimeout })
|
|
138
|
+
// })
|
|
139
|
+
quickpickle.When('I wait (for ){int}ms', async function (world, num) {
|
|
140
|
+
await world.waitForTimeout(num);
|
|
141
|
+
});
|
|
142
|
+
quickpickle.When('I wait (for ){float} second(s)', async function (world, num) {
|
|
143
|
+
await world.waitForTimeout(num * 1000);
|
|
144
|
+
});
|
|
145
|
+
// ================
|
|
146
|
+
// Scrolling
|
|
147
|
+
quickpickle.When('I scroll (the ){string} {word} down/up/left/right', async function (world, identifier, role) {
|
|
148
|
+
let locator = world.getLocator(world.page, identifier, role);
|
|
149
|
+
let direction = world.info.step?.match(/(down|up|left|right)$/)[0];
|
|
150
|
+
await world.scroll(locator, direction);
|
|
151
|
+
});
|
|
152
|
+
quickpickle.When('I scroll (the ){string} {word} down/up/left/right {int}(px)( pixels)', async function (world, identifier, role, num) {
|
|
153
|
+
let locator = world.getLocator(world.page, identifier, role);
|
|
154
|
+
let direction = world.info.step?.match(/(down|up|left|right)(?= \d)/)[0];
|
|
155
|
+
await world.scroll(locator, direction, num);
|
|
156
|
+
});
|
|
157
|
+
//# sourceMappingURL=actions.steps.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.steps.cjs","sources":["../src/actions.steps.ts"],"sourcesContent":[null],"names":["Given","When","expect"],"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K,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC;AAC5D,IAAA,IAAI,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,6BAA6B,CAAE,CAAC,CAAC,CAA+B;IACvG,MAAM,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,GAAG,CAAC;AAC7C,CAAC,CAAC;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { Given, When } from 'quickpickle';
|
|
2
|
+
import { expect } from 'vitest';
|
|
3
|
+
|
|
4
|
+
/// <reference types="@vitest/browser/providers/playwright" />
|
|
5
|
+
/**
|
|
6
|
+
* RENDERING COMPONENTS
|
|
7
|
+
*/
|
|
8
|
+
Given('I render (the ){string}( component)', async (world, name) => {
|
|
9
|
+
await world.render(name);
|
|
10
|
+
});
|
|
11
|
+
Given('I render (the ){string}( component) with the following props/properties:', async (world, name, props) => {
|
|
12
|
+
let propsObj = props.raw().reduce((acc, row) => {
|
|
13
|
+
let value;
|
|
14
|
+
try {
|
|
15
|
+
value = JSON.parse(row[1]);
|
|
16
|
+
}
|
|
17
|
+
catch (e) {
|
|
18
|
+
value = row[1];
|
|
19
|
+
}
|
|
20
|
+
acc[row[0]] = value;
|
|
21
|
+
return acc;
|
|
22
|
+
}, {});
|
|
23
|
+
await world.render(name, propsObj);
|
|
24
|
+
});
|
|
25
|
+
// ================
|
|
26
|
+
// Interaction
|
|
27
|
+
When('I click/press/tap/touch (on ){string}', async function (world, identifier) {
|
|
28
|
+
let locator = world.page.getByText(identifier, { exact: true });
|
|
29
|
+
await locator.click({ timeout: world.worldConfig.stepTimeout });
|
|
30
|
+
});
|
|
31
|
+
When('I click/press/tap/touch (on )the {string} {word}', async function (world, identifier, role) {
|
|
32
|
+
let locator = world.getLocator(world.page, identifier, role);
|
|
33
|
+
await locator.click({ timeout: world.worldConfig.stepTimeout });
|
|
34
|
+
});
|
|
35
|
+
When('I focus/select/activate (on ){string}', async function (world, identifier) {
|
|
36
|
+
let locator = world.page.getByText(identifier, { exact: true });
|
|
37
|
+
locator.element()?.focus();
|
|
38
|
+
await expect(locator).toHaveFocus();
|
|
39
|
+
});
|
|
40
|
+
When('I focus/select/activate (on )the {string} {word}', async function (world, identifier, role) {
|
|
41
|
+
let locator = world.getLocator(world.page, identifier, role);
|
|
42
|
+
locator.element().focus();
|
|
43
|
+
await expect(locator).toHaveFocus();
|
|
44
|
+
});
|
|
45
|
+
// ================
|
|
46
|
+
// Typing
|
|
47
|
+
When("for/in/on (the ){string} I type {string}", async function (world, identifier, value) {
|
|
48
|
+
const locator = world.getLocator(world.page, identifier, 'input');
|
|
49
|
+
const element = locator.element();
|
|
50
|
+
element.focus();
|
|
51
|
+
await world.userEvent.keyboard(value);
|
|
52
|
+
});
|
|
53
|
+
When("for/in/on (the ){string} {word} I type {string}", async function (world, identifier, role, value) {
|
|
54
|
+
const locator = world.getLocator(world.page, identifier, role);
|
|
55
|
+
const element = locator.element();
|
|
56
|
+
element.focus();
|
|
57
|
+
await world.userEvent.keyboard(value);
|
|
58
|
+
});
|
|
59
|
+
When('I type the following keys: {}', async function (world, keys) {
|
|
60
|
+
for (let key of keys.split(' ')) {
|
|
61
|
+
if (key !== '{{' && key !== '[[' && !key.match(/^[\{\[].+[\}\]]$/))
|
|
62
|
+
key = `{${key}}`;
|
|
63
|
+
await world.userEvent.keyboard(key);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
When("for/in/on (the ){string} I type the following keys: {}", async function (world, identifier, keys) {
|
|
67
|
+
const locator = world.getLocator(world.page, identifier, 'input');
|
|
68
|
+
const element = locator.element();
|
|
69
|
+
element.focus();
|
|
70
|
+
for (let key of keys.split(' ')) {
|
|
71
|
+
if (key !== '{{' && key !== '[[' && !key.match(/^[\{\[].+[\}\]]$/))
|
|
72
|
+
key = `{${key}}`;
|
|
73
|
+
await world.userEvent.keyboard(key);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
When("for/in/on (the ){string} {word} I type the following keys: {}", async function (world, identifier, role, keys) {
|
|
77
|
+
const locator = world.getLocator(world.page, identifier, role);
|
|
78
|
+
const element = locator.element();
|
|
79
|
+
element.focus();
|
|
80
|
+
for (let key of keys.split(' ')) {
|
|
81
|
+
if (key !== '{{' && key !== '[[' && !key.match(/^[\{\[].+[\}\]]$/))
|
|
82
|
+
key = `{${key}}`;
|
|
83
|
+
await world.userEvent.keyboard(key);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
// ================
|
|
87
|
+
// Forms
|
|
88
|
+
When("for/in/on (the ){string} I enter/fill/select (in ){string}", async function (world, identifier, value) {
|
|
89
|
+
let locator = world.getLocator(world.page, identifier, 'input');
|
|
90
|
+
await world.setValue(locator, value);
|
|
91
|
+
});
|
|
92
|
+
When("for/in/on (the ){string} {word} I enter/fill/select (in ){string}", async function (world, identifier, role, value) {
|
|
93
|
+
let locator = world.getLocator(world.page, identifier, role);
|
|
94
|
+
await world.setValue(locator, value);
|
|
95
|
+
});
|
|
96
|
+
When("for/in/on (the ){string} I enter/fill/select (in )the following( text):", async function (world, identifier, value) {
|
|
97
|
+
let locator = world.getLocator(world.page, identifier, 'input');
|
|
98
|
+
await world.setValue(locator, value.toString());
|
|
99
|
+
});
|
|
100
|
+
When("for/in/on (the ){string} {word} I enter/fill/select (in )the following( text):", async function (world, identifier, role, value) {
|
|
101
|
+
let locator = world.getLocator(world.page, identifier, role);
|
|
102
|
+
await world.setValue(locator, value.toString());
|
|
103
|
+
});
|
|
104
|
+
When('I enter/fill (in )the following( fields):', async function (world, table) {
|
|
105
|
+
let rows = table.raw();
|
|
106
|
+
let hasRole = rows[0].length === 3;
|
|
107
|
+
for (let row of table.raw()) {
|
|
108
|
+
let [identifier, role, value] = row;
|
|
109
|
+
if (!hasRole) {
|
|
110
|
+
value = role;
|
|
111
|
+
role = 'input';
|
|
112
|
+
}
|
|
113
|
+
let locator = world.getLocator(world.page, identifier, role);
|
|
114
|
+
await world.setValue(locator, value);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
When('I check (the ){string}( radio)( checkbox)( box)', async function (world, indentifier) {
|
|
118
|
+
let locator = world.getLocator(world.page, indentifier, 'input');
|
|
119
|
+
await world.setValue(locator, 'on');
|
|
120
|
+
});
|
|
121
|
+
When('I uncheck (the ){string}( checkbox)( box)', async function (world, indentifier) {
|
|
122
|
+
let locator = world.getLocator(world.page, indentifier, 'input');
|
|
123
|
+
await world.setValue(locator, 'off');
|
|
124
|
+
});
|
|
125
|
+
// ================
|
|
126
|
+
// Waiting
|
|
127
|
+
// When('I wait for {string} to be attached/detatched/visible/hidden', async function (world:VitestBrowserWorld, text) {
|
|
128
|
+
// let state = world.info.step?.match(/(attached|detatched|visible|hidden)$/)![0] as 'attached'|'detached'|'visible'|'hidden'
|
|
129
|
+
// let locator = world.page.getByText(text)
|
|
130
|
+
// await locator.waitFor({ state, timeout:world.worldConfig.stepTimeout })
|
|
131
|
+
// })
|
|
132
|
+
// When('I wait for a/an/the {string} {word} to be attached/detatched/visible/hidden', async function (world:VitestBrowserWorld, identifier, role) {
|
|
133
|
+
// let state = world.info.step?.match(/(attached|detatched|visible|hidden)$/)![0] as 'attached'|'detached'|'visible'|'hidden'
|
|
134
|
+
// let locator = world.getLocator(world.page, identifier, role)
|
|
135
|
+
// await locator.waitFor({ state, timeout:world.worldConfig.stepTimeout })
|
|
136
|
+
// })
|
|
137
|
+
When('I wait (for ){int}ms', async function (world, num) {
|
|
138
|
+
await world.waitForTimeout(num);
|
|
139
|
+
});
|
|
140
|
+
When('I wait (for ){float} second(s)', async function (world, num) {
|
|
141
|
+
await world.waitForTimeout(num * 1000);
|
|
142
|
+
});
|
|
143
|
+
// ================
|
|
144
|
+
// Scrolling
|
|
145
|
+
When('I scroll (the ){string} {word} down/up/left/right', async function (world, identifier, role) {
|
|
146
|
+
let locator = world.getLocator(world.page, identifier, role);
|
|
147
|
+
let direction = world.info.step?.match(/(down|up|left|right)$/)[0];
|
|
148
|
+
await world.scroll(locator, direction);
|
|
149
|
+
});
|
|
150
|
+
When('I scroll (the ){string} {word} down/up/left/right {int}(px)( pixels)', async function (world, identifier, role, num) {
|
|
151
|
+
let locator = world.getLocator(world.page, identifier, role);
|
|
152
|
+
let direction = world.info.step?.match(/(down|up|left|right)(?= \d)/)[0];
|
|
153
|
+
await world.scroll(locator, direction, num);
|
|
154
|
+
});
|
|
155
|
+
//# sourceMappingURL=actions.steps.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.steps.mjs","sources":["../src/actions.steps.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAIA;AAEA;;AAEG;AAEH,KAAK,CAAC,qCAAqC,EAAE,OAAM,KAAwB,EAAE,IAAW,KAAI;AAC1F,IAAA,MAAM,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC;AAC1B,CAAC,CAAC;AAEF,KAAK,CAAC,0EAA0E,EAAE,OAAM,KAAwB,EAAE,IAAW,EAAE,KAAe,KAAI;AAChJ,IAAA,IAAI,QAAQ,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC,GAAsB,EAAE,GAAY,KAAI;AACzE,QAAA,IAAI,KAAK;AACT,QAAA,IAAI;YACF,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;;QAC1B,OAAO,CAAC,EAAE;AACV,YAAA,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC;;QAEhB,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK;AACnB,QAAA,OAAO,GAAG;KACX,EAAE,EAAE,CAAC;IACN,MAAM,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC;AACpC,CAAC,CAAC;AAGF;AACA;AAEA,IAAI,CAAC,uCAAuC,EAAE,gBAAgB,KAAwB,EA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AAG,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC;AAC5D,IAAA,IAAI,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,uBAAuB,CAAE,CAAC,CAAC,CAA+B;IACjG,MAAM,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC;AACxC,CAAC,CAAC;AACF,IAAI,CAAC,sEAAsE,EAAE,gBAAgB,KAAwB,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAA;AAC1I,IAAA,IAAI,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC;AAC5D,IAAA,IAAI,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,6BAA6B,CAAE,CAAC,CAAC,CAA+B;IACvG,MAAM,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,GAAG,CAAC;AAC7C,CAAC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var VitestBrowserWorld = require('../VitestBrowserWorld.cjs');
|
|
4
|
+
var vitestBrowserReact = require('vitest-browser-react');
|
|
5
|
+
var React = require('react');
|
|
6
|
+
require('quickpickle');
|
|
7
|
+
require('lodash/defaultsDeep');
|
|
8
|
+
|
|
9
|
+
class ReactBrowserWorld extends VitestBrowserWorld.VitestBrowserWorld {
|
|
10
|
+
constructor(context, info) {
|
|
11
|
+
super(context, info);
|
|
12
|
+
this.renderFn = vitestBrowserReact.render;
|
|
13
|
+
this.cleanupFn = vitestBrowserReact.cleanup;
|
|
14
|
+
}
|
|
15
|
+
// override VitestBrowserWorld.render
|
|
16
|
+
async render(name, props, renderOptions) {
|
|
17
|
+
let Component;
|
|
18
|
+
if (typeof name === 'string') {
|
|
19
|
+
// dynamic import returns the module object
|
|
20
|
+
const mod = await import(`${this.projectRoot}/${this.worldConfig.componentDir}/${name}`.replace(/\/+/g, '/')
|
|
21
|
+
/* @vite-ignore */
|
|
22
|
+
);
|
|
23
|
+
// try .default first, then fall back to any other export
|
|
24
|
+
Component = mod.default ?? Object.values(mod)[0];
|
|
25
|
+
if (!Component) {
|
|
26
|
+
throw new Error(`Could not find a React component export in module "${name}".`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
Component = name;
|
|
31
|
+
}
|
|
32
|
+
// now call reactRender with the actual component
|
|
33
|
+
await this.renderFn(React.createElement(Component, props), renderOptions);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
exports.ReactBrowserWorld = ReactBrowserWorld;
|
|
38
|
+
//# sourceMappingURL=ReactBrowserWorld.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReactBrowserWorld.cjs","sources":["../../src/frameworks/ReactBrowserWorld.ts"],"sourcesContent":[null],"names":["VitestBrowserWorld","render","cleanup"],"mappings":";;;;;;;;AAMM,MAAO,iBAAkB,SAAQA,qCAAkB,CAAA;IAKvD,WAAY,CAAA,OAAmB,EAAE,IAAoB,EAAA;AACnD,QAAA,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC;QAJtB,IAAQ,CAAA,QAAA,GAAGC,yBAAM;QACjB,IAAS,CAAA,SAAA,GAAGC,0BAAO;;;AAOnB,IAAA,MAAM,MAAM,CAAC,IAAkB,EAAE,KAAW,EAAE,aAAmB,EAAA;AAC/D,QAAA,IAAI,SAAc;AAElB,QAAA,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;;YAE5B,MAAM,GAAG,GAAG,MAAM,OAChB,GAAG,IAAI,CAAC,WAAW,CAAA,CAAA,EAAI,IAAI,CAAC,WAAW,CAAC,YAAY,CAAI,CAAA,EAAA,IAAI,CAAE,CAAA,CAAC,OAAO,CAAC,MAAM,EAAC,GAAG;;aAElF;;AAED,YAAA,SAAS,GAAG,GAAG,CAAC,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YAChD,IAAI,CAAC,SAAS,EAAE;AACd,gBAAA,MAAM,IAAI,KAAK,CACb,sDAAsD,IAAI,CAAA,EAAA,CAAI,CAC/D;;;aAEE;YACL,SAAS,GAAG,IAAI;;;AAIlB,QAAA,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,SAAS,EAAE,KAAK,CAAC,EAAE,aAAa,CAAC;;AAG5E;;;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { VitestBrowserWorld } from "../VitestBrowserWorld";
|
|
2
|
+
import { render, cleanup } from 'vitest-browser-react';
|
|
3
|
+
import type { TestContext } from "vitest";
|
|
4
|
+
import type { InfoConstructor } from "quickpickle/dist/world";
|
|
5
|
+
export declare class ReactBrowserWorld extends VitestBrowserWorld {
|
|
6
|
+
renderFn: typeof render;
|
|
7
|
+
cleanupFn: typeof cleanup;
|
|
8
|
+
constructor(context: TestContext, info: InfoConstructor);
|
|
9
|
+
render(name: string | any, props?: any, renderOptions?: any): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { VitestBrowserWorld } from '../VitestBrowserWorld.mjs';
|
|
2
|
+
import { render, cleanup } from 'vitest-browser-react';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import 'quickpickle';
|
|
5
|
+
import 'lodash-es';
|
|
6
|
+
|
|
7
|
+
class ReactBrowserWorld extends VitestBrowserWorld {
|
|
8
|
+
constructor(context, info) {
|
|
9
|
+
super(context, info);
|
|
10
|
+
this.renderFn = render;
|
|
11
|
+
this.cleanupFn = cleanup;
|
|
12
|
+
}
|
|
13
|
+
// override VitestBrowserWorld.render
|
|
14
|
+
async render(name, props, renderOptions) {
|
|
15
|
+
let Component;
|
|
16
|
+
if (typeof name === 'string') {
|
|
17
|
+
// dynamic import returns the module object
|
|
18
|
+
const mod = await import(`${this.projectRoot}/${this.worldConfig.componentDir}/${name}`.replace(/\/+/g, '/')
|
|
19
|
+
/* @vite-ignore */
|
|
20
|
+
);
|
|
21
|
+
// try .default first, then fall back to any other export
|
|
22
|
+
Component = mod.default ?? Object.values(mod)[0];
|
|
23
|
+
if (!Component) {
|
|
24
|
+
throw new Error(`Could not find a React component export in module "${name}".`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
Component = name;
|
|
29
|
+
}
|
|
30
|
+
// now call reactRender with the actual component
|
|
31
|
+
await this.renderFn(React.createElement(Component, props), renderOptions);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { ReactBrowserWorld };
|
|
36
|
+
//# sourceMappingURL=ReactBrowserWorld.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReactBrowserWorld.mjs","sources":["../../src/frameworks/ReactBrowserWorld.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;AAMM,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAkB,CAAQ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAkB,CAAA;IAKvD,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAmB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAE,IAAoB,CAAA,CAAA;AACnD,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,CAAA,CAAA,CAAA,CAAA,CAAC,CAAO,CAAA,CAAA,CAAA,C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CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,GAAG,CAAI,CAAA,CAAA,CAAA;;;AAIlB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAC,CAAK,CAAA,CAAA,CAAA,CAAA,CAAC,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAC,SAAS,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,CAAC,CAAA,CAAE,aAAa,CAAC;;AAG5E;;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var VitestBrowserWorld = require('../VitestBrowserWorld.cjs');
|
|
4
|
+
var vitestBrowserSvelte = require('vitest-browser-svelte');
|
|
5
|
+
require('quickpickle');
|
|
6
|
+
require('lodash/defaultsDeep');
|
|
7
|
+
|
|
8
|
+
class SvelteBrowserWorld extends VitestBrowserWorld.VitestBrowserWorld {
|
|
9
|
+
constructor(context, info) {
|
|
10
|
+
super(context, info);
|
|
11
|
+
this.renderFn = vitestBrowserSvelte.render;
|
|
12
|
+
this.cleanupFn = vitestBrowserSvelte.cleanup;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
exports.SvelteBrowserWorld = SvelteBrowserWorld;
|
|
17
|
+
//# sourceMappingURL=SvelteBrowserWorld.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SvelteBrowserWorld.cjs","sources":["../../src/frameworks/SvelteBrowserWorld.ts"],"sourcesContent":[null],"names":["VitestBrowserWorld","render","cleanup"],"mappings":";;;;;;;AAKM,MAAO,kBAAmB,SAAQA,qCAAkB,CAAA;IAKxD,WAAY,CAAA,OAAmB,EAAE,IAAoB,EAAA;AACnD,QAAA,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC;QAJtB,IAAQ,CAAA,QAAA,GAAGC,0BAAM;QACjB,IAAS,CAAA,SAAA,GAAGC,2BAAO;;AAMpB;;;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { VitestBrowserWorld } from "../VitestBrowserWorld";
|
|
2
|
+
import { render, cleanup } from 'vitest-browser-svelte';
|
|
3
|
+
import type { TestContext } from "vitest";
|
|
4
|
+
import { InfoConstructor } from "quickpickle/dist/world";
|
|
5
|
+
export declare class SvelteBrowserWorld extends VitestBrowserWorld {
|
|
6
|
+
renderFn: typeof render;
|
|
7
|
+
cleanupFn: typeof cleanup;
|
|
8
|
+
constructor(context: TestContext, info: InfoConstructor);
|
|
9
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { VitestBrowserWorld } from '../VitestBrowserWorld.mjs';
|
|
2
|
+
import { render, cleanup } from 'vitest-browser-svelte';
|
|
3
|
+
import 'quickpickle';
|
|
4
|
+
import 'lodash-es';
|
|
5
|
+
|
|
6
|
+
class SvelteBrowserWorld extends VitestBrowserWorld {
|
|
7
|
+
constructor(context, info) {
|
|
8
|
+
super(context, info);
|
|
9
|
+
this.renderFn = render;
|
|
10
|
+
this.cleanupFn = cleanup;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { SvelteBrowserWorld };
|
|
15
|
+
//# sourceMappingURL=SvelteBrowserWorld.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SvelteBrowserWorld.mjs","sources":["../../src/frameworks/SvelteBrowserWorld.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAKM,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAmB,CAAQ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAkB,CAAA;IAKxD,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAmB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAE,IAAoB,CAAA,CAAA;AACnD,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,CAAA,CAAA,CAAA,CAAA,CAAC,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAE,IAAI,CAAC;QAJtB,CAAQ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAG,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA;QACjB,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAG,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;;AAMpB;;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var VitestBrowserWorld = require('../VitestBrowserWorld.cjs');
|
|
4
|
+
var vitestBrowserVue = require('vitest-browser-vue');
|
|
5
|
+
require('quickpickle');
|
|
6
|
+
require('lodash/defaultsDeep');
|
|
7
|
+
|
|
8
|
+
class VueBrowserWorld extends VitestBrowserWorld.VitestBrowserWorld {
|
|
9
|
+
constructor(context, info) {
|
|
10
|
+
super(context, info);
|
|
11
|
+
this.renderFn = vitestBrowserVue.render;
|
|
12
|
+
this.cleanupFn = vitestBrowserVue.cleanup;
|
|
13
|
+
}
|
|
14
|
+
async render(name, props, renderOptions) {
|
|
15
|
+
let mod = typeof name === 'string'
|
|
16
|
+
? await import(`${this.projectRoot}/${this.worldConfig.componentDir}/${name}`.replace(/\/+/g, '/') /* @vite-ignore */)
|
|
17
|
+
: name;
|
|
18
|
+
let component = mod.default ?? mod;
|
|
19
|
+
await this.renderFn(component, { props, ...renderOptions });
|
|
20
|
+
}
|
|
21
|
+
;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
exports.VueBrowserWorld = VueBrowserWorld;
|
|
25
|
+
//# sourceMappingURL=VueBrowserWorld.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VueBrowserWorld.cjs","sources":["../../src/frameworks/VueBrowserWorld.ts"],"sourcesContent":[null],"names":["VitestBrowserWorld","render","cleanup"],"mappings":";;;;;;;AAKM,MAAO,eAAgB,SAAQA,qCAAkB,CAAA;IAKrD,WAAY,CAAA,OAAmB,EAAE,IAAoB,EAAA;AACnD,QAAA,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC;QAJtB,IAAQ,CAAA,QAAA,GAAGC,uBAAM;QACjB,IAAS,CAAA,SAAA,GAAGC,wBAAO;;AAMnB,IAAA,MAAM,MAAM,CAAC,IAAe,EAAE,KAAU,EAAE,aAAkB,EAAA;AAC1D,QAAA,IAAI,GAAG,GAAG,OAAO,IAAI,KAAK;cACtB,MAAM,OAAO,CAAA,EAAG,IAAI,CAAC,WAAW,CAAA,CAAA,EAAI,IAAI,CAAC,WAAW,CAAC,YAAY,CAAI,CAAA,EAAA,IAAI,CAAE,CAAA,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;cAChG,IAAI;AACR,QAAA,IAAI,SAAS,GAAG,GAAG,CAAC,OAAO,IAAI,GAAG;AAClC,QAAA,MAAM,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,EAAE,KAAK,EAAE,GAAG,aAAa,EAAE,CAAC;;;AAG9D;;;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { VitestBrowserWorld } from "../VitestBrowserWorld";
|
|
2
|
+
import { render, cleanup } from 'vitest-browser-vue';
|
|
3
|
+
import type { TestContext } from "vitest";
|
|
4
|
+
import type { InfoConstructor } from "quickpickle/dist/world";
|
|
5
|
+
export declare class VueBrowserWorld extends VitestBrowserWorld {
|
|
6
|
+
renderFn: typeof render;
|
|
7
|
+
cleanupFn: typeof cleanup;
|
|
8
|
+
constructor(context: TestContext, info: InfoConstructor);
|
|
9
|
+
render(name: string | any, props?: any, renderOptions?: any): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { VitestBrowserWorld } from '../VitestBrowserWorld.mjs';
|
|
2
|
+
import { render, cleanup } from 'vitest-browser-vue';
|
|
3
|
+
import 'quickpickle';
|
|
4
|
+
import 'lodash-es';
|
|
5
|
+
|
|
6
|
+
class VueBrowserWorld extends VitestBrowserWorld {
|
|
7
|
+
constructor(context, info) {
|
|
8
|
+
super(context, info);
|
|
9
|
+
this.renderFn = render;
|
|
10
|
+
this.cleanupFn = cleanup;
|
|
11
|
+
}
|
|
12
|
+
async render(name, props, renderOptions) {
|
|
13
|
+
let mod = typeof name === 'string'
|
|
14
|
+
? await import(`${this.projectRoot}/${this.worldConfig.componentDir}/${name}`.replace(/\/+/g, '/') /* @vite-ignore */)
|
|
15
|
+
: name;
|
|
16
|
+
let component = mod.default ?? mod;
|
|
17
|
+
await this.renderFn(component, { props, ...renderOptions });
|
|
18
|
+
}
|
|
19
|
+
;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { VueBrowserWorld };
|
|
23
|
+
//# sourceMappingURL=VueBrowserWorld.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VueBrowserWorld.mjs","sources":["../../src/frameworks/VueBrowserWorld.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAKM,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA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,CAAE,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAE,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,EAAE,CAAC;;;AAG9D;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var quickpickle = require('quickpickle');
|
|
4
|
+
var frameworks_ReactBrowserWorld = require('./ReactBrowserWorld.cjs');
|
|
5
|
+
require('../VitestBrowserWorld.cjs');
|
|
6
|
+
require('lodash/defaultsDeep');
|
|
7
|
+
require('vitest-browser-react');
|
|
8
|
+
require('react');
|
|
9
|
+
|
|
10
|
+
quickpickle.setWorldConstructor(frameworks_ReactBrowserWorld.ReactBrowserWorld);
|
|
11
|
+
//# sourceMappingURL=react.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.cjs","sources":["../../src/frameworks/react.ts"],"sourcesContent":[null],"names":["setWorldConstructor","ReactBrowserWorld"],"mappings":";;;;;;;;;AAGAA,+BAAmB,CAACC,8CAAiB,CAAC;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { setWorldConstructor } from 'quickpickle';
|
|
2
|
+
import { ReactBrowserWorld } from './ReactBrowserWorld.mjs';
|
|
3
|
+
import '../VitestBrowserWorld.mjs';
|
|
4
|
+
import 'lodash-es';
|
|
5
|
+
import 'vitest-browser-react';
|
|
6
|
+
import 'react';
|
|
7
|
+
|
|
8
|
+
setWorldConstructor(ReactBrowserWorld);
|
|
9
|
+
//# sourceMappingURL=react.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.mjs","sources":["../../src/frameworks/react.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;AAGA,CAAmB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAC,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var quickpickle = require('quickpickle');
|
|
4
|
+
var frameworks_SvelteBrowserWorld = require('./SvelteBrowserWorld.cjs');
|
|
5
|
+
require('../VitestBrowserWorld.cjs');
|
|
6
|
+
require('lodash/defaultsDeep');
|
|
7
|
+
require('vitest-browser-svelte');
|
|
8
|
+
|
|
9
|
+
quickpickle.setWorldConstructor(frameworks_SvelteBrowserWorld.SvelteBrowserWorld);
|
|
10
|
+
//# sourceMappingURL=svelte.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"svelte.cjs","sources":["../../src/frameworks/svelte.ts"],"sourcesContent":[null],"names":["setWorldConstructor","SvelteBrowserWorld"],"mappings":";;;;;;;;AAGAA,+BAAmB,CAACC,gDAAkB,CAAC;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { setWorldConstructor } from 'quickpickle';
|
|
2
|
+
import { SvelteBrowserWorld } from './SvelteBrowserWorld.mjs';
|
|
3
|
+
import '../VitestBrowserWorld.mjs';
|
|
4
|
+
import 'lodash-es';
|
|
5
|
+
import 'vitest-browser-svelte';
|
|
6
|
+
|
|
7
|
+
setWorldConstructor(SvelteBrowserWorld);
|
|
8
|
+
//# sourceMappingURL=svelte.mjs.map
|