Ava: Add a `--node-arguments` flags

Created on 16 Apr 2019  路  9Comments  路  Source: avajs/ava


Issuehunt badges

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




IssueHunt Summary

maximelkin maximelkin has been rewarded.

Backers (Total: $60.00)

Submitted pull Requests

- #2272 Allow Node arguments to be configured

Tips

IssueHunt has been backed by the following sponsors. Become a sponsor


Rewarded on Issuehunt enhancement scheduling test-environment

Most helpful comment

@issuehunt has funded $60.00 to this issue.


All 9 comments

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

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

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.

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

As a string, an array or both ?

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?

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.

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.

@issuehunt has funded $60.00 to this issue.


@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
Was this page helpful?
0 / 5 - 0 ratings