-
Notifications
You must be signed in to change notification settings - Fork 244
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
jest not happy with 3.0.1 #209
Comments
Hi, I just made a cjs project with a small test. Interestingly the test works without complaints in mocha.
Due to the observed I would image that jest is not (yet) capable to resolve the package.json exports as used by astronomia. Those work according to See https://nodejs.org/dist/latest-v14.x/docs/api/esm.html#esm_resolution_algorithm under PACKAGE_IMPORTS_EXPORTS_RESOLVE. I think the related issue is jestjs/jest#11167 For the moment I would suggest to maintain v2 and v3 of this project. |
I had a simular problem while impot import * as Holidays from 'date-holidays';
There is way to completely exclude |
I've run into the same issue as @hosuaby , when running Cypress integration tests on a Vite + Vue 3 project. Here's the error message:
A breakdown of what's happening: Starting from the bottom, a file in my project calls
However, it should be trying to find this file at either:
The I'm able to make things work by manually adding a import base from './src/base'
export default base But obviously this isn't a long-term solution. I'm guessing something is misconfigured somewhere, but I don't know nearly enough about ES Modules/CommonJS to go any further. Any thoughts, @commenthol? |
Disregard my last comment! I upgraded |
@michaelhays Closed. |
I confirm that
But changing import by fixes the problem: import Holidays from 'date-holidays/src'; Infortunatly, |
Hi @hosuaby, may I ask why you think that v3.3.0 still relies on CommonJs? |
If I import it as following, the import is resolved to the file import Holidays from 'date-holidays'; If I change the import like that, the import will be resolved by source import Holidays from 'date-holidays/src'; |
On my side, I had the following error:
If fixed it by adding this to {
transformIgnorePatterns: [
"node_modules/(?!(astronomia)/)"
]
} |
Hey I still have this problem, tried with the solution suggested above seems working:
If I change to import
|
Add a module mapper into jest.config.js solved my problem: moduleNameMapper: {
"astronomia/data(.*)$": "<rootDir>/node_modules/astronomia/lib/data$1.cjs",
}, |
I got error
The text was updated successfully, but these errors were encountered: