@testforgejs/vue-test-preset-base 1.0.0-beta.1
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 +8 -0
- package/README.md +353 -0
- package/dist/index.cjs +95 -0
- package/dist/index.d.cts +66 -0
- package/dist/index.d.ts +66 -0
- package/dist/index.js +65 -0
- package/package.json +62 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
Copyright © 2026 Roman Levchenko
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
5
|
+
|
|
6
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
7
|
+
|
|
8
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
# @testforgejs/vue-test-preset-base
|
|
2
|
+
|
|
3
|
+
Base presets for the [TestForge](https://github.com/testforgejs/testforge) Vue 3 component testing framework.
|
|
4
|
+
|
|
5
|
+
This package provides **runner-independent TestForge presets** with sensible defaults for commonly used Vue plugins.
|
|
6
|
+
|
|
7
|
+
The base presets are intentionally free from test-runner-specific configuration. In particular, the Pinia configuration does **not** define `createSpy`.
|
|
8
|
+
|
|
9
|
+
Runner-specific presets such as `@testforgejs/vue-test-preset-recommended` can extend these presets and provide the appropriate spy implementation for their target test runner.
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
Choose your preferred package manager.
|
|
14
|
+
|
|
15
|
+
### pnpm
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pnpm add -D @testforgejs/vue-test-preset-base@beta
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### npm
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install -D @testforgejs/vue-test-preset-base@beta
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Yarn
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
yarn add -D @testforgejs/vue-test-preset-base@beta
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
> `@testforgejs/vue-test-core` is required.
|
|
34
|
+
|
|
35
|
+
## Quick Usage
|
|
36
|
+
|
|
37
|
+
Import the `presets` object and pass it to `createTestFramework()`:
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
// tests/setup.ts
|
|
41
|
+
|
|
42
|
+
import { createTestFramework } from "@testforgejs/vue-test-core";
|
|
43
|
+
import { presets } from "@testforgejs/vue-test-preset-base";
|
|
44
|
+
|
|
45
|
+
const { testComponentFactory } = createTestFramework({
|
|
46
|
+
presets,
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export { testComponentFactory };
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
You can then use `testComponentFactory` in your component tests:
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
import { describe, expect, it } from "vitest";
|
|
56
|
+
import { testComponentFactory } from "./setup";
|
|
57
|
+
import MyComponent from "./MyComponent.vue";
|
|
58
|
+
|
|
59
|
+
describe("MyComponent", () => {
|
|
60
|
+
it("renders", () => {
|
|
61
|
+
const factory = testComponentFactory(MyComponent);
|
|
62
|
+
const wrapper = factory();
|
|
63
|
+
|
|
64
|
+
expect(wrapper.exists()).toBe(true);
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
> The base preset is runner-independent. If a managed plugin requires a test-runner-specific facility such as Pinia's `createSpy`, the corresponding runner-specific preset should provide it.
|
|
70
|
+
|
|
71
|
+
## Available Presets
|
|
72
|
+
|
|
73
|
+
The package exports four presets:
|
|
74
|
+
|
|
75
|
+
- `presets.default`
|
|
76
|
+
- `presets.piniaPreset`
|
|
77
|
+
- `presets.i18nPreset`
|
|
78
|
+
- `presets.routerPreset`
|
|
79
|
+
|
|
80
|
+
Each preset defines an isolated managed-plugin environment.
|
|
81
|
+
|
|
82
|
+
### `presets.default`
|
|
83
|
+
|
|
84
|
+
The default base preset provides the common Vue testing environment:
|
|
85
|
+
|
|
86
|
+
- Pinia — enabled;
|
|
87
|
+
- Vue I18n — enabled;
|
|
88
|
+
- Vue Router — declared but disabled.
|
|
89
|
+
|
|
90
|
+
It also provides default configuration factories for the managed integrations.
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
const { testComponentFactory } = createTestFramework({
|
|
94
|
+
presets: {
|
|
95
|
+
default: presets.default,
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
The Pinia configuration intentionally does not define `createSpy`.
|
|
101
|
+
|
|
102
|
+
The base preset provides Pinia options through a factory:
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
pinia: () => ({
|
|
106
|
+
initialState: {},
|
|
107
|
+
stubActions: false,
|
|
108
|
+
});
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
The factory is invoked when TestForge resolves the preset configuration, producing a fresh options object for the current pipeline context.
|
|
112
|
+
|
|
113
|
+
A runner-specific preset can extend this configuration and provide its own spy implementation.
|
|
114
|
+
|
|
115
|
+
### `presets.piniaPreset`
|
|
116
|
+
|
|
117
|
+
A minimal preset containing only the managed Pinia integration.
|
|
118
|
+
|
|
119
|
+
Pinia is enabled and uses the base Pinia defaults.
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
const { testComponentFactory } = createTestFramework({
|
|
123
|
+
presets: {
|
|
124
|
+
default: presets.piniaPreset,
|
|
125
|
+
},
|
|
126
|
+
});
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
This preset is useful when a test environment needs Pinia without automatically enabling the other managed integrations.
|
|
130
|
+
|
|
131
|
+
> The base `piniaPreset` is also runner-independent and does not define Pinia's `createSpy` option.
|
|
132
|
+
|
|
133
|
+
### `presets.i18nPreset`
|
|
134
|
+
|
|
135
|
+
A minimal preset containing only Vue I18n.
|
|
136
|
+
|
|
137
|
+
Vue I18n is enabled with the following defaults:
|
|
138
|
+
|
|
139
|
+
- Composition API mode (`legacy: false`);
|
|
140
|
+
- English locale;
|
|
141
|
+
- English fallback locale;
|
|
142
|
+
- empty messages;
|
|
143
|
+
- disabled missing-translation warnings;
|
|
144
|
+
- disabled fallback warnings.
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
const { testComponentFactory } = createTestFramework({
|
|
148
|
+
presets: {
|
|
149
|
+
default: presets.i18nPreset,
|
|
150
|
+
},
|
|
151
|
+
});
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
The I18n defaults are provided through a plugin options factory, so each pipeline context receives its own options object.
|
|
155
|
+
|
|
156
|
+
### `presets.routerPreset`
|
|
157
|
+
|
|
158
|
+
A minimal preset containing only Vue Router.
|
|
159
|
+
|
|
160
|
+
Vue Router is enabled with:
|
|
161
|
+
|
|
162
|
+
- a memory history in non-browser environments;
|
|
163
|
+
- a web history in browser environments;
|
|
164
|
+
- a minimal `/` route.
|
|
165
|
+
|
|
166
|
+
```typescript
|
|
167
|
+
const { testComponentFactory } = createTestFramework({
|
|
168
|
+
presets: {
|
|
169
|
+
default: presets.routerPreset,
|
|
170
|
+
},
|
|
171
|
+
});
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
The router configuration is provided through a plugin options factory. The factory creates a new history instance when the plugin configuration is resolved for a pipeline context.
|
|
175
|
+
|
|
176
|
+
This prevents router history state from being shared between independent component factory invocations.
|
|
177
|
+
|
|
178
|
+
## Runner-Specific Presets
|
|
179
|
+
|
|
180
|
+
The base presets are intended to be extended by runner-specific packages.
|
|
181
|
+
|
|
182
|
+
For example, a Vitest-oriented preset can extend the base default preset and provide `vi.fn` as Pinia's `createSpy` implementation:
|
|
183
|
+
|
|
184
|
+
```typescript
|
|
185
|
+
import { extendPreset } from "@testforgejs/vue-test-core";
|
|
186
|
+
import { presets as basePresets } from "@testforgejs/vue-test-preset-base";
|
|
187
|
+
import { vi } from "vitest";
|
|
188
|
+
|
|
189
|
+
export const presets = {
|
|
190
|
+
default: extendPreset(basePresets.default, {
|
|
191
|
+
defaults: {
|
|
192
|
+
pinia: () => ({
|
|
193
|
+
...basePresets.default.defaults.pinia(),
|
|
194
|
+
createSpy: vi.fn,
|
|
195
|
+
}),
|
|
196
|
+
},
|
|
197
|
+
}),
|
|
198
|
+
};
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
The important detail is that `basePresets.default.defaults.pinia` is a **plugin options factory**. To preserve its options, invoke the factory and extend the returned object.
|
|
202
|
+
|
|
203
|
+
The same approach can be used for the dedicated Pinia preset:
|
|
204
|
+
|
|
205
|
+
```typescript
|
|
206
|
+
export const presets = {
|
|
207
|
+
piniaPreset: extendPreset(basePresets.piniaPreset, {
|
|
208
|
+
defaults: {
|
|
209
|
+
pinia: () => ({
|
|
210
|
+
...basePresets.piniaPreset.defaults.pinia(),
|
|
211
|
+
createSpy: vi.fn,
|
|
212
|
+
}),
|
|
213
|
+
},
|
|
214
|
+
}),
|
|
215
|
+
};
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
The other base presets can be reused directly when they do not require runner-specific configuration:
|
|
219
|
+
|
|
220
|
+
```typescript
|
|
221
|
+
export const presets = {
|
|
222
|
+
i18nPreset: basePresets.i18nPreset,
|
|
223
|
+
routerPreset: basePresets.routerPreset,
|
|
224
|
+
};
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
This keeps runner-specific concerns outside the base package.
|
|
228
|
+
|
|
229
|
+
### Replacing Plugin Defaults
|
|
230
|
+
|
|
231
|
+
Providing a new plugin defaults factory replaces the corresponding factory from the base preset.
|
|
232
|
+
|
|
233
|
+
For example:
|
|
234
|
+
|
|
235
|
+
```typescript
|
|
236
|
+
extendPreset(basePresets.default, {
|
|
237
|
+
defaults: {
|
|
238
|
+
pinia: () => ({
|
|
239
|
+
createSpy: vi.fn,
|
|
240
|
+
}),
|
|
241
|
+
},
|
|
242
|
+
});
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
The resulting Pinia configuration contains only the options returned by the replacement factory.
|
|
246
|
+
|
|
247
|
+
If the base configuration should be preserved, invoke the base factory explicitly:
|
|
248
|
+
|
|
249
|
+
```typescript
|
|
250
|
+
extendPreset(basePresets.default, {
|
|
251
|
+
defaults: {
|
|
252
|
+
pinia: () => ({
|
|
253
|
+
...basePresets.default.defaults.pinia(),
|
|
254
|
+
createSpy: vi.fn,
|
|
255
|
+
}),
|
|
256
|
+
},
|
|
257
|
+
});
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
This explicit invocation makes the replacement semantics predictable and avoids implicitly sharing or merging configuration objects.
|
|
261
|
+
|
|
262
|
+
## Preset Selection at Runtime
|
|
263
|
+
|
|
264
|
+
A component factory can switch between registered presets for an individual invocation using the fourth `extraOptions` argument:
|
|
265
|
+
|
|
266
|
+
```typescript
|
|
267
|
+
factory(
|
|
268
|
+
{},
|
|
269
|
+
{},
|
|
270
|
+
{},
|
|
271
|
+
{
|
|
272
|
+
preset: "i18nPreset",
|
|
273
|
+
},
|
|
274
|
+
);
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
The selected preset defines the complete managed plugin runtime for that invocation.
|
|
278
|
+
|
|
279
|
+
For example, switching to `i18nPreset` enables Vue I18n without automatically creating the Pinia or Router integrations.
|
|
280
|
+
|
|
281
|
+
The `preset` option selects the runtime profile for a **component factory invocation**. This is distinct from invoking a **plugin options factory**, which produces the configuration object used within that runtime profile.
|
|
282
|
+
|
|
283
|
+
## Preset Isolation
|
|
284
|
+
|
|
285
|
+
Each preset represents a complete managed-plugin runtime environment.
|
|
286
|
+
|
|
287
|
+
A plugin that is not declared in the active preset manifest cannot be configured through TestForge's managed `plugins` API.
|
|
288
|
+
|
|
289
|
+
For example, this configuration is invalid when `i18nPreset` is active:
|
|
290
|
+
|
|
291
|
+
```typescript
|
|
292
|
+
factory(
|
|
293
|
+
{},
|
|
294
|
+
{
|
|
295
|
+
plugins: {
|
|
296
|
+
pinia: {},
|
|
297
|
+
},
|
|
298
|
+
},
|
|
299
|
+
{},
|
|
300
|
+
{
|
|
301
|
+
preset: "i18nPreset",
|
|
302
|
+
},
|
|
303
|
+
);
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
The active preset declares only Vue I18n, so the Pinia configuration is rejected during validation.
|
|
307
|
+
|
|
308
|
+
This isolation is intentional: presets are runtime environment profiles rather than partial configuration overlays.
|
|
309
|
+
|
|
310
|
+
### Fresh Plugin Configuration
|
|
311
|
+
|
|
312
|
+
Plugin defaults are represented by plugin options factories rather than shared configuration objects:
|
|
313
|
+
|
|
314
|
+
```typescript
|
|
315
|
+
defaults: {
|
|
316
|
+
pinia: () => ({
|
|
317
|
+
initialState: {},
|
|
318
|
+
stubActions: false,
|
|
319
|
+
}),
|
|
320
|
+
}
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
TestForge invokes the plugin options factory while resolving the preset configuration for a pipeline context.
|
|
324
|
+
|
|
325
|
+
Each invocation produces a fresh options object:
|
|
326
|
+
|
|
327
|
+
```typescript
|
|
328
|
+
const first = presets.default.defaults.pinia();
|
|
329
|
+
const second = presets.default.defaults.pinia();
|
|
330
|
+
|
|
331
|
+
first !== second; // true
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
This prevents mutable plugin configuration from being shared between independent pipeline contexts.
|
|
335
|
+
|
|
336
|
+
This distinction is important:
|
|
337
|
+
|
|
338
|
+
- a **plugin options factory** creates plugin configuration;
|
|
339
|
+
- a **component factory** created by `testComponentFactory()` creates component test mounts.
|
|
340
|
+
|
|
341
|
+
Both participate in isolation, but they operate at different levels of the TestForge architecture.
|
|
342
|
+
|
|
343
|
+
## Related Packages
|
|
344
|
+
|
|
345
|
+
- [`@testforgejs/vue-test-core`](https://www.npmjs.com/package/@testforgejs/vue-test-core) — core TestForge testing framework
|
|
346
|
+
- [`@testforgejs/vue-test-preset-recommended`](https://www.npmjs.com/package/@testforgejs/vue-test-preset-recommended) — recommended Vitest-oriented presets
|
|
347
|
+
- [`@testforgejs/vue-test-plugin-pinia`](https://www.npmjs.com/package/@testforgejs/vue-test-plugin-pinia) — Pinia integration
|
|
348
|
+
- [`@testforgejs/vue-test-plugin-i18n`](https://www.npmjs.com/package/@testforgejs/vue-test-plugin-i18n) — Vue I18n integration
|
|
349
|
+
- [`@testforgejs/vue-test-plugin-router`](https://www.npmjs.com/package/@testforgejs/vue-test-plugin-router) — Vue Router integration
|
|
350
|
+
|
|
351
|
+
## License
|
|
352
|
+
|
|
353
|
+
MIT
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
defaultI18n: () => defaultI18n,
|
|
24
|
+
defaultPinia: () => defaultPinia,
|
|
25
|
+
defaultRouter: () => defaultRouter,
|
|
26
|
+
presets: () => presets
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(index_exports);
|
|
29
|
+
|
|
30
|
+
// src/defaults/defaultI18n.ts
|
|
31
|
+
var defaultI18n = () => ({
|
|
32
|
+
legacy: false,
|
|
33
|
+
locale: "en",
|
|
34
|
+
fallbackLocale: "en",
|
|
35
|
+
messages: {},
|
|
36
|
+
fallbackWarn: false,
|
|
37
|
+
missingWarn: false
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// src/defaults/defaultPinia.ts
|
|
41
|
+
var defaultPinia = () => ({
|
|
42
|
+
initialState: {},
|
|
43
|
+
stubActions: false
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// src/defaults/defaultRouter.ts
|
|
47
|
+
var import_vue_router = require("vue-router");
|
|
48
|
+
var defaultRouter = () => ({
|
|
49
|
+
history: typeof window !== "undefined" ? (0, import_vue_router.createWebHistory)() : (0, import_vue_router.createMemoryHistory)(),
|
|
50
|
+
routes: [{ path: "/", component: { render: () => null } }]
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// src/presets.ts
|
|
54
|
+
var import_vue_test_plugin_pinia = require("@testforgejs/vue-test-plugin-pinia");
|
|
55
|
+
var import_vue_test_plugin_i18n = require("@testforgejs/vue-test-plugin-i18n");
|
|
56
|
+
var import_vue_test_plugin_router = require("@testforgejs/vue-test-plugin-router");
|
|
57
|
+
var presets = {
|
|
58
|
+
default: {
|
|
59
|
+
manifest: [
|
|
60
|
+
{ module: import_vue_test_plugin_pinia.piniaPlugin, enabled: true },
|
|
61
|
+
{ module: import_vue_test_plugin_i18n.i18nPlugin, enabled: true },
|
|
62
|
+
{ module: import_vue_test_plugin_router.routerPlugin, enabled: false }
|
|
63
|
+
],
|
|
64
|
+
defaults: {
|
|
65
|
+
i18n: defaultI18n,
|
|
66
|
+
pinia: defaultPinia,
|
|
67
|
+
router: defaultRouter
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
piniaPreset: {
|
|
71
|
+
manifest: [{ module: import_vue_test_plugin_pinia.piniaPlugin, enabled: true }],
|
|
72
|
+
defaults: {
|
|
73
|
+
pinia: defaultPinia
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
i18nPreset: {
|
|
77
|
+
manifest: [{ module: import_vue_test_plugin_i18n.i18nPlugin, enabled: true }],
|
|
78
|
+
defaults: {
|
|
79
|
+
i18n: defaultI18n
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
routerPreset: {
|
|
83
|
+
manifest: [{ module: import_vue_test_plugin_router.routerPlugin, enabled: true }],
|
|
84
|
+
defaults: {
|
|
85
|
+
router: defaultRouter
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
90
|
+
0 && (module.exports = {
|
|
91
|
+
defaultI18n,
|
|
92
|
+
defaultPinia,
|
|
93
|
+
defaultRouter,
|
|
94
|
+
presets
|
|
95
|
+
});
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as _testforgejs_vue_test_core from '@testforgejs/vue-test-core';
|
|
2
|
+
import { PluginOptionsFactory } from '@testforgejs/vue-test-core';
|
|
3
|
+
import * as _testforgejs_vue_test_plugin_i18n from '@testforgejs/vue-test-plugin-i18n';
|
|
4
|
+
import { VueTestI18nOptions } from '@testforgejs/vue-test-plugin-i18n';
|
|
5
|
+
import * as _testforgejs_vue_test_plugin_pinia from '@testforgejs/vue-test-plugin-pinia';
|
|
6
|
+
import { VueTestPiniaOptions } from '@testforgejs/vue-test-plugin-pinia';
|
|
7
|
+
import * as _testforgejs_vue_test_plugin_router from '@testforgejs/vue-test-plugin-router';
|
|
8
|
+
import { VueTestRouterOptions } from '@testforgejs/vue-test-plugin-router';
|
|
9
|
+
import * as vue_router from 'vue-router';
|
|
10
|
+
import * as vue_i18n from 'vue-i18n';
|
|
11
|
+
import * as pinia from 'pinia';
|
|
12
|
+
|
|
13
|
+
declare const defaultI18n: PluginOptionsFactory<VueTestI18nOptions>;
|
|
14
|
+
|
|
15
|
+
declare const defaultPinia: PluginOptionsFactory<VueTestPiniaOptions>;
|
|
16
|
+
|
|
17
|
+
declare const defaultRouter: PluginOptionsFactory<VueTestRouterOptions>;
|
|
18
|
+
|
|
19
|
+
declare const presets: {
|
|
20
|
+
default: {
|
|
21
|
+
manifest: ({
|
|
22
|
+
module: _testforgejs_vue_test_core.PluginModule<pinia.Pinia, _testforgejs_vue_test_plugin_pinia.VueTestPiniaOptions>;
|
|
23
|
+
enabled: true;
|
|
24
|
+
} | {
|
|
25
|
+
module: _testforgejs_vue_test_core.PluginModule<vue_i18n.I18n<{}, {}, {}, string, boolean>, _testforgejs_vue_test_plugin_i18n.VueTestI18nOptions>;
|
|
26
|
+
enabled: true;
|
|
27
|
+
} | {
|
|
28
|
+
module: _testforgejs_vue_test_core.PluginModule<vue_router._RouterClassic, _testforgejs_vue_test_plugin_router.VueTestRouterOptions>;
|
|
29
|
+
enabled: false;
|
|
30
|
+
})[];
|
|
31
|
+
defaults: {
|
|
32
|
+
i18n: _testforgejs_vue_test_core.PluginOptionsFactory<_testforgejs_vue_test_plugin_i18n.VueTestI18nOptions>;
|
|
33
|
+
pinia: _testforgejs_vue_test_core.PluginOptionsFactory<_testforgejs_vue_test_plugin_pinia.VueTestPiniaOptions>;
|
|
34
|
+
router: _testforgejs_vue_test_core.PluginOptionsFactory<_testforgejs_vue_test_plugin_router.VueTestRouterOptions>;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
piniaPreset: {
|
|
38
|
+
manifest: {
|
|
39
|
+
module: _testforgejs_vue_test_core.PluginModule<pinia.Pinia, _testforgejs_vue_test_plugin_pinia.VueTestPiniaOptions>;
|
|
40
|
+
enabled: true;
|
|
41
|
+
}[];
|
|
42
|
+
defaults: {
|
|
43
|
+
pinia: _testforgejs_vue_test_core.PluginOptionsFactory<_testforgejs_vue_test_plugin_pinia.VueTestPiniaOptions>;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
i18nPreset: {
|
|
47
|
+
manifest: {
|
|
48
|
+
module: _testforgejs_vue_test_core.PluginModule<vue_i18n.I18n<{}, {}, {}, string, boolean>, _testforgejs_vue_test_plugin_i18n.VueTestI18nOptions>;
|
|
49
|
+
enabled: true;
|
|
50
|
+
}[];
|
|
51
|
+
defaults: {
|
|
52
|
+
i18n: _testforgejs_vue_test_core.PluginOptionsFactory<_testforgejs_vue_test_plugin_i18n.VueTestI18nOptions>;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
routerPreset: {
|
|
56
|
+
manifest: {
|
|
57
|
+
module: _testforgejs_vue_test_core.PluginModule<vue_router._RouterClassic, _testforgejs_vue_test_plugin_router.VueTestRouterOptions>;
|
|
58
|
+
enabled: true;
|
|
59
|
+
}[];
|
|
60
|
+
defaults: {
|
|
61
|
+
router: _testforgejs_vue_test_core.PluginOptionsFactory<_testforgejs_vue_test_plugin_router.VueTestRouterOptions>;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export { defaultI18n, defaultPinia, defaultRouter, presets };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as _testforgejs_vue_test_core from '@testforgejs/vue-test-core';
|
|
2
|
+
import { PluginOptionsFactory } from '@testforgejs/vue-test-core';
|
|
3
|
+
import * as _testforgejs_vue_test_plugin_i18n from '@testforgejs/vue-test-plugin-i18n';
|
|
4
|
+
import { VueTestI18nOptions } from '@testforgejs/vue-test-plugin-i18n';
|
|
5
|
+
import * as _testforgejs_vue_test_plugin_pinia from '@testforgejs/vue-test-plugin-pinia';
|
|
6
|
+
import { VueTestPiniaOptions } from '@testforgejs/vue-test-plugin-pinia';
|
|
7
|
+
import * as _testforgejs_vue_test_plugin_router from '@testforgejs/vue-test-plugin-router';
|
|
8
|
+
import { VueTestRouterOptions } from '@testforgejs/vue-test-plugin-router';
|
|
9
|
+
import * as vue_router from 'vue-router';
|
|
10
|
+
import * as vue_i18n from 'vue-i18n';
|
|
11
|
+
import * as pinia from 'pinia';
|
|
12
|
+
|
|
13
|
+
declare const defaultI18n: PluginOptionsFactory<VueTestI18nOptions>;
|
|
14
|
+
|
|
15
|
+
declare const defaultPinia: PluginOptionsFactory<VueTestPiniaOptions>;
|
|
16
|
+
|
|
17
|
+
declare const defaultRouter: PluginOptionsFactory<VueTestRouterOptions>;
|
|
18
|
+
|
|
19
|
+
declare const presets: {
|
|
20
|
+
default: {
|
|
21
|
+
manifest: ({
|
|
22
|
+
module: _testforgejs_vue_test_core.PluginModule<pinia.Pinia, _testforgejs_vue_test_plugin_pinia.VueTestPiniaOptions>;
|
|
23
|
+
enabled: true;
|
|
24
|
+
} | {
|
|
25
|
+
module: _testforgejs_vue_test_core.PluginModule<vue_i18n.I18n<{}, {}, {}, string, boolean>, _testforgejs_vue_test_plugin_i18n.VueTestI18nOptions>;
|
|
26
|
+
enabled: true;
|
|
27
|
+
} | {
|
|
28
|
+
module: _testforgejs_vue_test_core.PluginModule<vue_router._RouterClassic, _testforgejs_vue_test_plugin_router.VueTestRouterOptions>;
|
|
29
|
+
enabled: false;
|
|
30
|
+
})[];
|
|
31
|
+
defaults: {
|
|
32
|
+
i18n: _testforgejs_vue_test_core.PluginOptionsFactory<_testforgejs_vue_test_plugin_i18n.VueTestI18nOptions>;
|
|
33
|
+
pinia: _testforgejs_vue_test_core.PluginOptionsFactory<_testforgejs_vue_test_plugin_pinia.VueTestPiniaOptions>;
|
|
34
|
+
router: _testforgejs_vue_test_core.PluginOptionsFactory<_testforgejs_vue_test_plugin_router.VueTestRouterOptions>;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
piniaPreset: {
|
|
38
|
+
manifest: {
|
|
39
|
+
module: _testforgejs_vue_test_core.PluginModule<pinia.Pinia, _testforgejs_vue_test_plugin_pinia.VueTestPiniaOptions>;
|
|
40
|
+
enabled: true;
|
|
41
|
+
}[];
|
|
42
|
+
defaults: {
|
|
43
|
+
pinia: _testforgejs_vue_test_core.PluginOptionsFactory<_testforgejs_vue_test_plugin_pinia.VueTestPiniaOptions>;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
i18nPreset: {
|
|
47
|
+
manifest: {
|
|
48
|
+
module: _testforgejs_vue_test_core.PluginModule<vue_i18n.I18n<{}, {}, {}, string, boolean>, _testforgejs_vue_test_plugin_i18n.VueTestI18nOptions>;
|
|
49
|
+
enabled: true;
|
|
50
|
+
}[];
|
|
51
|
+
defaults: {
|
|
52
|
+
i18n: _testforgejs_vue_test_core.PluginOptionsFactory<_testforgejs_vue_test_plugin_i18n.VueTestI18nOptions>;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
routerPreset: {
|
|
56
|
+
manifest: {
|
|
57
|
+
module: _testforgejs_vue_test_core.PluginModule<vue_router._RouterClassic, _testforgejs_vue_test_plugin_router.VueTestRouterOptions>;
|
|
58
|
+
enabled: true;
|
|
59
|
+
}[];
|
|
60
|
+
defaults: {
|
|
61
|
+
router: _testforgejs_vue_test_core.PluginOptionsFactory<_testforgejs_vue_test_plugin_router.VueTestRouterOptions>;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export { defaultI18n, defaultPinia, defaultRouter, presets };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// src/defaults/defaultI18n.ts
|
|
2
|
+
var defaultI18n = () => ({
|
|
3
|
+
legacy: false,
|
|
4
|
+
locale: "en",
|
|
5
|
+
fallbackLocale: "en",
|
|
6
|
+
messages: {},
|
|
7
|
+
fallbackWarn: false,
|
|
8
|
+
missingWarn: false
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
// src/defaults/defaultPinia.ts
|
|
12
|
+
var defaultPinia = () => ({
|
|
13
|
+
initialState: {},
|
|
14
|
+
stubActions: false
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
// src/defaults/defaultRouter.ts
|
|
18
|
+
import { createMemoryHistory, createWebHistory } from "vue-router";
|
|
19
|
+
var defaultRouter = () => ({
|
|
20
|
+
history: typeof window !== "undefined" ? createWebHistory() : createMemoryHistory(),
|
|
21
|
+
routes: [{ path: "/", component: { render: () => null } }]
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
// src/presets.ts
|
|
25
|
+
import { piniaPlugin } from "@testforgejs/vue-test-plugin-pinia";
|
|
26
|
+
import { i18nPlugin } from "@testforgejs/vue-test-plugin-i18n";
|
|
27
|
+
import { routerPlugin } from "@testforgejs/vue-test-plugin-router";
|
|
28
|
+
var presets = {
|
|
29
|
+
default: {
|
|
30
|
+
manifest: [
|
|
31
|
+
{ module: piniaPlugin, enabled: true },
|
|
32
|
+
{ module: i18nPlugin, enabled: true },
|
|
33
|
+
{ module: routerPlugin, enabled: false }
|
|
34
|
+
],
|
|
35
|
+
defaults: {
|
|
36
|
+
i18n: defaultI18n,
|
|
37
|
+
pinia: defaultPinia,
|
|
38
|
+
router: defaultRouter
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
piniaPreset: {
|
|
42
|
+
manifest: [{ module: piniaPlugin, enabled: true }],
|
|
43
|
+
defaults: {
|
|
44
|
+
pinia: defaultPinia
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
i18nPreset: {
|
|
48
|
+
manifest: [{ module: i18nPlugin, enabled: true }],
|
|
49
|
+
defaults: {
|
|
50
|
+
i18n: defaultI18n
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
routerPreset: {
|
|
54
|
+
manifest: [{ module: routerPlugin, enabled: true }],
|
|
55
|
+
defaults: {
|
|
56
|
+
router: defaultRouter
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
export {
|
|
61
|
+
defaultI18n,
|
|
62
|
+
defaultPinia,
|
|
63
|
+
defaultRouter,
|
|
64
|
+
presets
|
|
65
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@testforgejs/vue-test-preset-base",
|
|
3
|
+
"version": "1.0.0-beta.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Official base preset for the TestForge framework",
|
|
6
|
+
"homepage": "https://github.com/testforgejs/testforge#readme",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/testforgejs/testforge.git",
|
|
10
|
+
"directory": "packages/vue-test-preset-base"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/testforgejs/testforge/issues"
|
|
14
|
+
},
|
|
15
|
+
"main": "./dist/index.cjs",
|
|
16
|
+
"module": "./dist/index.js",
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"import": "./dist/index.js",
|
|
22
|
+
"require": "./dist/index.cjs"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist"
|
|
27
|
+
],
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
30
|
+
},
|
|
31
|
+
"keywords": [
|
|
32
|
+
"vue",
|
|
33
|
+
"vue3",
|
|
34
|
+
"testing",
|
|
35
|
+
"component-testing",
|
|
36
|
+
"vue-test-utils",
|
|
37
|
+
"preset",
|
|
38
|
+
"configuration",
|
|
39
|
+
"base",
|
|
40
|
+
"testforge",
|
|
41
|
+
"testforge-preset"
|
|
42
|
+
],
|
|
43
|
+
"license": "MIT",
|
|
44
|
+
"author": "Roman Levchenko",
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@testforgejs/vue-test-plugin-router": "1.0.0-beta.1",
|
|
47
|
+
"@testforgejs/vue-test-plugin-pinia": "1.0.0-beta.1",
|
|
48
|
+
"@testforgejs/vue-test-plugin-i18n": "1.0.0-beta.1"
|
|
49
|
+
},
|
|
50
|
+
"peerDependencies": {
|
|
51
|
+
"vue-router": ">=4.0.0 <6.0.0",
|
|
52
|
+
"@testforgejs/vue-test-core": "1.0.0-beta.1"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"vue-router": "^5.0.0",
|
|
56
|
+
"@testforgejs/vue-test-core": "1.0.0-beta.1"
|
|
57
|
+
},
|
|
58
|
+
"scripts": {
|
|
59
|
+
"build": "tsup",
|
|
60
|
+
"dev": "tsup --watch"
|
|
61
|
+
}
|
|
62
|
+
}
|