You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
vue: add jest testing hints on imports and add exports to package.json
- Add documentation on import order for jest (or other) unit tests using CJS transformations
- Add explicit `exports` property to vue's package.json to facilitate tools finding the correct bundle
Mitigates #2250
The injected `jsonforms` object is not meant to be modified directly.
290
290
Instead it should be modified via the provided `dispatch` and by changing the props of the `json-forms` component.
291
291
292
+
### Testing with Jest / Vitest
293
+
294
+
When testing custom renderers with Jest or Vitest using CJS transforms, `vue` must be imported **before**`@jsonforms/vue` in your renderer files.
295
+
This is due to the CJS bundle eagerly evaluating Vue component definitions at `require()` time, which can cause issues when Jest's module resolution processes imports sequentially.
This only affects test environments using CJS module transforms.
311
+
Browser builds using Webpack, Vite, or other ESM-aware bundlers are not affected.
312
+
292
313
## License
293
314
294
315
The JSON Forms project is licensed under the MIT License. See the [LICENSE file](https://github.com/eclipsesource/jsonforms/blob/master/LICENSE) for more information.
0 commit comments