GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: improve code coverage of diagnostics_channel · nodejs/node@0c710da

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/parallel
    • test-diagnostics-channel-tracing-channel-args-types.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/parallel/test-diagnostics-channel-tracing-channel-args-types.js‎

Copy file name to clipboard
+39Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
'use strict';
2+
3+
require('../common');
4+
const dc = require('diagnostics_channel');
5+
const assert = require('assert');
6+
7+
let channel;
8+
9+
// tracingChannel creating with name
10+
channel = dc.tracingChannel('test');
11+
assert.strictEqual(channel.start.name, 'tracing:test:start');
12+
13+
// tracingChannel creating with channels
14+
channel = dc.tracingChannel({
15+
start: dc.channel('tracing:test:start'),
16+
end: dc.channel('tracing:test:end'),
17+
asyncStart: dc.channel('tracing:test:asyncStart'),
18+
asyncEnd: dc.channel('tracing:test:asyncEnd'),
19+
error: dc.channel('tracing:test:error'),
20+
});
21+
22+
// tracingChannel creating without nameOrChannels must throw TypeError
23+
assert.throws(() => (channel = dc.tracingChannel(0)), {
24+
code: 'ERR_INVALID_ARG_TYPE',
25+
name: 'TypeError',
26+
message:
27+
/The "nameOrChannels" argument must be of type string or an instance of Channel or Object/,
28+
});
29+
30+
// tracingChannel creating without instance of Channel must throw error
31+
assert.throws(() => (channel = dc.tracingChannel({ start: '' })), {
32+
code: 'ERR_INVALID_ARG_TYPE',
33+
message: /The "nameOrChannels\.start" property must be an instance of Channel/,
34+
});
35+
36+
// tracingChannel creating with empty nameOrChannels must throw error
37+
assert.throws(() => (channel = dc.tracingChannel({})), {
38+
message: /Cannot convert undefined or null to object/,
39+
});

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.