javascript - Setting variables in global 'before' in mocha? -


say have following directory hierarchy:

 project/     actualproject.js     test/       hooks.js       testsforfeature1.js       testsforfeature2.js   

in hooks.js, have 'before' function. in function, setup, call function on server, , id back. want take id , pass testsforfeature1.js , testsforfeature2.js. there way this?

i write value file somewhere, , read file in each test, not seem correct way this.

use environment variabls

process.env.id=value //to set environment variable

and

id=process.env.id // id in other files


Comments