node/test/parallel/test-process-exit-recursive.js
Rich Trott 02fe8215f0 test: load common.js to test for global leaks
common.js contains code that checks for variables leaking into the
global namespace. Load common.js in all tests that do not
intentionally leak variables.

PR-URL: https://github.com/nodejs/node/pull/3095
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2015-10-01 20:16:35 -07:00

17 lines
352 B
JavaScript

'use strict';
require('../common');
var assert = require('assert');
// recursively calling .exit() should not overflow the call stack
var nexits = 0;
process.on('exit', function(code) {
assert.equal(nexits++, 0);
assert.equal(code, 1);
// now override the exit code of 1 with 0 so that the test passes
process.exit(0);
});
process.exit(1);