Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: refactor test-next-tick-error-spin #9537

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 11 additions & 14 deletions test/sequential/test-next-tick-error-spin.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
'use strict';
var common = require('../common');
var assert = require('assert');
const common = require('../common');
const assert = require('assert');

if (process.argv[2] !== 'child') {
var spawn = require('child_process').spawn;
var child = spawn(process.execPath, [__filename, 'child'], {
const spawn = require('child_process').spawn;
const child = spawn(process.execPath, [__filename, 'child'], {
stdio: 'pipe'//'inherit'
});
var timer = setTimeout(function() {
const timer = setTimeout(function() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why can't this be an immediate?

Copy link
Member Author

@Trott Trott Nov 11, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why can't this be an immediate?

??? The test will fail if you do that (or if you reduce the timeout too much from 3000ms) because the timer will fire before the spawned process has done its thing.

throw new Error('child is hung');
}, common.platformTimeout(3000));
child.on('exit', function(code) {
console.error('ok');
assert(!code);
child.on('exit', common.mustCall(function(code) {
assert.strictEqual(code, 0);
clearTimeout(timer);
});
}));
} else {

var domain = require('domain');
var d = domain.create();
const domain = require('domain');
const d = domain.create();
process.maxTickDepth = 10;

// in the error handler, we trigger several MakeCallback events
Expand All @@ -40,10 +39,8 @@ if (process.argv[2] !== 'child') {
}

f();
setTimeout(function() {
setImmediate(function() {
console.error('broke in!');
//process.stdout.close();
//process.stderr.close();
process.exit(0);
});
}