-
-
Notifications
You must be signed in to change notification settings - Fork 487
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 working with 2.0.0-alpha.2 #236
Comments
Hi, @anthonyvialleton. Thanks for the report. It seems that Jest (or, basically, the testing environment) doesn't work with ES2015 imports.
Please, let me know if it works for you. |
@anthonyvialleton, just noticed your update with the configuration for Jest. It seems you should try to fix the |
Hi @lancedikson, Here is my webpack
I tried this
But it fails when running tests :
|
@anthonyvialleton I guess, you should replace |
I'll try to make it easier with splitting the compiled file into 2 pieces: the one with polyfills and another one with the whole bowser. It would help you, just to include the |
I also have this problem with the latest version of bowser, that it uses an
I fixed it by importing 'bowser/dist/bowser.compiled' instead. Should I use the aforementioned file or 'bowser/compiled' if I don't want to transpile my server-side JavaScript? I feel as if it shouldn't be necessary to use Babel on the server side. |
Yeah, definitely! You should use |
@anthonyvialleton, I have good news. No need to include bowser in your building process. Just use |
Effectively importing bowser in that way solved the issue :
Thanks |
@anthonyvialleton please, be careful with |
@lancedikson hope you finally have something suitable then ;) Thanks ! |
Using
:( |
Hmm, it seems, you're using |
No I'm not...
Same using |
Ok, for some reason UglifyJS thinks that your project imports bowser as it is and requires the source files. So, the exception is not caused by exactly this piece of code, but by some building system, which takes sources instead of the bundled files. |
No I'm not using Bowser anywhere else and my production Webpack UglifyJS config is :
|
Hmm, ok, still not clear. Let's debug :) Could you, please, open your |
I can't see the console.log in terminal, it's like Webpack is not showing it... Here is my build-js-prod yarn command :
I tried adding I figured out that, commenting the bowser import on my file wasn't enough to stop the error. I had to Here is my Webpack core configuration :
|
@anthonyvialleton, that's weird. Ok, you can try to debug the building process using |
@lancedikson When trying to run the debugger using I get this error :
Remote debugging shutdowns directly.. |
@anthonyvialleton, yes, and this is normal. You don't have to debug the source files of bowser. It's better to debug the building system, your |
@lancedikson sadly it takes too much time to build and the debugger is never triggered on the debugging server Chrom Dev Tools console... A pain in the ass tbh to debug... |
@anthonyvialleton, gotcha. I think you could have a workaround. Try redefining |
@lancedikson replacing Thanks for the support ! |
@anthonyvialleton, cool! I'm glad to hear that. Yeah, the next release will definitely change that problem. It'll be today or tomorrow, I guess. Have a great day! |
@anthonyvialleton, you can subscribe to this issue: #239 and you will get a notification, when it's closed :) |
Hello,
In order to get the fix from Google phones I upgraded to 2.0.0-alpha.2 but now I face an other issue.
My unit tests are failing when I test a shallow rendering of a component which imports my utils functions wich import bowser.
If I switch back to the 2.0.0-alpha.1 everything is ok...
I use :
Here is the Jest's error stacktrace :
My Jest transformer configuration is configured to ignore node_modules as follow :
so I'm not really understanding what happens there
The text was updated successfully, but these errors were encountered: