mocha-webpack
mocha-webpack copied to clipboard
Compatibility issue with webpack > 4.28.3
Since the compile error generally seems to come up on webpack 4 compatibility issues I post this issue here. Hope this is right ;) I encountered the error when I run "mocha-webpack" (with mocha-webpack ^1.1.0 and webpack 4.28.4). This doesn't happen with webpack 4.28.3.
Error: Chunk.parents: Use ChunkGroup.getParents() instead
at Chunk.get (/home/my/code/node_modules/webpack/lib/Chunk.js:827:9)
at /home/my/code/node_modules/mocha-webpack/lib/webpack/util/sortChunks.js:24:15
at Array.forEach (<anonymous>)
at sortChunks (/home/my/code/node_modules/mocha-webpack/lib/webpack/util/sortChunks.js:23:10)
at getBuildStats (/home/my/code/node_modules/mocha-webpack/lib/webpack/util/getBuildStats.js:28:47)
at TestRunner.prepareMocha (/home/my/code/node_modules/mocha-webpack/lib/runner/TestRunner.js:141:52)
at /home/my/code/node_modules/mocha-webpack/lib/runner/TestRunner.js:193:36
at /home/my/code/node_modules/mocha-webpack/lib/webpack/compiler/registerReadyCallback.js:26:7
at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/my/code/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:18:1)
at AsyncSeriesHook.lazyCompileHook (/home/my/code/node_modules/tapable/lib/Hook.js:154:20)
at emitRecords.err (/home/my/code/node_modules/webpack/lib/Compiler.js:261:22)
at Compiler.emitRecords (/home/my/code/node_modules/webpack/lib/Compiler.js:375:39)
at emitAssets.err (/home/my/code/node_modules/webpack/lib/Compiler.js:255:10)
at hooks.afterEmit.callAsync.err (/home/my/code/node_modules/webpack/lib/Compiler.js:361:14)
at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/my/code/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:20:1)
at AsyncSeriesHook.lazyCompileHook (/home/my/code/node_modules/tapable/lib/Hook.js:154:20)
at asyncLib.forEach.err (/home/my/code/node_modules/webpack/lib/Compiler.js:358:27)
at /home/my/code/node_modules/neo-async/async.js:2825:7
at done (/home/my/code/node_modules/neo-async/async.js:2861:11)
at /home/my/code/node_modules/neo-async/async.js:2813:7
at MemoryFileSystem.writeFile (/home/my/code/node_modules/memory-fs/lib/MemoryFileSystem.js:328:9)
at writeOut (/home/my/code/node_modules/webpack/lib/Compiler.js:342:29)
at Immediate._onImmediate (/home/my/code/node_modules/memory-fs/lib/MemoryFileSystem.js:288:4)
at processImmediate (timers.js:632:19)```
My project is fairly simple so until this is fixed for the latest webpack, my workaround is to use nodemon
:
"scripts": {
"build": "webpack --target node --mode production",
"test": "npm run build && mocha",
"test:watch": "nodemon -i dist/ --exec npm test"
},
I have the same error with Webpack 4.28.4 UPD: This fork doesn't have the problem. https://github.com/sysgears/mochapack
Same here. Mochapack doesn't look more active. 1 contributor. 1 version. 1 commit. Version 2.0.0-beta.0 fixes the problem so I guess that's the reason why mochapack works as well.
Reporting the same error as well. Trying to follow the instructions for testing a Vue project which uses Laravel mix.
Fix: npm i mocha-webpack@next