Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1d3ef11

Browse filesBrowse files
kuriyoshdanielleadams
authored andcommitted
test: improve test coverage of internal/worker/io
PR-URL: #41511 Refs: https://coverage.nodejs.org/coverage-74b9baa4265a8f0d/lib/internal/worker/io.js.html#L415 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
1 parent 39f52e1 commit 1d3ef11
Copy full SHA for 1d3ef11

File tree

Expand file treeCollapse file tree

1 file changed

+40
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+40
-0
lines changed
Open diff view settings
Collapse file
+40Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
'use strict';
2+
3+
require('../common');
4+
const { BroadcastChannel } = require('worker_threads');
5+
const { inspect } = require('util');
6+
const assert = require('assert');
7+
8+
// This test checks BroadcastChannel custom inspect outputs
9+
10+
{
11+
const bc = new BroadcastChannel('name');
12+
assert.throws(() => bc[inspect.custom].call(), {
13+
code: 'ERR_INVALID_THIS',
14+
});
15+
bc.close();
16+
}
17+
18+
{
19+
const bc = new BroadcastChannel('name');
20+
assert.strictEqual(inspect(bc, { depth: -1 }), 'BroadcastChannel');
21+
bc.close();
22+
}
23+
24+
{
25+
const bc = new BroadcastChannel('name');
26+
assert.strictEqual(
27+
inspect(bc),
28+
"BroadcastChannel { name: 'name', active: true }"
29+
);
30+
bc.close();
31+
}
32+
33+
{
34+
const bc = new BroadcastChannel('name');
35+
assert.strictEqual(
36+
inspect(bc, { depth: null }),
37+
"BroadcastChannel { name: 'name', active: true }"
38+
);
39+
bc.close();
40+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.