| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -194,8 +194,8 @@ export default [ | |||
| 194 | 194 | ].join(',')}}/**/*.{js,mjs,cjs}`, | |
| 195 | 195 | `test/parallel/test-{${ | |
| 196 | 196 | // 0x61 is code for 'a', this generates a string enumerating latin letters: 'a*,b*,…' | |
| 197 | - Array.from({ length: 7 }, (_, i) => String.fromCharCode(0x61 + i, 42)).join(',') | ||
| 198 | - },http-*,http2-*,${ | ||
| 197 | + Array.from({ length: 13 }, (_, i) => String.fromCharCode(0x61 + i, 42)).join(',') | ||
| 198 | + },${ | ||
| 199 | 199 | // 0x61 is code for 'a', this generates a string enumerating latin letters: 'z*,y*,…' | |
| 200 | 200 | Array.from({ length: 5 }, (_, i) => String.fromCharCode(0x61 + 25 - i, 42)).join(',') | |
| 201 | 201 | }}.{js,mjs,cjs}`, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -69,9 +69,7 @@ function client() { | |||
| 69 | 69 | rejectUnauthorized: false, | |
| 70 | 70 | ALPNProtocols: ['h2'] | |
| 71 | 71 | }, () => { | |
| 72 | - client.end(Buffer.concat(h2fstStream.map((s) => Buffer.from(s, 'base64'))), (err) => { | ||
| 73 | - assert.ifError(err); | ||
| 74 | - }); | ||
| 72 | + client.end(Buffer.concat(h2fstStream.map((s) => Buffer.from(s, 'base64'))), common.mustSucceed()); | ||
| 75 | 73 | }); | |
| 76 | 74 | ||
| 77 | 75 | client.on('error', (error) => { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,25 +2,21 @@ | |||
| 2 | 2 | 'use strict'; | |
| 3 | 3 | ||
| 4 | 4 | const common = require('../common'); | |
| 5 | - const strictEqual = require('assert').strictEqual; | ||
| 5 | + const assert = require('assert'); | ||
| 6 | 6 | const { internalBinding } = require('internal/test/binding'); | |
| 7 | 7 | ||
| 8 | 8 | // child_process | |
| 9 | 9 | { | |
| 10 | 10 | const spawn = require('child_process').spawn; | |
| 11 | 11 | const cmd = common.isWindows ? 'rundll32' : 'ls'; | |
| 12 | 12 | const cp = spawn(cmd); | |
| 13 | - strictEqual(cp._handle.hasRef(), | ||
| 14 | - true, 'process_wrap: not initially refed'); | ||
| 13 | + assert.strictEqual(cp._handle.hasRef(), true); | ||
| 15 | 14 | cp.unref(); | |
| 16 | - strictEqual(cp._handle.hasRef(), | ||
| 17 | - false, 'process_wrap: unref() ineffective'); | ||
| 15 | + assert.strictEqual(cp._handle.hasRef(), false); | ||
| 18 | 16 | cp.ref(); | |
| 19 | - strictEqual(cp._handle.hasRef(), | ||
| 20 | - true, 'process_wrap: ref() ineffective'); | ||
| 17 | + assert.strictEqual(cp._handle.hasRef(), true); | ||
| 21 | 18 | cp._handle.close(common.mustCall(() => | |
| 22 | - strictEqual(cp._handle.hasRef(), | ||
| 23 | - false, 'process_wrap: not unrefed on close'))); | ||
| 19 | + assert.strictEqual(cp._handle.hasRef(), false))); | ||
| 24 | 20 | } | |
| 25 | 21 | ||
| 26 | 22 | ||
@@ -32,17 +28,13 @@ const { kStateSymbol } = require('internal/dgram'); | |||
| 32 | 28 | const sock4 = dgram.createSocket('udp4'); | |
| 33 | 29 | const handle = sock4[kStateSymbol].handle; | |
| 34 | 30 | ||
| 35 | - strictEqual(handle.hasRef(), | ||
| 36 | - true, 'udp_wrap: ipv4: not initially refed'); | ||
| 31 | + assert.strictEqual(handle.hasRef(), true); | ||
| 37 | 32 | sock4.unref(); | |
| 38 | - strictEqual(handle.hasRef(), | ||
| 39 | - false, 'udp_wrap: ipv4: unref() ineffective'); | ||
| 33 | + assert.strictEqual(handle.hasRef(), false); | ||
| 40 | 34 | sock4.ref(); | |
| 41 | - strictEqual(handle.hasRef(), | ||
| 42 | - true, 'udp_wrap: ipv4: ref() ineffective'); | ||
| 35 | + assert.strictEqual(handle.hasRef(), true); | ||
| 43 | 36 | handle.close(common.mustCall(() => | |
| 44 | - strictEqual(handle.hasRef(), | ||
| 45 | - false, 'udp_wrap: ipv4: not unrefed on close'))); | ||
| 37 | + assert.strictEqual(handle.hasRef(), false))); | ||
| 46 | 38 | } | |
| 47 | 39 | ||
| 48 | 40 | ||
@@ -51,85 +43,70 @@ const { kStateSymbol } = require('internal/dgram'); | |||
| 51 | 43 | const sock6 = dgram.createSocket('udp6'); | |
| 52 | 44 | const handle = sock6[kStateSymbol].handle; | |
| 53 | 45 | ||
| 54 | - strictEqual(handle.hasRef(), | ||
| 55 | - true, 'udp_wrap: ipv6: not initially refed'); | ||
| 46 | + assert.strictEqual(handle.hasRef(), true); | ||
| 56 | 47 | sock6.unref(); | |
| 57 | - strictEqual(handle.hasRef(), | ||
| 58 | - false, 'udp_wrap: ipv6: unref() ineffective'); | ||
| 48 | + assert.strictEqual(handle.hasRef(), false); | ||
| 59 | 49 | sock6.ref(); | |
| 60 | - strictEqual(handle.hasRef(), | ||
| 61 | - true, 'udp_wrap: ipv6: ref() ineffective'); | ||
| 50 | + assert.strictEqual(handle.hasRef(), true); | ||
| 62 | 51 | handle.close(common.mustCall(() => | |
| 63 | - strictEqual(handle.hasRef(), | ||
| 64 | - false, 'udp_wrap: ipv6: not unrefed on close'))); | ||
| 52 | + assert.strictEqual(handle.hasRef(), false))); | ||
| 65 | 53 | } | |
| 66 | 54 | ||
| 67 | 55 | ||
| 68 | 56 | // pipe | |
| 69 | 57 | { | |
| 70 | 58 | const { Pipe, constants: PipeConstants } = internalBinding('pipe_wrap'); | |
| 71 | 59 | const handle = new Pipe(PipeConstants.SOCKET); | |
| 72 | - strictEqual(handle.hasRef(), | ||
| 73 | - true, 'pipe_wrap: not initially refed'); | ||
| 60 | + assert.strictEqual(handle.hasRef(), true); | ||
| 74 | 61 | handle.unref(); | |
| 75 | - strictEqual(handle.hasRef(), | ||
| 76 | - false, 'pipe_wrap: unref() ineffective'); | ||
| 62 | + assert.strictEqual(handle.hasRef(), false); | ||
| 77 | 63 | handle.ref(); | |
| 78 | - strictEqual(handle.hasRef(), | ||
| 79 | - true, 'pipe_wrap: ref() ineffective'); | ||
| 64 | + assert.strictEqual(handle.hasRef(), true); | ||
| 80 | 65 | handle.close(common.mustCall(() => | |
| 81 | - strictEqual(handle.hasRef(), | ||
| 82 | - false, 'pipe_wrap: not unrefed on close'))); | ||
| 66 | + assert.strictEqual(handle.hasRef(), false))); | ||
| 83 | 67 | } | |
| 84 | 68 | ||
| 85 | 69 | ||
| 86 | 70 | // tcp | |
| 87 | 71 | { | |
| 88 | 72 | const net = require('net'); | |
| 89 | 73 | const server = net.createServer(() => {}).listen(0); | |
| 90 | - strictEqual(server._handle.hasRef(), | ||
| 91 | - true, 'tcp_wrap: not initially refed'); | ||
| 92 | - strictEqual(server._unref, | ||
| 93 | - false, 'tcp_wrap: _unref initially incorrect'); | ||
| 74 | + assert.strictEqual(server._handle.hasRef(), true); | ||
| 75 | + assert.strictEqual(server._unref, false); | ||
| 94 | 76 | server.unref(); | |
| 95 | - strictEqual(server._handle.hasRef(), | ||
| 96 | - false, 'tcp_wrap: unref() ineffective'); | ||
| 97 | - strictEqual(server._unref, | ||
| 98 | - true, 'tcp_wrap: _unref not updated on unref()'); | ||
| 77 | + assert.strictEqual(server._handle.hasRef(), false); | ||
| 78 | + assert.strictEqual(server._unref, true); | ||
| 99 | 79 | server.ref(); | |
| 100 | - strictEqual(server._handle.hasRef(), | ||
| 101 | - true, 'tcp_wrap: ref() ineffective'); | ||
| 102 | - strictEqual(server._unref, | ||
| 103 | - false, 'tcp_wrap: _unref not updated on ref()'); | ||
| 80 | + assert.strictEqual(server._handle.hasRef(), true); | ||
| 81 | + assert.strictEqual(server._unref, false); | ||
| 104 | 82 | server._handle.close(common.mustCall(() => | |
| 105 | - strictEqual(server._handle.hasRef(), | ||
| 106 | - false, 'tcp_wrap: not unrefed on close'))); | ||
| 83 | + assert.strictEqual(server._handle.hasRef(), false))); | ||
| 107 | 84 | } | |
| 108 | 85 | ||
| 109 | 86 | // timers | |
| 110 | 87 | { | |
| 111 | - strictEqual(process.getActiveResourcesInfo().filter( | ||
| 88 | + assert.strictEqual(process.getActiveResourcesInfo().filter( | ||
| 112 | 89 | (type) => type === 'Timeout').length, 0); | |
| 113 | 90 | const timeout = setTimeout(() => {}, 500); | |
| 114 | - strictEqual(process.getActiveResourcesInfo().filter( | ||
| 91 | + assert.strictEqual(process.getActiveResourcesInfo().filter( | ||
| 115 | 92 | (type) => type === 'Timeout').length, 1); | |
| 116 | 93 | timeout.unref(); | |
| 117 | - strictEqual(process.getActiveResourcesInfo().filter( | ||
| 94 | + assert.strictEqual(process.getActiveResourcesInfo().filter( | ||
| 118 | 95 | (type) => type === 'Timeout').length, 0); | |
| 119 | 96 | timeout.ref(); | |
| 120 | - strictEqual(process.getActiveResourcesInfo().filter( | ||
| 97 | + assert.strictEqual(process.getActiveResourcesInfo().filter( | ||
| 121 | 98 | (type) => type === 'Timeout').length, 1); | |
| 122 | 99 | ||
| 123 | - strictEqual(process.getActiveResourcesInfo().filter( | ||
| 100 | + assert.strictEqual(process.getActiveResourcesInfo().filter( | ||
| 124 | 101 | (type) => type === 'Immediate').length, 0); | |
| 125 | 102 | const immediate = setImmediate(() => {}); | |
| 126 | - strictEqual(process.getActiveResourcesInfo().filter( | ||
| 103 | + assert.strictEqual(process.getActiveResourcesInfo().filter( | ||
| 127 | 104 | (type) => type === 'Immediate').length, 1); | |
| 128 | 105 | immediate.unref(); | |
| 129 | - strictEqual(process.getActiveResourcesInfo().filter( | ||
| 106 | + assert.strictEqual(process.getActiveResourcesInfo().filter( | ||
| 130 | 107 | (type) => type === 'Immediate').length, 0); | |
| 131 | 108 | immediate.ref(); | |
| 132 | - strictEqual(process.getActiveResourcesInfo().filter( | ||
| 109 | + assert.strictEqual(process.getActiveResourcesInfo().filter( | ||
| 133 | 110 | (type) => type === 'Immediate').length, 1); | |
| 134 | 111 | } | |
| 135 | 112 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -31,10 +31,10 @@ async_hooks.createHook({ | |||
| 31 | 31 | if (promiseIds.includes(id)) createSnapshot(); | |
| 32 | 32 | }, | |
| 33 | 33 | ||
| 34 | - promiseResolve(id) { | ||
| 34 | + promiseResolve: common.mustCallAtLeast((id) => { | ||
| 35 | 35 | assert(promiseIds.includes(id)); | |
| 36 | 36 | createSnapshot(); | |
| 37 | - }, | ||
| 37 | + }), | ||
| 38 | 38 | ||
| 39 | 39 | destroy(id) { | |
| 40 | 40 | if (promiseIds.includes(id)) createSnapshot(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -61,7 +61,7 @@ const server = http.Server(common.mustCall((req, res) => { | |||
| 61 | 61 | }, 3)); | |
| 62 | 62 | server.listen(0); | |
| 63 | 63 | ||
| 64 | - server.on('listening', () => { | ||
| 64 | + server.on('listening', common.mustCall(() => { | ||
| 65 | 65 | const agent = new http.Agent({ port: server.address().port, maxSockets: 1 }); | |
| 66 | 66 | const req = http.get({ | |
| 67 | 67 | port: server.address().port, | |
@@ -133,4 +133,4 @@ server.on('listening', () => { | |||
| 133 | 133 | })); | |
| 134 | 134 | req.end(); | |
| 135 | 135 | }), 2); | |
| 136 | - }); | ||
| 136 | + })); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,7 +19,7 @@ const expectedHeader = /^HTTP\/1\.1 200 OK/; | |||
| 19 | 19 | const expectedBody = /hello world\n/; | |
| 20 | 20 | const expectCertError = /^UNABLE_TO_VERIFY_LEAF_SIGNATURE$/; | |
| 21 | 21 | ||
| 22 | - const checkRequest = (socket, server) => { | ||
| 22 | + function checkRequest(socket, server) { | ||
| 23 | 23 | let result = ''; | |
| 24 | 24 | socket.on('connect', common.mustCall((data) => { | |
| 25 | 25 | socket.write('GET / HTTP/1.1\r\nHost: example.com\r\n\r\n'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -36,9 +36,9 @@ const server = https.createServer({ | |||
| 36 | 36 | }); | |
| 37 | 37 | }); | |
| 38 | 38 | ||
| 39 | - const verifyKeylog = (line, tlsSocket) => { | ||
| 39 | + const verifyKeylog = common.mustCallAtLeast((line, tlsSocket) => { | ||
| 40 | 40 | assert(Buffer.isBuffer(line)); | |
| 41 | 41 | assert.strictEqual(tlsSocket.encrypted, true); | |
| 42 | - }; | ||
| 42 | + }); | ||
| 43 | 43 | server.on('keylog', common.mustCall(verifyKeylog, 10)); | |
| 44 | 44 | https.globalAgent.on('keylog', common.mustCall(verifyKeylog, 10)); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,19 +21,16 @@ const server = https.Server(options, (req, res) => { | |||
| 21 | 21 | }); | |
| 22 | 22 | ||
| 23 | 23 | ||
| 24 | - server.listen(0, function() { | ||
| 24 | + server.listen(0, common.mustCall(function() { | ||
| 25 | 25 | https.get({ | |
| 26 | 26 | path: '/', | |
| 27 | 27 | port: this.address().port, | |
| 28 | 28 | rejectUnauthorized: true, | |
| 29 | 29 | servername: 'agent1', | |
| 30 | 30 | ca: options.ca | |
| 31 | - }, (res) => { | ||
| 31 | + }, common.mustCall((res) => { | ||
| 32 | 32 | res.resume(); | |
| 33 | 33 | assert.strictEqual(res.statusCode, 200); | |
| 34 | 34 | server.close(); | |
| 35 | - }).on('error', (e) => { | ||
| 36 | - console.log(e.message); | ||
| 37 | - process.exit(1); | ||
| 38 | - }); | ||
| 39 | - }); | ||
| 35 | + })).on('error', common.mustNotCall()); | ||
| 36 | + })); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -27,7 +27,7 @@ const server = https.Server(options, function(req, res) { | |||
| 27 | 27 | res.end('hello world'); | |
| 28 | 28 | }); | |
| 29 | 29 | ||
| 30 | - server.listen(0, function() { | ||
| 30 | + server.listen(0, common.mustCall(function() { | ||
| 31 | 31 | function expectResponse(id) { | |
| 32 | 32 | return common.mustCall(function(res) { | |
| 33 | 33 | res.resume(); | |
@@ -59,4 +59,4 @@ server.listen(0, function() { | |||
| 59 | 59 | servername: '', | |
| 60 | 60 | rejectUnauthorized: false | |
| 61 | 61 | }, expectResponse(false)); | |
| 62 | - }); | ||
| 62 | + })); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -17,13 +17,13 @@ if (process.argv[2] === 'localhost') { | |||
| 17 | 17 | const net = require('net'); | |
| 18 | 18 | const server = net.createServer(); | |
| 19 | 19 | server.listen(0); | |
| 20 | - server.on('listening', () => { | ||
| 20 | + server.on('listening', common.mustCall(() => { | ||
| 21 | 21 | const port = server.address().port; | |
| 22 | 22 | const { fork } = require('child_process'); | |
| 23 | 23 | const child = fork(__filename, ['localhost', port], {}); | |
| 24 | - child.on('close', (exit_code) => { | ||
| 24 | + child.on('close', common.mustCall((exit_code) => { | ||
| 25 | 25 | server.close(); | |
| 26 | 26 | assert.strictEqual(exit_code, 0); | |
| 27 | - }); | ||
| 28 | - }); | ||
| 27 | + })); | ||
| 28 | + })); | ||
| 29 | 29 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments