Search code examples
buster.js

How can I pass env vars to buster.js?


I have a buster.js test. I need to pass some data to the test via an environment variable. How can I do this?


Solution

  • You mean when launching it at the command line?

    I've just realized the question was made the '14, anyway: Run any node.js application along with the variable assignment, e.g:

    VARIABLE_NAME='FOO' buster-test file.js

    In the code:

    process.env.VARIABLE_NAME;