-
Notifications
You must be signed in to change notification settings - Fork 459
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
glamorous: Cannot read property 'div' of undefined #182
Comments
Thanks for the thorough report :) Can you try adding |
@screendriver I cloned the repo and executed
|
Thank you for the quick response |
@screendriver that's weird |
@screendriver can you try updating {
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"allowSyntheticDefaultImports": true,
"noImplicitAny": false,
"sourceMap": false,
"jsx": "react"
}
} |
That's really weird 😳 🤔 {
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"allowSyntheticDefaultImports": true,
"noImplicitAny": false,
"sourceMap": false,
"jsx": "react"
}
} does not change anything unfortunately 😞 |
after changing this, did you run jest with |
Just tested this - |
Oh my god! You are right! 💃 🎉 Thank you so much @kulshekhar and @ds300 It's working now! 😎 The only thing I'm getting now is
but this is not related to |
This is true of However, this does raise an interesting question as to whether we should add a ts-jest specific config setting for this feature, rather than using |
I'm sure I am not the only one with this issue in the future 😉 So yes, I would add a |
I think it's safe to use If someone is using such imports, not transpiling further with babel will throw an error because Jest won't know how to process that. |
First: I created the same issue at Jest jestjs/jest#3374 because I don't know if it's TypeScript or Jest related. I hope anyone can help me out of this. I just copy the same text as in the Jest issue for simplicity.
Do you want to request a feature or report a bug?
I think this is a bug.
What is the current behavior?
If the current behavior is a bug, please provide the steps to reproduce and either a repl.it demo through https://repl.it/languages/jest or a minimal repository on GitHub that we can
yarn install
andyarn test
.I've made a repo here. Just run
yarn install && yarn test
. In my webpack production build the code runs. It only crashes when I run it in Jest.I believe it has anything to do that
glamorous
definesmodule
andjsnext:main
in their package.json and webpack evaluates the flags and can interpret the exports and imports correctly. The defaultmain
points to a CommonJS package. TypeScripts however transpiles my test code toand crashes because
.default
does not exist. It should look likeSo I am not sure if this is TypeScript or Jest related. But as webpack is doing everything right I think this is Jest related.
What is the expected behavior?
It should run the test.
Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.
I set up a sample project where you can reproduce it easily.
The text was updated successfully, but these errors were encountered: