@testforgejs/vue-test-plugin-i18n 1.0.0-beta.0
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 +60 -0
- package/dist/index.cjs +44 -0
- package/dist/index.d.cts +54 -0
- package/dist/index.d.ts +54 -0
- package/dist/index.js +17 -0
- package/package.json +59 -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,60 @@
|
|
|
1
|
+
# @testforgejs/vue-test-plugin-i18n
|
|
2
|
+
|
|
3
|
+
Vue I18n integration for TestForge component tests.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Choose your preferred package manager.
|
|
8
|
+
|
|
9
|
+
### pnpm
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pnpm add -D @testforgejs/vue-test-plugin-i18n@beta
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### npm
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install -D @testforgejs/vue-test-plugin-i18n@beta
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Yarn
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
yarn add -D @testforgejs/vue-test-plugin-i18n@beta
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
> `@testforgejs/vue-test-core` is required.
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
import { createTestFramework } from "@testforgejs/vue-test-core";
|
|
33
|
+
import { i18nPlugin } from "@testforgejs/vue-test-plugin-i18n";
|
|
34
|
+
|
|
35
|
+
const framework = createTestFramework({
|
|
36
|
+
presets: {
|
|
37
|
+
default: {
|
|
38
|
+
manifest: [
|
|
39
|
+
{
|
|
40
|
+
module: i18nPlugin,
|
|
41
|
+
enabled: true,
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Supported versions
|
|
50
|
+
|
|
51
|
+
- Vue I18n: 9–11
|
|
52
|
+
- Vue: 3.x
|
|
53
|
+
|
|
54
|
+
## Documentation
|
|
55
|
+
|
|
56
|
+
See the [TestForge documentation](https://github.com/testforgejs/testforge#readme).
|
|
57
|
+
|
|
58
|
+
### API Reference
|
|
59
|
+
|
|
60
|
+
See the [API reference](https://github.com/testforgejs/testforge/blob/main/packages/vue-test-plugin-i18n/docs/api/README.md).
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
i18nPlugin: () => i18nPlugin
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(index_exports);
|
|
26
|
+
|
|
27
|
+
// src/module/createI18nPlugin.ts
|
|
28
|
+
var import_vue_test_core = require("@testforgejs/vue-test-core");
|
|
29
|
+
var import_vue_i18n = require("vue-i18n");
|
|
30
|
+
function createI18nPlugin(options) {
|
|
31
|
+
return (0, import_vue_test_core.createPluginInstance)(import_vue_i18n.createI18n, options);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// src/module/i18nPlugin.ts
|
|
35
|
+
var i18nPlugin = {
|
|
36
|
+
getName: () => "i18n",
|
|
37
|
+
getDefinition: () => ({
|
|
38
|
+
create: createI18nPlugin
|
|
39
|
+
})
|
|
40
|
+
};
|
|
41
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
+
0 && (module.exports = {
|
|
43
|
+
i18nPlugin
|
|
44
|
+
});
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { I18nOptions, I18n } from 'vue-i18n';
|
|
2
|
+
import { PluginControlOptions, PluginModule } from '@testforgejs/vue-test-core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Configuration options for the Vue I18n test plugin.
|
|
6
|
+
*
|
|
7
|
+
* This interface integrates standard internationalization parameters (`I18nOptions` from `vue-i18n`)
|
|
8
|
+
* with TestForge test kernel control options.
|
|
9
|
+
*
|
|
10
|
+
* @see {@link I18nOptions} for configuring locales, fallback languages, and translation messages.
|
|
11
|
+
* @see {@link PluginControlOptions} for instance capturing and exposure mechanisms.
|
|
12
|
+
*/
|
|
13
|
+
type VueTestI18nOptions = I18nOptions & PluginControlOptions<I18n>;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* TestForge core type augmentation for Vue I18n integration.
|
|
17
|
+
*
|
|
18
|
+
* This module registers the i18n configuration under the global plugin options map,
|
|
19
|
+
* enabling full type safety when defining internationalization options in tests.
|
|
20
|
+
*
|
|
21
|
+
* @module I18nAugmentation
|
|
22
|
+
*/
|
|
23
|
+
declare module "@testforgejs/vue-test-core" {
|
|
24
|
+
/**
|
|
25
|
+
* Global map for TestForge plugin configuration options.
|
|
26
|
+
*/
|
|
27
|
+
interface PluginOptionsMap {
|
|
28
|
+
/**
|
|
29
|
+
* Configuration for the `i18n` plugin.
|
|
30
|
+
* Accepts a {@link VueTestI18nOptions} object to manage localization and translations.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* factory({}, {
|
|
35
|
+
* plugins: {
|
|
36
|
+
* i18n: {
|
|
37
|
+
* locale: "en",
|
|
38
|
+
* messages: { en: { hello: "Hello World" } }
|
|
39
|
+
* }
|
|
40
|
+
* }
|
|
41
|
+
* });
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
i18n: VueTestI18nOptions;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Vue I18n plugin module definition for the TestForge framework.
|
|
50
|
+
* Automatically handles internationalization setup inside test environments.
|
|
51
|
+
*/
|
|
52
|
+
declare const i18nPlugin: PluginModule<I18n, VueTestI18nOptions>;
|
|
53
|
+
|
|
54
|
+
export { type VueTestI18nOptions, i18nPlugin };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { I18nOptions, I18n } from 'vue-i18n';
|
|
2
|
+
import { PluginControlOptions, PluginModule } from '@testforgejs/vue-test-core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Configuration options for the Vue I18n test plugin.
|
|
6
|
+
*
|
|
7
|
+
* This interface integrates standard internationalization parameters (`I18nOptions` from `vue-i18n`)
|
|
8
|
+
* with TestForge test kernel control options.
|
|
9
|
+
*
|
|
10
|
+
* @see {@link I18nOptions} for configuring locales, fallback languages, and translation messages.
|
|
11
|
+
* @see {@link PluginControlOptions} for instance capturing and exposure mechanisms.
|
|
12
|
+
*/
|
|
13
|
+
type VueTestI18nOptions = I18nOptions & PluginControlOptions<I18n>;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* TestForge core type augmentation for Vue I18n integration.
|
|
17
|
+
*
|
|
18
|
+
* This module registers the i18n configuration under the global plugin options map,
|
|
19
|
+
* enabling full type safety when defining internationalization options in tests.
|
|
20
|
+
*
|
|
21
|
+
* @module I18nAugmentation
|
|
22
|
+
*/
|
|
23
|
+
declare module "@testforgejs/vue-test-core" {
|
|
24
|
+
/**
|
|
25
|
+
* Global map for TestForge plugin configuration options.
|
|
26
|
+
*/
|
|
27
|
+
interface PluginOptionsMap {
|
|
28
|
+
/**
|
|
29
|
+
* Configuration for the `i18n` plugin.
|
|
30
|
+
* Accepts a {@link VueTestI18nOptions} object to manage localization and translations.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* factory({}, {
|
|
35
|
+
* plugins: {
|
|
36
|
+
* i18n: {
|
|
37
|
+
* locale: "en",
|
|
38
|
+
* messages: { en: { hello: "Hello World" } }
|
|
39
|
+
* }
|
|
40
|
+
* }
|
|
41
|
+
* });
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
i18n: VueTestI18nOptions;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Vue I18n plugin module definition for the TestForge framework.
|
|
50
|
+
* Automatically handles internationalization setup inside test environments.
|
|
51
|
+
*/
|
|
52
|
+
declare const i18nPlugin: PluginModule<I18n, VueTestI18nOptions>;
|
|
53
|
+
|
|
54
|
+
export { type VueTestI18nOptions, i18nPlugin };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// src/module/createI18nPlugin.ts
|
|
2
|
+
import { createPluginInstance } from "@testforgejs/vue-test-core";
|
|
3
|
+
import { createI18n } from "vue-i18n";
|
|
4
|
+
function createI18nPlugin(options) {
|
|
5
|
+
return createPluginInstance(createI18n, options);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// src/module/i18nPlugin.ts
|
|
9
|
+
var i18nPlugin = {
|
|
10
|
+
getName: () => "i18n",
|
|
11
|
+
getDefinition: () => ({
|
|
12
|
+
create: createI18nPlugin
|
|
13
|
+
})
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
i18nPlugin
|
|
17
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@testforgejs/vue-test-plugin-i18n",
|
|
3
|
+
"version": "1.0.0-beta.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Official TestForge plugin for vue-i18n integration in component tests",
|
|
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-plugin-i18n"
|
|
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
|
+
"vue-test-utils",
|
|
36
|
+
"vue-i18n",
|
|
37
|
+
"i18n",
|
|
38
|
+
"localization",
|
|
39
|
+
"testforge",
|
|
40
|
+
"testforge-plugin",
|
|
41
|
+
"component-testing"
|
|
42
|
+
],
|
|
43
|
+
"license": "MIT",
|
|
44
|
+
"author": "Roman Levchenko",
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"vue-i18n": ">=9.0.0 <12.0.0",
|
|
47
|
+
"@testforgejs/vue-test-core": "1.0.0-beta.0"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"vue-i18n": "^11.4.8",
|
|
51
|
+
"@testforgejs/vue-test-core": "1.0.0-beta.0"
|
|
52
|
+
},
|
|
53
|
+
"scripts": {
|
|
54
|
+
"build": "tsup",
|
|
55
|
+
"dev": "tsup --watch",
|
|
56
|
+
"test:types": "tsd",
|
|
57
|
+
"docs:generate": "typedoc"
|
|
58
|
+
}
|
|
59
|
+
}
|