Skip to content

unable to use npm-run-all with mocha and chai #168

@vboulaye

Description

@vboulaye

Hello,

I am working on a test project with the default svelte template that uses npm-run-all.

I encountered a strange issue when adding mocha+chai to the package.json.
It fails when running tests using npm test with Error: Cannot find module 'expect.js'

Removing the npm-run-all dependency makes the problem disappear (mocha and chai are installed).

I made a small project to reproduce it: https://github.com/vboulaye/npm-run-all-test

The full error stack is the following:

/home/user/dev/misc/npm-run-all-test/ko/node_modules/yargs/yargs.js:1163
      else throw err
           ^

Error: Cannot find module 'expect.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
    at Function.Module._load (internal/modules/cjs/loader.js:506:25)
    at Module.require (internal/modules/cjs/loader.js:636:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/home/user/dev/misc/npm-run-all-test/ko/node_modules/memorystream/test/memorystream.test.js:2:14)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    at Function.Module._load (internal/modules/cjs/loader.js:529:3)
    at Module.require (internal/modules/cjs/loader.js:636:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at /home/user/dev/misc/npm-run-all-test/ko/node_modules/mocha/lib/mocha.js:330:36
    at Array.forEach (<anonymous>)
    at Mocha.loadFiles (/home/user/dev/misc/npm-run-all-test/ko/node_modules/mocha/lib/mocha.js:327:14)
    at Mocha.run (/home/user/dev/misc/npm-run-all-test/ko/node_modules/mocha/lib/mocha.js:804:10)
    at Object.exports.singleRun (/home/user/dev/misc/npm-run-all-test/ko/node_modules/mocha/lib/cli/run-helpers.js:207:16)
    at exports.runMocha (/home/user/dev/misc/npm-run-all-test/ko/node_modules/mocha/lib/cli/run-helpers.js:300:13)
    at Object.exports.handler.argv [as handler] (/home/user/dev/misc/npm-run-all-test/ko/node_modules/mocha/lib/cli/run.js:296:3)
    at Object.runCommand (/home/user/dev/misc/npm-run-all-test/ko/node_modules/yargs/lib/command.js:242:26)
    at Object.parseArgs [as _parseArgs] (/home/user/dev/misc/npm-run-all-test/ko/node_modules/yargs/yargs.js:1087:28)
    at Object.parse (/home/user/dev/misc/npm-run-all-test/ko/node_modules/yargs/yargs.js:566:25)
    at Object.exports.main (/home/user/dev/misc/npm-run-all-test/ko/node_modules/mocha/lib/cli/cli.js:63:6)
    at Object.<anonymous> (/home/user/dev/misc/npm-run-all-test/ko/node_modules/mocha/bin/_mocha:10:23)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    at Function.Module._load (internal/modules/cjs/loader.js:529:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:741:12)
    at startup (internal/bootstrap/node.js:285:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)
npm ERR! Test failed.  See above for more details.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions