-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[4.0.1] - Jest - Cannot find module 'radar-sdk-js' #114
Comments
I was able to fix this with vitest by adding the @originjs/vite-plugin-commonjs plugin to my project:
Alternatively, things were working when I modified radar-sdk-js package.json to have a main entry like:
For this to all work, I needed to make a few extra changes to my vitest.setup.ts to stop errors from being thrown:
I hope this helps someone |
Hello, I created a new beta release |
@kochis my hero.... the beta fixes the test errors. thank you!! |
Help Needed configuring jest + Radar
I'm trying to use Radar for autocomplete and address validation, but am running into the following error when running jest:
Test suite failed to run. Cannot find module 'radar-sdk-js' from 'fetchAutocomplete/index.tsx'
In that file, I am importing radar-sdk-js as
import Radar from 'radar-sdk-js'
I'm using Next js and my jest config is
I have tried uninstalling and reinstalling Radar. It works fine when I include it as html rather than using yarn.
I tried adding a module name mapper of
^radar-sdk-js': '<rootDir>/node_modules/radar-sdk-js'
but that isn't working.I really like the library and want to keep using it, but I'm not sure how to go about making this work. any help would be appreciated.
Thank you
i'm using jest ^29.5.0
I made some changes to jest config and tried:
This got me a new error:
The text was updated successfully, but these errors were encountered: