Skip to content

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

@torbjornvatn

Description

@torbjornvatn

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions