avajs/ava

Add a `--node-arguments` flags #2090

GMartigny posted onGitHub

Description

It could be useful to be able to de define the flags of the Node process running AVA. A comment by @novemberborn scratch the surface, but apparently it never got raised as a request. Any compatible Node flag could be listed.

Adding the --nodeArgs``--node-args--node-arguments to AVA could allow the user to execute Node with some needed flags. (eg: ava --node-arguments --experimental-report) It should also be available as an AVA config property:

{
  "ava": {
    "nodeArguments": [
      "--experimental-report",
      "- --custom-arg"
    ]
  }
}

Test Source

process.execArgv.includes("--experimental-policy"); // <= Never true

Environment

  • Ubuntu v16.04
  • Node v11.9.0
  • AVA v1.4.1

Thanks for opening this, @GMartigny. Should it be --node-args though?

posted by novemberborn almost 6 years ago

@novemberborn, yes you're right since --update-snapshots and --reset-cache are kebab-case.

posted by GMartigny almost 6 years ago

I would prefer --node-arguments. You don't really gain much from shortening it.

It should also be possible to set it as a AVA config property.

posted by sindresorhus almost 6 years ago

It should also be possible to set it as a AVA config property

As a string, an array or both ?

posted by GMartigny almost 6 years ago

It should also be possible to set it as a AVA config property

As a string, an array or both ?

Array.

Are there use cases for specifying these flags as a one-off when you run AVA through the CLI, or should we only support them as a config property, since you'd want to use them all the time?

posted by novemberborn almost 6 years ago

I would say both. For example, you get a warning that you're using a deprecated Node.js API, but it doesn't show a stack trace, so you need to pass in a certain CLI argument to Node.js to force it to show where the warning came from. You only need that once.

posted by sindresorhus almost 6 years ago

Are there use cases for specifying these flags as a one-off when you run AVA through the CLI

Off the top of my head, I see a difference between running test locally and through CI. Maybe for environment purpose too like no having the same flags on different node versions.

posted by GMartigny almost 6 years ago

@issuehunt has funded $60.00 to this issue.


posted by IssueHuntBot almost 6 years ago

@sindresorhus has rewarded $54.00 to @maximelkin. See it on IssueHunt

  • :moneybag: Total deposit: $60.00
  • :tada: Repository reward(0%): $0.00
  • :wrench: Service fee(10%): $6.00
posted by issuehunt-app[bot] about 5 years ago

Fund this Issue

$60.00
Rewarded

Rewarded pull request

Recent activities

maximelkin was rewarded by sindresorhus for avajs/ava# 2090
about 5 years ago
sindresorhus submitted an output to  avajs/ ava# 2090
about 5 years ago