mirror of
https://github.com/Unitech/pm2.git
synced 2025-12-08 20:35:53 +00:00
added tests for NODE_PATH globalPaths init
This commit is contained in:
parent
5392cd2f7d
commit
2ddee3e7cd
@ -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
18
test/fixtures/local_require.js
vendored
Normal 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);
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user