js-dxtools / webpack-validator

Validates your webpack config with Joi
MIT License
295 stars 29 forks source link

'npm run test' not working on windows #130

Closed nyrosmith closed 5 years ago

nyrosmith commented 8 years ago

Win 10 x64 node: 4.4.7. I have also tried with node 6.3.1. (current)

It seems that mocha freezes when running the tests. All I get is

webpack-validator@ test E:\webpack-validator
cross-env NODE_ENV=test mocha "src/**/*.test.js"
  ......................................

and then it hangs forever. I am really not sure if it is a problem in the scripts or mocha itself. Help would be really appreciated...

kentcdodds commented 8 years ago

Hmmm... I got it working (on my mac) without trouble. Maybe there's a specific test that has problems. Could you see if you can find the hanging test?

nyrosmith commented 8 years ago

Need to do binary search to detect the potential test. Let me see if I find something suspicious.

nyrosmith commented 8 years ago

I could tackle the problem down to this line Nothing after const nodeModuleFolder = findNodeModules({ cwd: path_, relative: false })[0] executes. The problematic test whith the problem causing config is this one

My approach is to adjust the testConfigs to provide valid absolute paths if ENV === windows. Any thoughts about this solution @kentcdodds @jonathanewerner ?

kentcdodds commented 8 years ago

I'd love to see it 👍

nyrosmith commented 8 years ago

After some hours of investigation I found the following possible solution.

This is a bigger change as I expected and it might have some tradeoffs, but otherwise I would not be able to contribute any longer which I really like...

I don't want to make that changes until you all are ok with that @kentcdodds @bebraw @jonathanewerner

bebraw commented 8 years ago

Fine by me. If you can encapsulate the path bits somewhere, that would be great.

kentcdodds commented 8 years ago

:shipit: 😄

jonathanglasmeyer commented 8 years ago

Fine by me. If you can encapsulate the path bits somewhere, that would be great.

Yea, let's extract this as test/mock/absolutePath or something.