privatenumber / instant-mocha

☕️ Build tests with Webpack and run with Mocha in one command
MIT License
47 stars 6 forks source link

ValidationError: configuration.entry['unmatchedFiles'] should be a non-empty array #53

Open unlight opened 1 month ago

unlight commented 1 month ago

Bug description

instant-mocha throws error

ValidationError: Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
 - configuration.entry['unmatchedFiles'] should be a non-empty array.
   -> All modules are loaded upon startup. The last one is exported.
    at validate (\node_modules\.pnpm\schema-utils@3.3.0\node_modules\schema-utils\dist\validate.js:191:11)
    at validateSchema (\node_modules\.pnpm\webpack@5.93.0_@swc+core@1.7.6_@swc+helpers@0.5.12__webpack-cli@5.1.4\node_modules\webpack\lib\validateSchema.js:78:2)
    at create (\node_modules\.pnpm\webpack@5.93.0_@swc+core@1.7.6_@swc+helpers@0.5.12__webpack-cli@5.1.4\node_modules\webpack\lib\webpack.js:130:24)
    at webpack (\node_modules\.pnpm\webpack@5.93.0_@swc+core@1.7.6_@swc+helpers@0.5.12__webpack-cli@5.1.4\node_modules\webpack\lib\webpack.js:182:32)
    at Object.f [as default] (\node_modules\.pnpm\webpack@5.93.0_@swc+core@1.7.6_@swc+helpers@0.5.12__webpack-cli@5.1.4\node_modules\webpack\lib\index.js:75:16)
    at ge (\node_modules\.pnpm\instant-mocha@1.5.2_mocha@10.7.0_webpack@5.93.0_@swc+core@1.7.6_@swc+helpers@0.5.12__webpack-cli@5.1.4_\node_modules\instant-mocha\dist\cli.js:6:1935)
    at be (\node_modules\.pnpm\instant-mocha@1.5.2_mocha@10.7.0_webpack@5.93.0_@swc+core@1.7.6_@swc+helpers@0.5.12__webpack-cli@5.1.4_\node_modules\instant-mocha\dist\cli.js:6:3232)
    at async Object.handler (\node_modules\.pnpm\instant-mocha@1.5.2_mocha@10.7.0_webpack@5.93.0_@swc+core@1.7.6_@swc+helpers@0.5.12__webpack-cli@5.1.4_\node_modules\instant-mocha\dist\cli.js:6:3990) {
  errors: [
    {
      keyword: 'anyOf',
      dataPath: '.entry',
      schemaPath: '#/anyOf',
      params: {},
      message: 'should match some schema in anyOf',
      schema: [Array],
      parentSchema: [Object],
      data: [Object],
      children: [Array]
    }
  ],

Reproduction

git clone https://github.com/privatenumber/instant-mocha cd instant-mocha/tests/fixture // copy tests to test pnpx instant-mocha

Node.js package manager

pnpm

Environment

mocha 10

Node is crossplatform

Can you contribute a fix?

privatenumber commented 1 month ago

Thanks for the issue, PR welcome!

unlight commented 4 days ago

There is no issue with mocha 9