@testforgejs/vue-test-plugin-pinia 1.0.0-beta.3 → 1.0.0-beta.5

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/dist/index.cjs CHANGED
@@ -30,7 +30,10 @@ module.exports = __toCommonJS(index_exports);
30
30
  var import_vue_test_core = require("@testforgejs/vue-test-core");
31
31
  var import_testing = require("@pinia/testing");
32
32
  function createPiniaPlugin(options) {
33
- const pinia = (0, import_vue_test_core.createPluginInstance)(import_testing.createTestingPinia, options);
33
+ const pinia = (0, import_vue_test_core.createPluginInstance)(
34
+ import_testing.createTestingPinia,
35
+ options
36
+ );
34
37
  if (options.mockStores) {
35
38
  options.mockStores(pinia);
36
39
  }
@@ -67,7 +70,8 @@ var piniaPlugin = {
67
70
  // Automatically sets the active Pinia instance for current test context.
68
71
  afterCreate(instance) {
69
72
  (0, import_pinia.setActivePinia)(instance);
70
- }
73
+ },
74
+ supportsInstanceReferences: true
71
75
  }),
72
76
  getDefaultOptions: defaultOptions
73
77
  };
package/dist/index.d.cts CHANGED
@@ -1,26 +1,33 @@
1
- import { Pinia } from 'pinia';
2
- import { TestingOptions } from '@pinia/testing';
1
+ import { TestingOptions, TestingPinia } from '@pinia/testing';
3
2
  import { PluginControlOptions, PluginModuleWithDefaults } from '@testforgejs/vue-test-core';
4
3
 
4
+ /**
5
+ * Stable TestForge identifier for the managed Pinia plugin.
6
+ *
7
+ * Use this identifier when declaring Pinia configuration
8
+ * in presets and other plugin-aware TestForge APIs.
9
+ */
5
10
  declare const PINIA_PLUGIN_NAME: "pinia";
6
11
 
7
12
  /**
8
- * A callback function to mutate or configure Pinia stores immediately after they are created.
9
- * Used to set the initial state (mocking) in tests.
13
+ * A callback for configuring Pinia stores after the testing Pinia instance
14
+ * is created and before the component is mounted.
15
+ *
16
+ * Use it to initialize or modify stores required by the test.
10
17
  *
11
- * @param pinia - Созданный инстанс Pinia для тестирования.
18
+ * @param pinia - The testing Pinia instance used by the mounted component.
12
19
  */
13
- type MockStoresFn = (pinia: Pinia) => void;
20
+ type MockStoresFn = (pinia: TestingPinia) => void;
14
21
  /**
15
22
  * Configuration options for the Pinia test plugin.
16
23
  *
17
- * This interface integrates the standard Pinia testing initialization settings
18
- * (`TestingOptions` from `@pinia/testing`) with the TestForge core configuration options.
24
+ * Combines standard Pinia testing configuration (`TestingOptions` from `@pinia/testing`)
25
+ * with TestForge plugin control options.
19
26
  *
20
- * @see {@link TestingOptions} to configure action stubs and the initial state.
21
- * @see {@link PluginControlOptions} to use interception methods such as `expose`.
27
+ * @see {@link TestingOptions} for configuring action stubs, initial state, and Pinia plugins.
28
+ * @see {@link PluginControlOptions} for instance capturing and exposure mechanisms.
22
29
  */
23
- interface VueTestPiniaOptions extends TestingOptions, PluginControlOptions<Pinia> {
30
+ interface VueTestPiniaOptions extends TestingOptions, PluginControlOptions<TestingPinia> {
24
31
  /**
25
32
  * A callback function to modify the state of stores before a component is mounted.
26
33
  *
@@ -42,12 +49,10 @@ interface VueTestPiniaOptions extends TestingOptions, PluginControlOptions<Pinia
42
49
  }
43
50
 
44
51
  /**
45
- * Extending TestForge kernel types for Pinia integration.
52
+ * TestForge core type augmentation for Pinia integration.
46
53
  *
47
- * This module registers the Pinia configuration in the global plugin map,
48
- * which ensures strict typing of the `pinia` property within `plugins`.
49
- *
50
- * @module PiniaAugmentation
54
+ * Registers the public plugin configuration and runtime instance types
55
+ * used by TestForge's managed plugin APIs.
51
56
  */
52
57
  declare module "@testforgejs/vue-test-core" {
53
58
  /**
@@ -60,8 +65,23 @@ declare module "@testforgejs/vue-test-core" {
60
65
  */
61
66
  [PINIA_PLUGIN_NAME]: VueTestPiniaOptions;
62
67
  }
68
+ /**
69
+ * Registers the testing Pinia runtime instance type.
70
+ */
71
+ interface PluginInstanceMap {
72
+ /**
73
+ * Testing Pinia instance created by the managed `pinia` plugin.
74
+ */
75
+ [PINIA_PLUGIN_NAME]: TestingPinia;
76
+ }
63
77
  }
64
78
 
65
- declare const piniaPlugin: PluginModuleWithDefaults<Pinia, VueTestPiniaOptions>;
79
+ /**
80
+ * Managed Pinia testing plugin module for TestForge.
81
+ *
82
+ * Provides the runtime definition for creating testing Pinia instances
83
+ * and exposes the default configuration used by TestForge-managed presets.
84
+ */
85
+ declare const piniaPlugin: PluginModuleWithDefaults<TestingPinia, VueTestPiniaOptions>;
66
86
 
67
87
  export { type MockStoresFn, PINIA_PLUGIN_NAME as PLUGIN_NAME, type VueTestPiniaOptions, piniaPlugin, piniaPlugin as plugin };
package/dist/index.d.ts CHANGED
@@ -1,26 +1,33 @@
1
- import { Pinia } from 'pinia';
2
- import { TestingOptions } from '@pinia/testing';
1
+ import { TestingOptions, TestingPinia } from '@pinia/testing';
3
2
  import { PluginControlOptions, PluginModuleWithDefaults } from '@testforgejs/vue-test-core';
4
3
 
4
+ /**
5
+ * Stable TestForge identifier for the managed Pinia plugin.
6
+ *
7
+ * Use this identifier when declaring Pinia configuration
8
+ * in presets and other plugin-aware TestForge APIs.
9
+ */
5
10
  declare const PINIA_PLUGIN_NAME: "pinia";
6
11
 
7
12
  /**
8
- * A callback function to mutate or configure Pinia stores immediately after they are created.
9
- * Used to set the initial state (mocking) in tests.
13
+ * A callback for configuring Pinia stores after the testing Pinia instance
14
+ * is created and before the component is mounted.
15
+ *
16
+ * Use it to initialize or modify stores required by the test.
10
17
  *
11
- * @param pinia - Созданный инстанс Pinia для тестирования.
18
+ * @param pinia - The testing Pinia instance used by the mounted component.
12
19
  */
13
- type MockStoresFn = (pinia: Pinia) => void;
20
+ type MockStoresFn = (pinia: TestingPinia) => void;
14
21
  /**
15
22
  * Configuration options for the Pinia test plugin.
16
23
  *
17
- * This interface integrates the standard Pinia testing initialization settings
18
- * (`TestingOptions` from `@pinia/testing`) with the TestForge core configuration options.
24
+ * Combines standard Pinia testing configuration (`TestingOptions` from `@pinia/testing`)
25
+ * with TestForge plugin control options.
19
26
  *
20
- * @see {@link TestingOptions} to configure action stubs and the initial state.
21
- * @see {@link PluginControlOptions} to use interception methods such as `expose`.
27
+ * @see {@link TestingOptions} for configuring action stubs, initial state, and Pinia plugins.
28
+ * @see {@link PluginControlOptions} for instance capturing and exposure mechanisms.
22
29
  */
23
- interface VueTestPiniaOptions extends TestingOptions, PluginControlOptions<Pinia> {
30
+ interface VueTestPiniaOptions extends TestingOptions, PluginControlOptions<TestingPinia> {
24
31
  /**
25
32
  * A callback function to modify the state of stores before a component is mounted.
26
33
  *
@@ -42,12 +49,10 @@ interface VueTestPiniaOptions extends TestingOptions, PluginControlOptions<Pinia
42
49
  }
43
50
 
44
51
  /**
45
- * Extending TestForge kernel types for Pinia integration.
52
+ * TestForge core type augmentation for Pinia integration.
46
53
  *
47
- * This module registers the Pinia configuration in the global plugin map,
48
- * which ensures strict typing of the `pinia` property within `plugins`.
49
- *
50
- * @module PiniaAugmentation
54
+ * Registers the public plugin configuration and runtime instance types
55
+ * used by TestForge's managed plugin APIs.
51
56
  */
52
57
  declare module "@testforgejs/vue-test-core" {
53
58
  /**
@@ -60,8 +65,23 @@ declare module "@testforgejs/vue-test-core" {
60
65
  */
61
66
  [PINIA_PLUGIN_NAME]: VueTestPiniaOptions;
62
67
  }
68
+ /**
69
+ * Registers the testing Pinia runtime instance type.
70
+ */
71
+ interface PluginInstanceMap {
72
+ /**
73
+ * Testing Pinia instance created by the managed `pinia` plugin.
74
+ */
75
+ [PINIA_PLUGIN_NAME]: TestingPinia;
76
+ }
63
77
  }
64
78
 
65
- declare const piniaPlugin: PluginModuleWithDefaults<Pinia, VueTestPiniaOptions>;
79
+ /**
80
+ * Managed Pinia testing plugin module for TestForge.
81
+ *
82
+ * Provides the runtime definition for creating testing Pinia instances
83
+ * and exposes the default configuration used by TestForge-managed presets.
84
+ */
85
+ declare const piniaPlugin: PluginModuleWithDefaults<TestingPinia, VueTestPiniaOptions>;
66
86
 
67
87
  export { type MockStoresFn, PINIA_PLUGIN_NAME as PLUGIN_NAME, type VueTestPiniaOptions, piniaPlugin, piniaPlugin as plugin };
package/dist/index.js CHANGED
@@ -2,7 +2,10 @@
2
2
  import { createPluginInstance } from "@testforgejs/vue-test-core";
3
3
  import { createTestingPinia } from "@pinia/testing";
4
4
  function createPiniaPlugin(options) {
5
- const pinia = createPluginInstance(createTestingPinia, options);
5
+ const pinia = createPluginInstance(
6
+ createTestingPinia,
7
+ options
8
+ );
6
9
  if (options.mockStores) {
7
10
  options.mockStores(pinia);
8
11
  }
@@ -39,7 +42,8 @@ var piniaPlugin = {
39
42
  // Automatically sets the active Pinia instance for current test context.
40
43
  afterCreate(instance) {
41
44
  setActivePinia(instance);
42
- }
45
+ },
46
+ supportsInstanceReferences: true
43
47
  }),
44
48
  getDefaultOptions: defaultOptions
45
49
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testforgejs/vue-test-plugin-pinia",
3
- "version": "1.0.0-beta.3",
3
+ "version": "1.0.0-beta.5",
4
4
  "type": "module",
5
5
  "description": "Official TestForge plugin for Pinia integration in component tests",
6
6
  "homepage": "https://github.com/testforgejs/testforge#readme",
@@ -45,12 +45,12 @@
45
45
  "peerDependencies": {
46
46
  "pinia": "^3.0.0 || ^4.0.0",
47
47
  "@pinia/testing": "^1.0.0 || ^2.0.0",
48
- "@testforgejs/vue-test-core": "1.0.0-beta.3"
48
+ "@testforgejs/vue-test-core": "1.0.0-beta.4"
49
49
  },
50
50
  "devDependencies": {
51
51
  "pinia": "^4.0.0",
52
52
  "@pinia/testing": "^2.0.0",
53
- "@testforgejs/vue-test-core": "1.0.0-beta.3"
53
+ "@testforgejs/vue-test-core": "1.0.0-beta.4"
54
54
  },
55
55
  "testforge": {
56
56
  "plugin": {