How to use Node.js global variable in mocha tests

Viewed 20868

I have got a problem with mocha tests around global object I'm using with Node.js.

In index file, I set value to global variable

// index.js
global.enums = enumTemp

export default app

And then used it in another file

// other.js

status = global.enums.object.status

It's REST API and runs well if I made a request to a server. However, when I use a Mocha test, it seems to I cannot get the value for Node.js global variable. Any idea everyone?

2 Answers
Related