codymikol / karma-webpack

Karma webpack Middleware
MIT License
830 stars 222 forks source link

fix(karma-webpack): normalize paths (`windows`) #351

Closed Teamop closed 6 years ago

Teamop commented 6 years ago

With #347 changes, now get error: TypeError: Path must be a string. Received undefined. After my research, there are 3 places will throw this error:

  1. Two in the readFile, L311, L337, both are this.outputs.get(file) --- the changes I made here is to map the file path to the entry path, so that can getting the file from the outputs. Example, changes from test\unit\karma-test-shim to test/unit/karma-test-shim

  2. One in the createPreprocesor L386, this line webpackPlugin.outputs.get(filename); --- for this one, the file is already the real file path, if replaced with the webpack stats one, the karma web server cannot find the file 404. Example here, changes from C:/project/test/unit/karma-test-shim.js to C:\project\test\unit\karma-test-shim.js

Type

Issues

SemVer

thijstriemstra commented 6 years ago

Seeing similar error after upgrading to RC1:

03 09 2018 20:55:24.766:ERROR [karma]: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string
    at assertPath (path.js:39:11)
    at Object.join (path.js:1158:7)
    at Plugin.<anonymous> (/home/foo/projects/bar/node_modules/karma-webpack/lib/karma-webpack.js:284:70)
    at Plugin.readFile (/home/foo/projects/bar/node_modules/karma-webpack/lib/karma-webpack.js:303:5)
    at process._tickCallback (internal/process/next_tick.js:176:11)
michael-ciniawsky commented 6 years ago

Released in 4.0.0-rc.2 🎉