@equinor/fusion-framework-vitest-plugin-react-app 1.0.0-next.6 → 1.0.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/CHANGELOG.md CHANGED
@@ -1,167 +1,52 @@
1
1
  # @equinor/fusion-framework-vitest-plugin-react-app
2
2
 
3
- ## 1.0.0-next.6
4
-
5
- ### Patch Changes
6
-
7
- - Updated dependencies [09a9bcc]
8
- - Updated dependencies [09a9bcc]
9
- - Updated dependencies [09a9bcc]
10
- - @equinor/fusion-framework-cli@15.3.0-next.1
11
- - @equinor/fusion-framework-module-feature-flag@2.1.0-next.1
12
- - @equinor/fusion-imports@2.0.3-next.1
13
- - @equinor/fusion-framework-app@13.0.3-next.1
14
- - @equinor/fusion-framework@8.1.0-next.2
15
-
16
- ## 1.0.0-next.5
3
+ ## 1.0.0
17
4
 
18
5
  ### Minor Changes
19
6
 
20
- - 1813f8a: `resolveFusion` (and both the `/test` fixtures and `testApp`) now enable the feature-flag
21
- mock by default, with no flags enabled, so `useFeature` needs no `localStorage` or URL
22
- seeding in tests.
7
+ - f663b46: Add `@equinor/fusion-framework-vitest-plugin-react-app`: Vitest/`vitest-browser-react` helpers for testing a Fusion Framework React application inside a real, mock-backed application module scope — the same `FrameworkProvider` + `ModuleProvider` nesting `renderApp`/`createComponent` wire up in production, backed by `mockFramework` and `mockAppModules` (`@equinor/fusion-framework-app/mock`).
23
8
 
24
- `@equinor/fusion-framework-module-feature-flag` is an optional peer dependency: the mock is
25
- only wired up when the package is actually installed, so apps that don't use feature flags
26
- aren't forced to add it. Install it to get the default mock; call `enableFeatureFlagMock`
27
- again inside `configureFusion` to seed specific flags.
28
-
29
- ### Patch Changes
30
-
31
- - 1813f8a: Exclude `.d.ts` files from the default `server.warmup.clientFiles` and `optimizeDeps.entries`
32
- globs in `defineProject`. Previously, an app shipping a CJS-style declaration file (for example
33
- one using `export =`) failed the Vite warmup scan, since it was loaded as ESM.
34
- - 1813f8a: Revert the mocked framework's default navigation history from browser history back to in-memory
35
- history. Browser history leaked URL/history state between tests; `configureFusion`/`enableNavigation`
36
- can still opt back into browser history for a test that specifically needs it.
37
- - Updated dependencies [c8008e3]
38
- - @equinor/fusion-framework-app@13.0.3-next.0
39
- - @equinor/fusion-framework-cli@15.2.11-next.0
40
- - @equinor/fusion-framework-module-app@8.0.6-next.0
41
- - @equinor/fusion-framework-module-navigation@7.0.9-next.0
42
- - @equinor/fusion-framework-react@9.0.0-next.0
43
- - @equinor/fusion-framework-module-feature-flag@2.1.0-next.0
44
-
45
- ## 1.0.0-next.4
46
-
47
- ### Major Changes
48
-
49
- - b3d46e0: Rename the `testApp`/`test` fixtures for extending the mocked application and parent framework
50
- configuration: `configure` is now `configureApp`, the new `configureFramework` fixture
51
- introduced alongside it is now `configureFusion`, and `env` is now `appEnv`.
52
-
53
- ```diff
54
- -const test = testApp.extend('configure', { injected: true }, () => ...);
55
- +const test = testApp.extend('configureApp', { injected: true }, () => ...);
56
-
57
- -test.override('fusion', async ({ env }) => ...);
58
- +test.override('fusion', async ({ appEnv }) => ...);
59
- ```
60
-
61
- `configureFusion` composes with the base parent-framework mock (app manifest and navigation) the same way `configureApp` composes with the base app-module mock — see [Advanced usage](docs/advanced.md#extend-the-parent-framework-mock-with-configurefusion) for extending framework-scope modules such as feature flags, service discovery, or navigation history.
62
-
63
- Also adds `mergeEnvConfig`, a new utility exported from the `/test` entry point for overriding one endpoint's URL (or an `environment` value) on `appEnv` without dropping the rest of the app's `AppConfig` — a plain object spread over `AppConfig` copies nothing, since it stores `environment`/`endpoints` behind private fields exposed only through getters. See [Advanced usage](docs/advanced.md#fake-an-endpoint-url-with-mergeenvconfig).
64
-
65
- ```ts
66
- const test = baseTest.extend("appEnv", ({ appEnv }) =>
67
- mergeEnvConfig(appEnv, {
68
- endpoints: { "cpr-api": { url: backendBaseUrl } },
69
- }),
70
- );
71
- ```
72
-
73
- ## 0.2.0-next.3
74
-
75
- ### Patch Changes
76
-
77
- - @equinor/fusion-framework-cli@15.2.8-next.2
78
- - @equinor/fusion-framework-app@14.0.0-next.1
79
- - @equinor/fusion-framework@8.1.0-next.1
80
-
81
- ## 0.2.0-next.2
82
-
83
- ### Minor Changes
84
-
85
- - 7cdd512: `defineProject` now defaults `test.browser.viewport` to `1024x768` instead of Vitest's own
86
- mobile-sized default, matching the low, fixed resolution most Fusion apps see in production
87
- through Citrix. Pass `test.browser.viewport` to `defineProject` to use a different size.
88
-
89
- ## 0.2.0-next.1
90
-
91
- ### Patch Changes
92
-
93
- - @equinor/fusion-framework-cli@15.2.8-next.1
94
-
95
- ## 0.2.0-next.0
96
-
97
- ### Minor Changes
98
-
99
- - 2836e0b: Add a `/config` entry-point exporting `defineProject`: a drop-in for Vitest's own `defineProject`, pre-wired with `appTestVitePlugin` and the `@vitest/browser-playwright`/`chromium` browser provider, so a consuming app's own `vitest.config.ts` needs no browser-provider boilerplate.
100
-
101
- ```ts
102
- import { defineProject } from "@equinor/fusion-framework-vitest-plugin-react-app/config";
103
- import { name, version } from "./package.json" with { type: "json" };
104
-
105
- export default defineProject({ test: { name: `${name}@${version}` } });
106
- ```
107
-
108
- `override` is deep-merged onto the default config via Vite's own `mergeConfig` (a plain object), or applied to the default config outright (a function receiving it) — for changes `mergeConfig` can't express, such as swapping `test.browser.provider` for a different `@vitest/browser-*` provider.
109
-
110
- `@vitest/browser-playwright` and `playwright` are now explicit peer dependencies of the package.
111
-
112
- Also fixes `appTestVitePlugin`'s `entrypoint` inference: when no `entrypoint` option is given, it now resolves from the Vitest project's own root (via `configResolved`) instead of `process.cwd()`, so each cookbook's `vitest.config.ts` no longer needs to pass `entrypoint` explicitly when run as part of a multi-project Vitest run.
113
-
114
- - 2836e0b: Add `@equinor/fusion-framework-vitest-plugin-react-app`: Vitest/`vitest-browser-react` helpers for testing a Fusion Framework React application inside a real, mock-backed application module scope — the same `FrameworkProvider` + `ModuleProvider` nesting `renderApp`/`createComponent` wire up in production, backed by `mockFramework` and `mockAppModules` (`@equinor/fusion-framework-app/mock`).
115
-
116
9
  ```tsx
117
- import { renderAppHook } from "@equinor/fusion-framework-vitest-plugin-react-app";
118
- import { useAccessToken } from "@equinor/fusion-framework-react-app/msal";
119
-
120
- const { result } = await renderAppHook(() =>
121
- useAccessToken({ scopes: ["User.Read"] }),
122
- );
10
+ import { renderAppHook } from '@equinor/fusion-framework-vitest-plugin-react-app';
11
+ import { useAccessToken } from '@equinor/fusion-framework-react-app/msal';
12
+
13
+ const { result } = await renderAppHook(() => useAccessToken({ scopes: ['User.Read'] }));
123
14
  await vi.waitFor(() => expect(result.current.pending).toBe(false));
124
15
  ```
125
-
16
+
126
17
  Highlights:
127
-
18
+
128
19
  - `renderAppHook`/`renderAppComponent` — render a hook or component against the real `event`/`http`/`msal` module pipeline, with only the network boundary faked; the result carries a nested `fusion: { framework, app }` for driving a module directly after the initial render.
129
- - `testApp` — a `vitest` `test` extended with `env`/`configure`/`app`/`render`/`renderHook` fixtures, for a test file whose cases share one mocked scope.
130
- - `appTestVitePlugin` — a Vite plugin resolving an application's own manifest, config, and module-configurator (the same pipeline `ffc app build`/`ffc app dev` use) as virtual modules.
131
- - A `/test` entry-point exporting `test`/`render`, pre-seeded from the resolved manifest/config/configure once `appTestVitePlugin` is registered — no per-test `env`/`configure` wiring.
132
-
133
- Package documentation provides task-focused guides for setup, configuration, advanced fixtures,
134
- module mocks, and troubleshooting so npm, GitHub, and retrieval clients use the same canonical
135
- source as the VuePress site.
20
+ - `testApp` — a `vitest` `test` extended with `appEnv`/`configureApp`/`configureFusion`/`app`/`render`/`renderHook` fixtures, for a test file whose cases share one mocked scope. `configureApp` composes with the base app-module mock; `configureFusion` composes with the base parent-framework mock (app manifest and navigation) for extending framework-scope modules such as feature flags, service discovery, or navigation history.
21
+ - `appTestVitePlugin` — a Vite plugin resolving an application's own manifest, config, and module-configurator (the same pipeline `ffc app build`/`ffc app dev` use) as virtual modules, with `entrypoint` inferred from the Vitest project's own root (via `configResolved`) when not given explicitly, so each cookbook's `vitest.config.ts` needs no `entrypoint` override when run as part of a multi-project Vitest run.
22
+ - A `/test` entry-point exporting `test`/`render`, pre-seeded from the resolved manifest/config/configure once `appTestVitePlugin` is registered — no per-test `env`/`configure` wiring — plus `mergeEnvConfig` for overriding one endpoint's URL (or an `environment` value) on `appEnv` without dropping the rest of the app's `AppConfig`.
23
+ - A `/config` entry-point exporting `defineProject`: a drop-in for Vitest's own `defineProject`, pre-wired with `appTestVitePlugin` and the `@vitest/browser-playwright`/`chromium` browser provider, so a consuming app's own `vitest.config.ts` needs no browser-provider boilerplate:
24
+
25
+ ```ts
26
+ import { defineProject } from '@equinor/fusion-framework-vitest-plugin-react-app/config';
27
+ import { name, version } from './package.json' with { type: 'json' };
28
+
29
+ export default defineProject({ test: { name: `${name}@${version}` } });
30
+ ```
31
+
32
+ `defineProject` defaults `test.browser.viewport` to `1024x768` instead of Vitest's own mobile-sized default, matching the low, fixed resolution most Fusion apps see in production through Citrix (pass `test.browser.viewport` to use a different size), sets `server.warmup.clientFiles: ['src/**/*.{ts,tsx}']` so lazily/code-split-imported source (e.g. route components reached only through dynamic `import()`) is transformed up front instead of forcing a page reload mid-test, and excludes `.d.ts` files from the default `server.warmup.clientFiles`/`optimizeDeps.entries` globs so a CJS-style declaration file (e.g. one using `export =`) does not fail the Vite warmup scan. `override` is deep-merged onto the default config via Vite's own `mergeConfig` (a plain object), or applied to the default config outright (a function receiving it) — for changes `mergeConfig` can't express, such as swapping `test.browser.provider` for a different `@vitest/browser-*` provider.
33
+ - The mocked framework enables the feature-flag mock by default (no flags enabled) when `@equinor/fusion-framework-module-feature-flag` is installed, so `useFeature` needs no `localStorage`/URL seeding in tests, and defaults navigation to in-memory history rather than browser history (which leaked URL/history state between tests) — `configureFusion`/`enableNavigation` can still opt back into browser history for a test that specifically needs it.
34
+
35
+ `@vitest/browser-playwright` and `playwright` are peer dependencies of the package. Package documentation provides task-focused guides for setup, configuration, advanced fixtures, module mocks, and troubleshooting so npm, GitHub, and retrieval clients use the same canonical source as the VuePress site.
136
36
 
137
37
  ### Patch Changes
138
38
 
139
- - e8aae1f: Internal: publish every package on the `next` pre-release tag so the whole framework can be installed as a coherent set.
140
-
141
- Packages without their own changes are bumped only to receive a `-next.N` version and the `next` dist-tag on npm. Install with:
142
-
143
- ```bash
144
- pnpm add @equinor/fusion-framework-react-app@next
145
- ```
146
-
147
- - 2836e0b: Fix `defineProject` not pre-transforming lazily/code-split-imported source (e.g. route
148
- components reached only through dynamic `import()`), which could force Vite to reload the
149
- page mid-test and fail the in-flight test file's import.
150
-
151
- `defineProject`'s Vite config now sets `server.warmup.clientFiles: ['src/**/*.{ts,tsx}']`, so
152
- all source under `src/` is transformed up front instead of on first request.
153
-
154
- - 2836e0b: Document `test.override(...)` for overriding a fixture (`configure`, `fusion`, etc.) within a
39
+ - f663b46: Document `test.override(...)` for overriding a fixture (`configure`, `fusion`, etc.) within a
155
40
  single test file or `describe` block, alongside the existing `test.extend(...)` guide, in the
156
41
  package's "Advanced usage" doc (`docs/advanced.md`).
157
- - 2836e0b: Add a "Migrate an existing app" guide (`docs/migrating-an-existing-app.md`) covering how to
42
+ - f663b46: Add a "Migrate an existing app" guide (`docs/migrating-an-existing-app.md`) covering how to
158
43
  move a suite from `@testing-library/react`/jsdom/happy-dom onto this package: installing
159
44
  Browser Mode, replacing hand-rolled `vi.mock`s of Fusion hooks with each module's `enable*Mock`
160
45
  entry point, porting a hand-written mock HTTP server to `createRouterMiddleware`, composing a
161
46
  router fixture with a domain-state fixture in one file, and updating renders/assertions to the
162
47
  async `vitest-browser-react` API. Linked from the package README and from
163
48
  `docs/overview.md` and `testing-choosing-a-layer.md`.
164
- - 2836e0b: Add a "Why Browser Mode is the default" guide (`docs/why-browser-mode.md`) explaining
49
+ - f663b46: Add a "Why Browser Mode is the default" guide (`docs/why-browser-mode.md`) explaining
165
50
  the rationale for defaulting to real Chromium over DOM emulation (the documented React 19 peer
166
51
  dependency crash in the previous renderer, plus the framework's real-module testing philosophy),
167
52
  the actual performance tradeoff (a real browser is slower, not faster — this was a fidelity
@@ -169,28 +54,28 @@
169
54
  composing `mockFramework`/`mockAppModules`/`FrameworkProvider`/`ModuleProvider` directly with a
170
55
  different render function (e.g. `@testing-library/react` on `happy-dom`). Linked from the
171
56
  package README and `docs/overview.md`.
172
- - Updated dependencies [e8aae1f]
173
- - Updated dependencies [2836e0b]
174
- - Updated dependencies [2836e0b]
175
- - Updated dependencies [2836e0b]
176
- - Updated dependencies [2836e0b]
177
- - Updated dependencies [2836e0b]
178
- - Updated dependencies [2836e0b]
179
- - Updated dependencies [2836e0b]
180
- - Updated dependencies [2836e0b]
181
- - Updated dependencies [2836e0b]
182
- - Updated dependencies [2836e0b]
183
- - Updated dependencies [2836e0b]
184
- - Updated dependencies [2836e0b]
185
- - Updated dependencies [2836e0b]
186
- - Updated dependencies [2836e0b]
187
- - Updated dependencies [2836e0b]
188
- - Updated dependencies [2836e0b]
189
- - @equinor/fusion-framework@8.1.0-next.0
190
- - @equinor/fusion-framework-app@14.0.0-next.0
191
- - @equinor/fusion-framework-cli@15.2.8-next.0
192
- - @equinor/fusion-framework-module@6.1.3-next.0
193
- - @equinor/fusion-framework-module-app@8.1.0-next.0
194
- - @equinor/fusion-framework-react@9.0.0-next.0
195
- - @equinor/fusion-framework-react-module@4.0.3-next.0
196
- - @equinor/fusion-imports@2.0.3-next.0
57
+ - Updated dependencies [f663b46]
58
+ - Updated dependencies [f663b46]
59
+ - Updated dependencies [f663b46]
60
+ - Updated dependencies [f663b46]
61
+ - Updated dependencies [f663b46]
62
+ - Updated dependencies [f663b46]
63
+ - Updated dependencies [f663b46]
64
+ - Updated dependencies [f663b46]
65
+ - Updated dependencies [f663b46]
66
+ - Updated dependencies [f663b46]
67
+ - Updated dependencies [f663b46]
68
+ - Updated dependencies [f663b46]
69
+ - Updated dependencies [f663b46]
70
+ - Updated dependencies [f663b46]
71
+ - Updated dependencies [f663b46]
72
+ - @equinor/fusion-framework-app@13.1.0
73
+ - @equinor/fusion-framework-cli@15.3.0
74
+ - @equinor/fusion-framework@8.1.0
75
+ - @equinor/fusion-framework-module-feature-flag@2.1.0
76
+ - @equinor/fusion-imports@2.0.3
77
+ - @equinor/fusion-framework-module-app@8.1.0
78
+ - @equinor/fusion-framework-module@6.1.3
79
+ - @equinor/fusion-framework-module-navigation@7.0.9
80
+ - @equinor/fusion-framework-react-module@4.0.3
81
+ - @equinor/fusion-framework-react@9.0.0
@@ -1,3 +1,3 @@
1
1
  // Generated by genversion.
2
- export const version = '1.0.0-next.6';
2
+ export const version = '1.0.0';
3
3
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,MAAM,CAAC,MAAM,OAAO,GAAG,cAAc,CAAC"}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC"}