Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit b0b9163

Browse files
committedJan 1, 2016
test: clarify role of domains in test
Add a comment to clarify how the tests work and their purpose. Also removes unnecessary assignment of domain module to a variable. PR-URL: #4474 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Julien Gilli <[email protected]>
1 parent 1170b26 commit b0b9163

3 files changed

+21
-3
lines changed
 

‎test/parallel/test-microtask-queue-integration-domain.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
'use strict';
22
require('../common');
33
var assert = require('assert');
4-
var domain = require('domain');
4+
5+
// Requiring the domain module here changes the function that is used by node to
6+
// call process.nextTick's callbacks to a variant that specifically handles
7+
// domains. We want to test this specific variant in this test, and so even if
8+
// the domain module is not used, this require call is needed and must not be
9+
// removed.
10+
require('domain');
511

612
var implementations = [
713
function(fn) {

‎test/parallel/test-microtask-queue-run-domain.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
'use strict';
22
require('../common');
33
var assert = require('assert');
4-
var domain = require('domain');
4+
5+
// Requiring the domain module here changes the function that is used by node to
6+
// call process.nextTick's callbacks to a variant that specifically handles
7+
// domains. We want to test this specific variant in this test, and so even if
8+
// the domain module is not used, this require call is needed and must not be
9+
// removed.
10+
require('domain');
511

612
function enqueueMicrotask(fn) {
713
Promise.resolve().then(fn);

‎test/parallel/test-microtask-queue-run-immediate-domain.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
'use strict';
22
require('../common');
33
var assert = require('assert');
4-
var domain = require('domain');
4+
5+
// Requiring the domain module here changes the function that is used by node to
6+
// call process.nextTick's callbacks to a variant that specifically handles
7+
// domains. We want to test this specific variant in this test, and so even if
8+
// the domain module is not used, this require call is needed and must not be
9+
// removed.
10+
require('domain');
511

612
function enqueueMicrotask(fn) {
713
Promise.resolve().then(fn);

0 commit comments

Comments
 (0)
Please sign in to comment.