-
Notifications
You must be signed in to change notification settings - Fork 75
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
Cannot read property getFiles of undefined 1.0.0.beta.0/1 #127
Comments
So what was the fix ? @jamespedid |
Unfortunately I ended up abandoning mocha-webpack for the time being, however it wasn't the issue because I manually recreated the issue in a different way and found out some configuration issues. However, the way I'm running it now is much faster than mocha-webpack at runtime, especially with JSDOM tests. We also found it useful to simply use null-loaders for things like CSS and such to load these kinds of files, which was an improvement. Lastly, there was a few odd whitelists that we had to do with nodeExternals to make things work properly with how we were using things. Here's a few things that I found relevant:
const context = require.context(__dirname, true, /\.test\.js/);
context.keys().forEach(context);
module.exports = context; For running the tests with parameters, we ended up using a bash script that looks sort of like this. We always output to the same test-bundle.js file and ran it with mocha. We used the source-map-support/register directly when using mocha. #!/bin/bash -ex
if [[ $1 ]]; then
webpack --progress --colors --config webpack.config.test.js $1 && mocha --colors --require source-map-support/register .tmp/test-bundle.js
else
webpack --progress --colors --config webpack.config.test.js test/test-context.js && mocha --colors --require source-map-support/register .tmp/test-bundle.js
fi The test execution time for ~700 tests dropped from to 3s from a much more significant chunk of time. I'm can't recall what was the biggest contributing factor, but something in our combination didn't work well with mocha-webpack |
@jamespedid What was the configuration issue with |
I'm having the same issue when trying to hook this into Laravel Mix (even with a fresh Laravel 5.5 install). I have posted a comment there but was advised to post it here instead (see post below from the Laracasts website). I know this is still in beta so hoping that this can be fixed asap. ( |
@barnabaskecskes can you create a repo to reproduce this? |
I have the same problem as @barnabaskecskes . EDIT: I also solved it by using "mocha-webpack": "^0.7.0" instead of "v1.0.0". In my NPM test script, I have tested using wild cards for files and folders to be tested, and that works too in "v0.7.0" . |
Would be handy if @zinserjan could fix this as I'm having #45 error now, which has been implemented in the beta version that currently fails for us. :) |
Should be fixed with 1.0.1 |
@zinserjan @fshequin Indeed it is fixed now. Thanks a ton! |
Also fixed for me now too, that was fast for a weekend.....thank you @zinserjan |
#125
Hello; I'm trying to run mocha-webpack on 1.0.0.beta.0, and it seems that the webpack build process is failing with the following message:
Tracking it down, it seems like you're calling a getFiles on some config object, but it's not clear to me how this object should be provided, and it's preventing the tests from running. Any suggestions on how to fix this?
Thanks!
EDIT: I tracked it down to be a problem with the webpack.config.test.js file that I have. Maybe this can be detected and thrown an error if something here is wrong.
The text was updated successfully, but these errors were encountered: