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
I'm trying to use web-test-runner to test a library that uses react (peer dependency)
I found https://github.com/modernweb-dev/example-projects/tree/master/react-tsx which is pretty similar to what I have. However, if I change react-tsx sample to use react and react-dom instead of @pika/react and @pika/react-dom I'm getting errors. (I cannot use @pika/* because this is a library.)
$ npm run test
> @web/demo-react-tsx@0.0.0 test
> web-test-runner test/**/*.test.tsx
test/app.test.tsx:
🚧 Browser logs:
SyntaxError: The requested module './../node_modules/react/index.js' does not provide an export named 'default'
❌ Could not import your test module. Check the browser logs or open the browser in debug mode for more information.
Chrome: |██████████████████████████████| 1/1 test files | 0 passed, 0 failed
Error while running tests.
Fair enough... I'll just change to import * as React from 'react'... but wait a minute this is trying to import a CJS file with node dependencies like process (which explains why it is unhappy with the missing default export).
It seems like this should be something that web-test-runner should support and I feel like I cannot figure it out.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm trying to use web-test-runner to test a library that uses react (peer dependency)
I found https://github.com/modernweb-dev/example-projects/tree/master/react-tsx which is pretty similar to what I have. However, if I change react-tsx sample to use
react
andreact-dom
instead of@pika/react
and@pika/react-dom
I'm getting errors. (I cannot use@pika/*
because this is a library.)Fair enough... I'll just change to
import * as React from 'react'
... but wait a minute this is trying to import a CJS file with node dependencies like process (which explains why it is unhappy with the missing default export).It seems like this should be something that web-test-runner should support and I feel like I cannot figure it out.
Help wanted.
Beta Was this translation helpful? Give feedback.
All reactions