Skip to content

Custom Location is not working as expected for --config #3818

@AartiJ

Description

@AartiJ

Prerequisites

  • Checked that your issue hasn't already been filed by cross-referencing issues with the faq label
  • Checked next-gen ES issues and syntax problems by using the same environment and/or transpiler configuration without Mocha to ensure it isn't just a feature that actually isn't supported in the environment in question or a bug in your code.
  • 'Smoke tested' the code to be tested by running it outside the real test suite to get a better sense of whether the problem is in the code under test, your usage of Mocha, or Mocha itself
  • Ensured that there is no discrepancy between the locally and globally installed versions of Mocha. You can find them with: node node_modules/.bin/mocha --version(Local) and mocha --version(Global). We recommend that you not install Mocha globally.

Description

Steps to Reproduce

Expected behavior: [What you expect to happen]
config file should load from the given custom location

Actual behavior: [What actually happens]
Getting issue as below

mocha --no-opts --config node_modules/ace-api-testlib/lib/.mocharc.js --reporter mocha-allure-reporter "

/Users/ajadeja/git_test/ace-ilp-lib/node_modules/mocha/lib/cli/config.js:63
throw new Error(failed to parse ${filepath}: ${err});
^

Error: failed to parse node_modules/ace-api-testlib/lib/.mocharc.js: Error: Cannot find module 'node_modules/ace-api-testlib/lib/.mocharc.js'
at exports.loadConfig.filepath (/Users/ajadeja/git_test/ace-ilp-lib/node_modules/mocha/lib/cli/config.js:63:11)
at loadRc (/Users/ajadeja/git_test/ace-ilp-lib/node_modules/mocha/lib/cli/options.js:229:21)
at loadOptions (/Users/ajadeja/git_test/ace-ilp-lib/node_modules/mocha/lib/cli/options.js:299:20)
at Object. (/Users/ajadeja/git_test/ace-ilp-lib/node_modules/mocha/bin/mocha:29:14)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Function.Module.runMain (module.js:693:10)
npm ERR! code ELIFECYCLE

Reproduces how often: [What percentage of the time does it reproduce?]

Versions

  • The output of mocha --version and node node_modules/.bin/mocha --version:
    % mocha --version
    6.0.2

  • The output of node --version:
    % node --version
    v8.11.1

  • Your operating system

    • name and version: macOSHighSierra 10.13.6
    • architecture (32 or 64-bit):
  • Your shell (e.g., bash, zsh, PowerShell, cmd): bash

  • Your browser and version (if running browser tests):

  • Any third-party Mocha-related modules (and their versions):

  • Any code transpiler (e.g., TypeScript, CoffeeScript, Babel) being used (and its version):

Additional Information

Metadata

Metadata

Assignees

Labels

status: waiting for authorwaiting on response from OP or other posters - more information needed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions