Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Comparison test for implicit domain binding on fs module, reference for

  • Loading branch information...
commit 0b61410a4b7fe86b53d2b46452ccdac8a04930d9 1 parent 9c01e6e
@langpavel authored
Showing with 24 additions and 1 deletion.
  1. +24 −1 test/simple/test-domain-implicit-fs.js
View
25 test/simple/test-domain-implicit-fs.js
@@ -27,9 +27,10 @@ var assert = require('assert');
var domain = require('domain');
var events = require('events');
var caught = 0;
-var expectCaught = 1;
+var expectCaught = 2;
var d = new domain.Domain();
+var d2 = new domain.Domain();
var e = new events.EventEmitter();
d.on('error', function(er) {
@@ -45,6 +46,17 @@ d.on('error', function(er) {
caught++;
});
+d2.on('error', function(er) {
+ console.error('caught', er);
+
+ assert.strictEqual(er.domain, d2);
+ assert.strictEqual(er.domain_thrown, true);
+ assert.ok(!er.domain_emitter);
+ assert.strictEqual(er.message, 'TEST');
+
+ caught++;
+});
+
process.on('exit', function() {
console.error('exit');
assert.equal(caught, expectCaught);
@@ -70,3 +82,14 @@ d.run(function() {
});
}, 100);
});
+
+d2.run(function() {
+ setTimeout(function() {
+ var fs = require('fs');
+ fs.readdir(__dirname, function() {
+ fs.open('this file does not exist', 'r', function(er) {
+ throw new Error('TEST');
+ });
+ });
+ }, 100);
+});
Please sign in to comment.
Something went wrong with that request. Please try again.