avajs/ava

Add support for `--env-file=` flag for node 20 in `nodeArguments`

torbjornvatn opened this issue · 0 comments

Please provide details about:

  • What you're trying to do
    I was hoping that I could add a config like:
"nodeArguments": [
   "--env-file=.env"
],

and get access to the environments loaded by Node from that file.
--env-fileconfig

  • Why you can't use AVA for this
    Even though ava accepts the nodeArguments config above the result of running:
console.log(process.execArgv)
console.log(process.version)
console.log(process.env.DB_CONNECTION)

in a test is this:

[ '--env-file=.env', '--enable-source-maps' ]
v20.10.0
undefined
  • And maybe how you think AVA could handle this
    Would it be possible to make ava pass this on to node so it gets loaded as environment variables