karma-webpack: TypeError: Path must be a string. Received [ 'js/main.spec.js',
x「wdm」: wait until bundle finished: noop 03 09 2018 10:51:35.026:ERROR [karma]: TypeError: Path must be a string. Received [ 'js/main.spec.js', 'css/tiscc.min.css', 'js/main.spec.js.map', 'css/tiscc.min.css.map' ] at assertPath (path.js:28:11) at Object.join (path.js:1236:7) at Plugin.<anonymous> (/builds/tis/tis/tiscommandcenter/node_modules/karma-webpack/lib/karma-webpack.js:262:68) at Plugin.readFile (/builds/tis/tis/tiscommandcenter/node_modules/karma-webpack/lib/karma-webpack.js:281:5) at _combinedTickCallback (internal/process/next_tick.js:131:7) at process._tickCallback (internal/process/next_tick.js:180:9)
- Operating System: Windows 10
- Node Version: v8.11.3
- NPM Version: 6.4.0
- webpack Version: 4.17.1
- karma-webpack Version: 3.0.2
Code
https://gist.github.com/casufi/f298bcab3f2f95a82616591446e380de
How Do We Reproduce?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 24
- Comments: 36 (4 by maintainers)
Commits related to this issue
- fix web tests running on windows platform * by reverting broken "karma-webpack" 3.0.2=>3.0.1, https://github.com/webpack-contrib/karma-webpack/issues/350 — committed to vladimiry/ElectronMail by vladimiry 6 years ago
- Updates karma to latest. Could not update karma-webpack to latest as it was not running because of an error: The "path" argument must be of type string. Received type object https://github.com/webpac... — committed to jitsi/lib-jitsi-meet by damencho 6 years ago
- Updates karma to latest. Could not update karma-webpack to latest as it was not running because of an error: The "path" argument must be of type string. Received type object https://github.com/webpac... — committed to jitsi/lib-jitsi-meet by damencho 6 years ago
- Updates karma to latest. Could not update karma-webpack to latest as it was not running because of an error: The "path" argument must be of type string. Received type object https://github.com/webpac... — committed to jitsi/lib-jitsi-meet by damencho 6 years ago
- Set devtool to none to avoid https://github.com/webpack-contrib/karma-webpack/issues/350 Not sure yet of any side effects. — committed to jp7677/hellocoreclr by jp7677 6 years ago
- fix web tests running on windows platform * by reverting broken "karma-webpack" 3.0.2=>3.0.1, https://github.com/webpack-contrib/karma-webpack/issues/350 — committed to devDefiWeb/electron-mail-app by devDefiWeb 6 years ago
Note to maintainer: let us test your fixes first instead of putting out new buggy releases?
@rythos42 3.0.0 is working fine for me.
I’m still seeing the same issue on
3.0.4(tests succeed on3.0.0):the problem is it is this line:
https://github.com/webpack-contrib/karma-webpack/blob/d2f5a538d864e7b1f4bb431324de67be1ccbb51d/src/karma-webpack.js#L255
The problem is not line 255 itself, that is just where it occurs.
fileis a file system path that is normalized to the operating system, meaning the path seperator on Windows is\BUT the keys inthis.outputsalways uses the forward slash/regardless of the operating system. so the result ofthis.outputs[file]will always be undefined.This will always be a problem on Windows. It will just happen to work on POSIX systems, but its fragile.
It appears this is a new issue. I was recently using
3.0.0without any problems, when someone went to review my code"karma-webpack": "^3.0.0"in package.json resolved to3.0.2and the errors started.Same issue in 3.0.5, so staying on 3.0.0. Mac and linux OSes
Er, I’m still getting the same error reported by the OP in 3.0.3
Confirming that this is still an issue on 3.0.5 running Ubuntu 16.04 and 18.04.
Yep, setting ‘devtool’ to ‘none’ fixed this issue for me.
@thijstriemstra hope it helps
Fixed “path” error with
var webpackConfig = require('./build-config/webpack.prod.main.js'); webpackConfig.devtool = 'none';in karma.conf.jsDeprecationWarning is gone with
"karma-webpack": "^4.0.0-rc.2"Or revert regressions. 🤔
@thijstriemstra I get the same error on karma-webpack 3.0.2. Make sure you install version 3.0.0 exactly. Delete your node_modules and lock files, re-install your npm dependencies, and retry.
Will get a fix out asap
This can be encountered if a preprocessor beforehand has already produced multiple outputs, too.
For example, sourcemaps preprocessing will result in
['foo.js', 'foo.js.map'].