Skip to content

Commit 66bf924

Browse files
committed
fixup! test: ensure assertions are reached on more tests
1 parent 53d78fa commit 66bf924

File tree

5 files changed

+12
-10
lines changed

5 files changed

+12
-10
lines changed

test/eslint.config_partial.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ export default [
194194
].join(',')}}/**/*.{js,mjs,cjs}`,
195195
`test/parallel/test-{${
196196
// 0x61 is code for 'a', this generates a string enumerating latin letters: 'a*,b*,…'
197-
Array.from({ length: 6 }, (_, i) => String.fromCharCode(0x61 + i, 42)).join(',')
197+
Array.from({ length: 7 }, (_, i) => String.fromCharCode(0x61 + i, 42)).join(',')
198198
},${
199199
// 0x61 is code for 'a', this generates a string enumerating latin letters: 'z*,y*,…'
200200
Array.from({ length: 5 }, (_, i) => String.fromCharCode(0x61 + 25 - i, 42)).join(',')

test/parallel/test-gc-net-timeout.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// just like test-gc-http-client-timeout.js,
44
// but using a net server/client instead
55

6-
require('../common');
6+
const common = require('../common');
77
const { onGC } = require('../common/gc');
88
const assert = require('assert');
99
const net = require('net');
@@ -18,9 +18,9 @@ function serverHandler(sock) {
1818
sock.on('end', function() {
1919
clearTimeout(timer);
2020
});
21-
sock.on('error', function(err) {
21+
sock.on('error', common.mustCallAtLeast((err) => {
2222
assert.strictEqual(err.code, 'ECONNRESET');
23-
});
23+
}, 0));
2424
const timer = setTimeout(function() {
2525
sock.end('hello\n');
2626
}, 100);

test/parallel/test-global-console-exists.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ process.on('warning', () => {
1717
// process warning writes to the console, which will
1818
// invoke the monkeypatched process.stderr.write
1919
// below.
20+
// eslint-disable-next-line node-core/must-call-assert
2021
assert.strictEqual(writeTimes, 1);
2122
EventEmitter.defaultMaxListeners = oldDefault;
2223
warningTimes++;
@@ -28,6 +29,7 @@ process.on('exit', () => {
2829

2930
process.stderr.write = (data) => {
3031
if (writeTimes === 0)
32+
// eslint-disable-next-line node-core/must-call-assert
3133
assert.match(data, leakWarning);
3234
else
3335
assert.fail('stderr.write should be called only once');

test/parallel/test-global-customevent.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
'use strict';
33

44
require('../common');
5-
const { strictEqual, ok } = require('node:assert');
5+
const assert = require('node:assert');
66
const { CustomEvent: internalCustomEvent } = require('internal/event_target');
77

88
// Global
9-
ok(CustomEvent);
9+
assert.ok(CustomEvent);
1010

11-
strictEqual(CustomEvent, internalCustomEvent);
11+
assert.strictEqual(CustomEvent, internalCustomEvent);
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
'use strict';
22

33
require('../common');
4-
const { strictEqual } = require('assert');
4+
const assert = require('assert');
55
const util = require('util');
66

7-
strictEqual(TextDecoder, util.TextDecoder);
8-
strictEqual(TextEncoder, util.TextEncoder);
7+
assert.strictEqual(TextDecoder, util.TextDecoder);
8+
assert.strictEqual(TextEncoder, util.TextEncoder);

0 commit comments

Comments
 (0)