codymikol / karma-webpack

Karma webpack Middleware
MIT License
830 stars 222 forks source link

'The "path" argument must be of type string' since 4.0.0-rc.1 #363

Closed ara4n closed 5 years ago

ara4n commented 6 years ago

Actual Behavior

Karma crashes out shortly after launch with:

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type object
    at assertPath (path.js:39:11)
    at Object.join (path.js:1157:7)
    at Plugin.<anonymous> (/Users/matthew/workspace/vector-web/node_modules/karma-webpack/lib/karma-webpack.js:286:70)
    at Plugin.readFile (/Users/matthew/workspace/vector-web/node_modules/karma-webpack/lib/karma-webpack.js:305:5)
    at process._tickCallback (internal/process/next_tick.js:61:11)

4.0.0-beta.0 is okay; but rc.1 and rc.2 exhibit the problem.

Looks like a regression in https://github.com/webpack-contrib/karma-webpack/commit/ab4dde9a7b859e815e11925a0f5cc5c986360264 which happens when stats.assetsByChunkName[entry] returns an array of assets rather than a single asset. Then when calculating the tmp filename to be read, path.join() crashes out because it's trying to concatenate an array rather than a string.

In this instance (https://github.com/vector-im/riot-web/tree/matthew/webpack4) it's because the test/all-tests.js entryPath has two assets: bundles/d918c3aa7df7ca65ad57/test/all-tests.js and bundles/d918c3aa7df7ca65ad57/test/all-tests.css.

wilkie commented 6 years ago

I've even gotten something like this where it gave that error in 3.0.5 (but tells me it "Received type undefined") but not when I downgraded to 3.0.0 (which is the version I'm using on a different project) where it all works just fine.

From my own very rudimentary debugging... there is some kind of "outputs" array that isn't generated properly (and not used at all in 3.0.0) and I'm not sure why.

bluepnume commented 6 years ago

Any traction on this one? I'm attempting to upgrade to webpack 4 and having problems getting karma working with karma-webpack rc.2

Ivaylo-Lafchiev commented 6 years ago

I am also having the same problem. Everything after karma-webpack@3.0.0 doesn't work because of the above error (or variations of it), with either karma@1.7.1 or karma@latest.

thijstriemstra commented 6 years ago

see #361

matthieu-foucault commented 5 years ago

Fixed in #361 and released. Use npm i -D karma-webpack@next to update.

chrisnicola commented 5 years ago

I still see this intermittently on rc.6.

johnny-mh commented 5 years ago

@matthieu-foucault I still see this issue on rc.6

matthieu-foucault commented 5 years ago

Sorry but my focus isn't on this project at the moment, and likely won't be in the future. You'll have to find someone else willing to maintain it.

Ivaylo-Lafchiev commented 5 years ago

Sorry but my focus isn't on this project at the moment, and likely won't be in the future. You'll have to find someone else willing to maintain it.

What does this mean for the future of Karma? Should we be moving to something like Jest?

matthieu-foucault commented 5 years ago

Jest definitely has more support at the moment. I've been helping on this plugin for a few months and been the only one making releases.

On Sat, Mar 23, 2019, 10:22 Ivaylo Lafchiev notifications@github.com wrote:

Sorry but my focus isn't on this project at the moment, and likely won't be in the future. You'll have to find someone else willing to maintain it.

What does this mean for the future of Karma? Should we be moving to something like Jest?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/webpack-contrib/karma-webpack/issues/363#issuecomment-475888367, or mute the thread https://github.com/notifications/unsubscribe-auth/ACj0drvHucIULBA51-3DGUsZPqVOFLjXks5vZmLPgaJpZM4W5zN6 .