I am using a specific task runner to execute my node scripts called Yoshi. I want to run a script from package.json, for example, yoshi test but with a custom environment variable (for example special_variable):
"scripts": {
"start": "yoshi start",
"test": "special_variable=value yoshi test // this case"
}
FOO=bar- I fail to see what makes your variable any more special thanNODE_ENV? If you're using a Bash shell you can check this by usingprintenvin an npm-script. For instance:"list-env-vars" : "FOO=bar printenv", then runnpm run list-env-varsand you'll seeFOO=barlisted as an env variable.