Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

cli bad option: --inspect --max-old-space-size=4096 #3853

Closed
4 tasks done
stoically opened this issue Mar 30, 2019 · 3 comments
Closed
4 tasks done

cli bad option: --inspect --max-old-space-size=4096 #3853

stoically opened this issue Mar 30, 2019 · 3 comments
Assignees
Labels
area: node.js command-line-or-Node.js-specific type: bug a defect, confirmed by a maintainer

Comments

@stoically
Copy link

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

Executing of mocha --inspect --max-old-space-size=4096 results in the cli responding with a bad option error.

Steps to Reproduce

See description.

Expected behavior: [What you expect to happen]

Should not result in bad option.

Actual behavior: [What actually happens]

Results in bad option.

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

100%

Versions

  • The output of mocha --version and node node_modules/.bin/mocha --version: 6.0.2
  • The output of node --version: v10.15.3
  • Your operating system
    • name and version: Ubuntu 18.04 LTS
    • architecture (32 or 64-bit): 64bit
  • 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): none
@plroebuck plroebuck added type: bug a defect, confirmed by a maintainer area: node.js command-line-or-Node.js-specific and removed unconfirmed-bug labels Mar 31, 2019
@plroebuck plroebuck self-assigned this Mar 31, 2019
@plroebuck
Copy link
Contributor

Believe this was already fixed in as-yet-unreleased PR #3788.
The code from the routine below was incorrectly combining multiple arguments into a single string.

You can patch your version of Mocha by changing unparseNodeFlags in "lib/cli/node-flags.js" to be:

exports.unparseNodeFlags = opts => {
  var args = unparse(opts);
  return args.length
    ? args
        .join(' ')
        .split(/\b/)
        .map(arg => (arg === ' ' ? '=' : arg))
        .join('')
        .split(' ')        // <- add this line
    : [];
};

@plroebuck
Copy link
Contributor

Closing this issue as already fixed, to be released in Mocha-6.1.
If the above patch does not address your problem, reply as such and I'll reopen this.

@stoically
Copy link
Author

Can confirm, it works with #3787 in place. Thanks!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
area: node.js command-line-or-Node.js-specific type: bug a defect, confirmed by a maintainer
Projects
None yet
Development

No branches or pull requests

2 participants