8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
test/sequential
1 parent 952c08a commit 674befeCopy full SHA for 674befe
test/eslint.config_partial.mjs
@@ -177,6 +177,7 @@ export default [
177
'pummel',
178
'report',
179
'sea',
180
+ 'sequential',
181
'sqlite',
182
'system-ca',
183
'test426',
test/sequential/test-child-process-execsync.js
@@ -147,9 +147,9 @@ const args = [
147
assert.strictEqual(typeof err.pid, 'number');
148
spawnSyncKeys
149
.filter((key) => key !== 'pid')
150
- .forEach((key) => {
+ .forEach(common.mustCallAtLeast((key) => {
151
assert.deepStrictEqual(err[key], spawnSyncResult[key]);
152
- });
+ }));
153
return true;
154
});
155
}
test/sequential/test-child-process-pass-fd.js
@@ -21,7 +21,7 @@ const N = 80;
21
let messageCallbackCount = 0;
22
23
function forkWorker() {
24
- const messageCallback = (msg, handle) => {
+ const messageCallback = common.mustCall((msg, handle) => {
25
messageCallbackCount++;
26
assert.strictEqual(msg, 'handle');
27
assert.ok(handle);
@@ -32,11 +32,11 @@ function forkWorker() {
32
recvData += data;
33
}));
34
35
- handle.on('end', () => {
+ handle.on('end', common.mustCall(() => {
36
assert.strictEqual(recvData, 'hello');
37
worker.kill();
38
39
- };
+ });
40
41
const worker = fork(__filename, ['child']);
42
worker.on('error', (err) => {
@@ -70,13 +70,13 @@ if (process.argv[2] !== 'child') {
70
// thus no work to do, and will exit immediately, preventing process leaks.
71
process.on('message', common.mustCall());
72
73
- const server = net.createServer((c) => {
74
- process.once('message', (msg) => {
+ const server = net.createServer(common.mustCall((c) => {
+ process.once('message', common.mustCall((msg) => {
75
assert.strictEqual(msg, 'got');
76
c.end('hello');
77
78
socketConnected();
79
- }).unref();
+ })).unref();
80
server.listen(0, common.localhostIPv4, () => {
81
const { port } = server.address();
82
socket = net.connect(port, common.localhostIPv4, socketConnected).unref();
test/sequential/test-cluster-send-handle-large-payload.js
@@ -23,10 +23,9 @@ if (cluster.isPrimary) {
server.listen(0, common.mustCall(() => {
const port = server.address().port;
const socket = new net.Socket();
- socket.connect(port, (err) => {
- assert.ifError(err);
+ socket.connect(port, common.mustSucceed(() => {
28
worker.send({ payload }, socket);
29
30
31
} else {
process.on('message', common.mustCall(({ payload: received }, handle) => {
test/sequential/test-debugger-pid.js
@@ -11,7 +11,7 @@ const { spawn } = require('child_process');
11
12
const script = fixtures.path('debugger', 'alive.js');
13
14
-const runTest = async () => {
+(async () => {
15
const target = spawn(process.execPath, [script]);
16
const cli = startCLI(['-p', `${target.pid}`], [], {}, { randomPort: false });
17
@@ -24,12 +24,8 @@ const runTest = async () => {
cli.output,
/> 3 {3}\+\+x;/,
'marks the 3rd line');
- } catch (error) {
- assert.ifError(error);
} finally {
await cli.quit();
target.kill();
-};
-
-runTest().then(common.mustCall());
+})().then(common.mustCall());
test/sequential/test-deprecation-flags.js
@@ -20,7 +20,7 @@
20
// USE OR OTHER DEALINGS IN THE SOFTWARE.
'use strict';
-require('../common');
+const common = require('../common');
const fixtures = require('../common/fixtures');
const assert = require('assert');
const execFile = require('child_process').execFile;
@@ -40,49 +40,43 @@ const normal = [depmod];
const noDep = ['--no-deprecation', depmod];
const traceDep = ['--trace-deprecation', depmod];
43
-execFile(node, normal, function(er, stdout, stderr) {
+execFile(node, normal, common.mustSucceed((stdout, stderr) => {
44
console.error('normal: show deprecation warning');
45
- assert.strictEqual(er, null);
46
assert.strictEqual(stdout, '');
47
assert.match(stderr, /this function is deprecated/);
48
console.log('normal ok');
49
-});
+}));
50
51
-execFile(node, noDep, function(er, stdout, stderr) {
+execFile(node, noDep, common.mustSucceed((stdout, stderr) => {
52
console.error('--no-deprecation: silence deprecations');
53
54
55
assert.strictEqual(stderr.trim(), 'This is deprecated');
56
console.log('silent ok');
57
58
59
-execFile(node, traceDep, function(er, stdout, stderr) {
+execFile(node, traceDep, common.mustSucceed((stdout, stderr) => {
60
console.error('--trace-deprecation: show stack');
61
62
63
const stack = stderr.trim().split('\n');
64
// Just check the top and bottom.
65
assert.match(stack[1], /this function is deprecated/);
66
assert.match(stack[0], /This is deprecated/);
67
console.log('trace ok');
68
69
-execFile(node, [depUserlandFunction], function(er, stdout, stderr) {
+execFile(node, [depUserlandFunction], common.mustSucceed((stdout, stderr) => {
console.error('normal: testing deprecated userland function');
assert.match(stderr, /deprecatedFunction is deprecated/);
console.error('normal: ok');
-execFile(node, [depUserlandClass], function(er, stdout, stderr) {
+execFile(node, [depUserlandClass], common.mustSucceed((stdout, stderr) => {
assert.match(stderr, /deprecatedClass is deprecated/);
83
84
-execFile(node, [depUserlandSubClass], function(er, stdout, stderr) {
85
+execFile(node, [depUserlandSubClass], common.mustSucceed((stdout, stderr) => {
86
87
88
test/sequential/test-dgram-pingpong.js
@@ -14,17 +14,17 @@ function pingPongTest(port, host) {
throw e;
- server.on('listening', function() {
+ server.on('listening', common.mustCall(() => {
18
console.log(`server listening on ${port}`);
19
const client = dgram.createSocket('udp4');
- client.on('message', function(msg) {
+ client.on('message', common.mustCall((msg) => {
assert.strictEqual(msg.toString('ascii'), 'PONG');
client.close();
server.close();
client.on('error', function(e) {
@@ -37,7 +37,7 @@ function pingPongTest(port, host) {
clientSend();
server.bind(port, host);
return server;
test/sequential/test-fs-readdir-recursive.js
@@ -134,11 +134,11 @@ function assertDirents(dirents) {
134
assert.strictEqual(dirents.length, expected.length);
135
dirents.sort((a, b) => (getDirentPath(a) < getDirentPath(b) ? -1 : 1));
136
assert.deepStrictEqual(
137
- dirents.map((dirent) => {
+ dirents.map(common.mustCallAtLeast((dirent) => {
138
assert(dirent instanceof fs.Dirent);
139
assert.notStrictEqual(dirent.name, undefined);
140
return getDirentPath(dirent);
141
- }),
+ })),
142
expected
143
);
144
test/sequential/test-heapdump-flag-custom-dir.js
@@ -7,7 +7,7 @@ if (common.isWindows)
7
8
9
10
-const validateHeapSnapshotFile = () => {
+if (process.argv[2] === 'child') {
const fs = require('fs');
assert.strictEqual(process.listenerCount('SIGUSR2'), 1);
@@ -31,10 +31,6 @@ const validateHeapSnapshotFile = () => {
JSON.parse(fs.readFileSync(files[i]));
})();
-if (process.argv[2] === 'child') {
- validateHeapSnapshotFile();
// Modify the timezone. So we can check the file date string still returning correctly.
process.env.TZ = 'America/New_York';
test/sequential/test-http-econnrefused.js
@@ -32,20 +32,20 @@ const common = require('../common');
const http = require('http');
-const server = http.createServer(function(req, res) {
+const server = http.createServer(common.mustCallAtLeast((req, res) => {
let body = '';
req.setEncoding('utf8');
req.on('data', function(chunk) {
body += chunk;
- req.on('end', function() {
+ req.on('end', common.mustCall(() => {
assert.strictEqual(body, 'PING');
res.writeHead(200, { 'Connection': 'close' });
res.end('PONG');
server.on('listening', pingping);
@@ -109,36 +109,36 @@ function ping() {
109
method: 'POST'
110
};
111
112
- const req = http.request(opt, function(res) {
+ const req = http.request(opt, common.mustCallAtLeast((res) => {
113
114
115
res.setEncoding('utf8');
116
res.on('data', function(chunk) {
117
118
119
120
- res.on('end', function() {
+ res.on('end', common.mustCall(() => {
121
assert.strictEqual(body, 'PONG');
122
assert.ok(!hadError);
123
gotEnd = true;
124
afterPing('success');
125
126
+ }, 0));
127
128
req.end('PING');
129
130
let gotEnd = false;
131
let hadError = false;
132
133
- req.on('error', function(error) {
+ req.on('error', common.mustCallAtLeast((error) => {
console.log(`Error making ping req: ${error}`);
hadError = true;
assert.ok(!gotEnd);
// Family autoselection might be skipped if only a single address is returned by DNS.
const actualError = Array.isArray(error.errors) ? error.errors[0] : error;
afterPing(actualError.message);