mirror of
https://github.com/nodejs/node.git
synced 2025-05-05 15:32:15 +00:00

common.js needs to be loaded in all tests so that there is checking for variable leaks and possibly other things. However, it does not need to be assigned to a variable if nothing in common.js is referred to elsewhere in the test. PR-URL: https://github.com/nodejs/node/pull/4408 Reviewed-By: James M Snell <jasnell@gmail.com>
28 lines
651 B
JavaScript
28 lines
651 B
JavaScript
'use strict';
|
|
require('../common');
|
|
var assert = require('assert');
|
|
|
|
var spawnSync = require('child_process').spawnSync;
|
|
|
|
var TIMER = 200;
|
|
var SLEEP = 5000;
|
|
|
|
switch (process.argv[2]) {
|
|
case 'child':
|
|
setTimeout(function() {
|
|
console.log('child fired');
|
|
process.exit(1);
|
|
}, SLEEP);
|
|
break;
|
|
default:
|
|
var start = Date.now();
|
|
var ret = spawnSync(process.execPath, [__filename, 'child'],
|
|
{timeout: TIMER});
|
|
assert.strictEqual(ret.error.errno, 'ETIMEDOUT');
|
|
console.log(ret);
|
|
var end = Date.now() - start;
|
|
assert(end < SLEEP);
|
|
assert(ret.status > 128 || ret.signal);
|
|
break;
|
|
}
|