klen / nvim-test

A Neovim wrapper for running tests
MIT License
183 stars 26 forks source link

[Feature Request] Allow passing environment variables to the runner #7

Closed dhruvmanila closed 2 years ago

dhruvmanila commented 2 years ago

Some test runners can take configuration via environment variables as well. For example, vusted can take VUSTED_NVIM and VUSTED_ARGS.

We can pass those variables in the cmd field like so:

{ cmd = "VUSTED_ARGS='--headless --clean' vusted" }

But I think it would be better to provide native support like so:

{
  env = {
    VUSTED_ARGS = '--headless --clean',
  },
  cmd = 'vusted',
}

Internally, the env field will be converted to key=value string pairs and prefixed to the cmd field.

This is just a thought, it's ok if rejected :)

klen commented 2 years ago

@dhruvmanila it's kinda easy to implement. Done for v0.6.0

klen commented 2 years ago

you may setup it for a test runner:

require('nvim-test.runners.vusted'):setup {
  env = { VUSTED_ARGS = "--headless --clean" }
}