added tests for NODE_PATH globalPaths init

This commit is contained in:
jshkurti 2015-04-16 21:08:30 +02:00
parent 5392cd2f7d
commit 2ddee3e7cd
2 changed files with 29 additions and 0 deletions

View File

@ -52,3 +52,14 @@ $pm2 start env-ecosystem.json --env production
sleep 0.5
grep "No worries!" out-env.log &> /dev/null
spec "should use deploy.production.env.TEST_VARIABLE"
$pm2 kill
$pm2 l
NODE_PATH='/test' $pm2 start local_require.js
should 'should have loaded the right globalPaths' 'restart_time: 0' 1
$pm2 kill
$pm2 l
NODE_PATH='/test2' $pm2 start local_require.js -i 1
should 'should have loaded the right globalPaths' 'restart_time: 0' 1

18
test/fixtures/local_require.js vendored Normal file
View File

@ -0,0 +1,18 @@
var paths = require('module').globalPaths;
if (Array.isArray(paths)) {
var found = false;
paths.forEach(function(elem) {
if (elem === process.env.NODE_PATH) {
found = true;
}
});
if (!found)
process.exit(1);
else
setInterval(function keepAlive() {}, 10000);
}
else {
process.exit(1);
}