mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
f29762f4dd
Enable linting for the test directory. A number of changes was made so all tests conform the current rules used by lib and src directories. The only exception for tests is that unreachable (dead) code is allowed. test-fs-non-number-arguments-throw had to be excluded from the changes because of a weird issue on Windows CI. PR-URL: https://github.com/nodejs/io.js/pull/1721 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
39 lines
592 B
JavaScript
39 lines
592 B
JavaScript
'use strict';
|
|
var common = require('../common');
|
|
var assert = require('assert');
|
|
|
|
function enqueueMicrotask(fn) {
|
|
Promise.resolve().then(fn);
|
|
}
|
|
|
|
var done = 0;
|
|
|
|
process.on('exit', function() {
|
|
assert.equal(done, 2);
|
|
});
|
|
|
|
// no nextTick, microtask
|
|
setImmediate(function() {
|
|
enqueueMicrotask(function() {
|
|
done++;
|
|
});
|
|
});
|
|
|
|
|
|
// no nextTick, microtask with nextTick
|
|
setImmediate(function() {
|
|
var called = false;
|
|
|
|
enqueueMicrotask(function() {
|
|
process.nextTick(function() {
|
|
called = true;
|
|
});
|
|
});
|
|
|
|
setImmediate(function() {
|
|
if (called)
|
|
done++;
|
|
});
|
|
|
|
});
|