-
-
Notifications
You must be signed in to change notification settings - Fork 320
-
Hi all! I would like to use the Ajv schema validator in my tests (or any other fwiw, but I found none that worked in the test runner..). However I can't seem to be able to import that module. I wonder if this is just me not having the right configuration, or if it is not working at all?
Either I'm getting:
🚧 Browser logs:
SyntaxError: The requested module '/__wds-outside-root__/1/node_modules/ajv/lib/ajv.js' does not provide an export named 'Ajv'
❌ Could not import your test module. Check the browser logs or open the browser in debug mode for more information.
or
🚧 Browser logs:
TypeError: Failed to fetch dynamically imported module: http://localhost:8000/src/foobar.test.js?wtr-session-id=ZDJ2XRyAKqxRgzmHhoBLB
❌ Could not import your test module. Check the browser logs or open the browser in debug mode for more information.
Which apparently already fails starting up the test runner. The suggested browser logs are not of much help...
I tried playing with test runner config and rollup plugins... I got something, to a certain extent, that something is converted. However, the actual module still can't be loaded.
Config wise I currently have something along the lines of:
const commonjs = fromRollup(rollupCommonjs);
const rupjson = fromRollup(rollupJson);
const resolve = fromRollup(rollupResolve);
...
export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
...
mimeTypes: {
// serve all json files as js
'**/*.json': 'js',
},
plugins: [
rupjson({
include: ['../../**/node_modules/ajv/**/*'],
}),
commonjs({
include: ['../../**/node_modules/ajv/**/*'],
}),
//resolve(),
],
...
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment