Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check whether it a test running under AVA, or in normal env

I'm using AVA to run my tests. I use a config.js file at the root and I'd like it to be different when running test units. For example the path to the databases, in production ~/.app/data.db would be /tmp/<randomid>/data.db while testing. With mocha I'd just check for it existence but here I can't

like image 389
Vinz243 Avatar asked Nov 09 '22 08:11

Vinz243


1 Answers

I am using the NODE_ENV variable to load different configs for production, staging and development. Works like a charm.

Read this article to get you started with a nice setup: http://eng.datafox.co/nodejs/2014/09/28/nodejs-config-best-practices/

like image 122
Niels van Reijmersdal Avatar answered Nov 15 '22 06:11

Niels van Reijmersdal