mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 21:58:48 +02:00
test: split up and refactor test-domain
Split up test-domain into multiple, more focused test files and use more modern JS inside of them. PR-URL: https://github.com/nodejs/node/pull/13614 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
parent
c81fd7c5ea
commit
1a2f579ba0
12 changed files with 263 additions and 275 deletions
26
test/parallel/test-domain-multiple-errors.js
Normal file
26
test/parallel/test-domain-multiple-errors.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
'use strict';
|
||||
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const domain = require('domain');
|
||||
|
||||
// This test is similar to test-domain-error-types, but uses a single domain
|
||||
// to emit all errors.
|
||||
|
||||
const d = new domain.Domain();
|
||||
|
||||
const values = [
|
||||
42, null, undefined, false, () => {}, 'string', Symbol('foo')
|
||||
];
|
||||
|
||||
d.on('error', common.mustCall((err) => {
|
||||
assert(values.includes(err));
|
||||
}, values.length));
|
||||
|
||||
for (const something of values) {
|
||||
d.run(common.mustCall(() => {
|
||||
process.nextTick(common.mustCall(() => {
|
||||
throw something;
|
||||
}));
|
||||
}));
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue