| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -195,7 +195,7 @@ export default [ | |||
| 195 | 195 | `test/parallel/test-{${ | |
| 196 | 196 | // 0x61 is code for 'a', this generates a string enumerating latin letters: 'a*,b*,…' | |
| 197 | 197 | Array.from({ length: 13 }, (_, i) => String.fromCharCode(0x61 + i, 42)).join(',') | |
| 198 | - },${ | ||
| 198 | + },n*,${ | ||
| 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 | |
|---|---|---|---|
@@ -36,10 +36,10 @@ const { getNavigatorPlatform } = require('internal/navigator'); | |||
| 36 | 36 | const { execFile } = require('child_process'); | |
| 37 | 37 | ||
| 38 | 38 | const is = { | |
| 39 | - number: (value, key) => { | ||
| 39 | + number: common.mustCallAtLeast((value, key) => { | ||
| 40 | 40 | assert(!Number.isNaN(value), `${key} should not be NaN`); | |
| 41 | 41 | assert.strictEqual(typeof value, 'number'); | |
| 42 | - }, | ||
| 42 | + }), | ||
| 43 | 43 | }; | |
| 44 | 44 | ||
| 45 | 45 | is.number(+navigator.hardwareConcurrency, 'hardwareConcurrency'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,12 +10,12 @@ const { createConnection, createServer } = require('net'); | |||
| 10 | 10 | ||
| 11 | 11 | // Test that IPV4 is NOT reached if IPV6 is not reachable and the option has been disabled via command line | |
| 12 | 12 | { | |
| 13 | - const ipv4Server = createServer((socket) => { | ||
| 13 | + const ipv4Server = createServer(common.mustCallAtLeast((socket) => { | ||
| 14 | 14 | socket.on('data', common.mustCall(() => { | |
| 15 | 15 | socket.write('response-ipv4'); | |
| 16 | 16 | socket.end(); | |
| 17 | 17 | })); | |
| 18 | - }); | ||
| 18 | + }, 0)); | ||
| 19 | 19 | ||
| 20 | 20 | ipv4Server.listen(0, '127.0.0.1', common.mustCall(() => { | |
| 21 | 21 | const port = ipv4Server.address().port; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,12 +10,12 @@ const autoSelectFamilyAttemptTimeout = common.defaultAutoSelectFamilyAttemptTime | |||
| 10 | 10 | ||
| 11 | 11 | // Test that IPV4 is reached by default if IPV6 is not reachable and the default is enabled | |
| 12 | 12 | { | |
| 13 | - const ipv4Server = createServer((socket) => { | ||
| 13 | + const ipv4Server = createServer(common.mustCall((socket) => { | ||
| 14 | 14 | socket.on('data', common.mustCall(() => { | |
| 15 | 15 | socket.write('response-ipv4'); | |
| 16 | 16 | socket.end(); | |
| 17 | 17 | })); | |
| 18 | - }); | ||
| 18 | + })); | ||
| 19 | 19 | ||
| 20 | 20 | ipv4Server.listen(0, '127.0.0.1', common.mustCall(() => { | |
| 21 | 21 | setDefaultAutoSelectFamily(true); | |
@@ -45,12 +45,12 @@ const autoSelectFamilyAttemptTimeout = common.defaultAutoSelectFamilyAttemptTime | |||
| 45 | 45 | ||
| 46 | 46 | // Test that IPV4 is not reached by default if IPV6 is not reachable and the default is disabled | |
| 47 | 47 | { | |
| 48 | - const ipv4Server = createServer((socket) => { | ||
| 48 | + const ipv4Server = createServer(common.mustCallAtLeast((socket) => { | ||
| 49 | 49 | socket.on('data', common.mustCall(() => { | |
| 50 | 50 | socket.write('response-ipv4'); | |
| 51 | 51 | socket.end(); | |
| 52 | 52 | })); | |
| 53 | - }); | ||
| 53 | + }, 0)); | ||
| 54 | 54 | ||
| 55 | 55 | ipv4Server.listen(0, '127.0.0.1', common.mustCall(() => { | |
| 56 | 56 | setDefaultAutoSelectFamily(false); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,12 +8,12 @@ const { createConnection, createServer } = require('net'); | |||
| 8 | 8 | ||
| 9 | 9 | // Test that happy eyeballs algorithm is properly implemented when a A record is returned first. | |
| 10 | 10 | if (common.hasIPv6) { | |
| 11 | - const ipv4Server = createServer((socket) => { | ||
| 11 | + const ipv4Server = createServer(common.mustCall((socket) => { | ||
| 12 | 12 | socket.on('data', common.mustCall(() => { | |
| 13 | 13 | socket.write('response-ipv4'); | |
| 14 | 14 | socket.end(); | |
| 15 | 15 | })); | |
| 16 | - }); | ||
| 16 | + })); | ||
| 17 | 17 | ||
| 18 | 18 | const ipv6Server = createServer((socket) => { | |
| 19 | 19 | socket.on('data', common.mustNotCall(() => { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,12 +16,12 @@ const autoSelectFamilyAttemptTimeout = common.defaultAutoSelectFamilyAttemptTime | |||
| 16 | 16 | ||
| 17 | 17 | // Test that IPV4 is reached if IPV6 is not reachable | |
| 18 | 18 | { | |
| 19 | - const ipv4Server = createServer((socket) => { | ||
| 19 | + const ipv4Server = createServer(common.mustCall((socket) => { | ||
| 20 | 20 | socket.on('data', common.mustCall(() => { | |
| 21 | 21 | socket.write('response-ipv4'); | |
| 22 | 22 | socket.end(); | |
| 23 | 23 | })); | |
| 24 | - }); | ||
| 24 | + })); | ||
| 25 | 25 | ||
| 26 | 26 | ipv4Server.listen(0, '127.0.0.1', common.mustCall(() => { | |
| 27 | 27 | const port = ipv4Server.address().port; | |
@@ -56,12 +56,12 @@ const autoSelectFamilyAttemptTimeout = common.defaultAutoSelectFamilyAttemptTime | |||
| 56 | 56 | ||
| 57 | 57 | // Test that only the last successful connection is established. | |
| 58 | 58 | { | |
| 59 | - const ipv4Server = createServer((socket) => { | ||
| 59 | + const ipv4Server = createServer(common.mustCall((socket) => { | ||
| 60 | 60 | socket.on('data', common.mustCall(() => { | |
| 61 | 61 | socket.write('response-ipv4'); | |
| 62 | 62 | socket.end(); | |
| 63 | 63 | })); | |
| 64 | - }); | ||
| 64 | + })); | ||
| 65 | 65 | ||
| 66 | 66 | ipv4Server.listen(0, '127.0.0.1', common.mustCall(() => { | |
| 67 | 67 | const port = ipv4Server.address().port; | |
@@ -116,12 +116,12 @@ if (common.hasIPv6) { | |||
| 116 | 116 | })); | |
| 117 | 117 | }); | |
| 118 | 118 | ||
| 119 | - const ipv6Server = createServer((socket) => { | ||
| 119 | + const ipv6Server = createServer(common.mustCall((socket) => { | ||
| 120 | 120 | socket.on('data', common.mustCall(() => { | |
| 121 | 121 | socket.write('response-ipv6'); | |
| 122 | 122 | socket.end(); | |
| 123 | 123 | })); | |
| 124 | - }); | ||
| 124 | + })); | ||
| 125 | 125 | ||
| 126 | 126 | ipv4Server.listen(0, '127.0.0.1', common.mustCall(() => { | |
| 127 | 127 | const port = ipv4Server.address().port; | |
@@ -184,12 +184,12 @@ if (common.hasIPv6) { | |||
| 184 | 184 | ||
| 185 | 185 | // Test that the option can be disabled | |
| 186 | 186 | { | |
| 187 | - const ipv4Server = createServer((socket) => { | ||
| 187 | + const ipv4Server = createServer(common.mustCallAtLeast((socket) => { | ||
| 188 | 188 | socket.on('data', common.mustCall(() => { | |
| 189 | 189 | socket.write('response-ipv4'); | |
| 190 | 190 | socket.end(); | |
| 191 | 191 | })); | |
| 192 | - }); | ||
| 192 | + }, 0)); | ||
| 193 | 193 | ||
| 194 | 194 | ipv4Server.listen(0, '127.0.0.1', common.mustCall(() => { | |
| 195 | 195 | const port = ipv4Server.address().port; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -35,10 +35,10 @@ if (process.argv[2] === 'child') { | |||
| 35 | 35 | } | |
| 36 | 36 | }); | |
| 37 | 37 | ||
| 38 | - conn.on('error', (err) => { | ||
| 38 | + conn.on('error', common.mustCallAtLeast((err) => { | ||
| 39 | 39 | // Error emitted on Windows. | |
| 40 | 40 | assert.strictEqual(err.code, 'ECONNRESET'); | |
| 41 | - }); | ||
| 41 | + }, 0)); | ||
| 42 | 42 | ||
| 43 | 43 | conn.on('connect', common.mustCall(() => { | |
| 44 | 44 | cp.kill('SIGKILL'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -18,14 +18,14 @@ server.listen(0, common.mustCall(async () => { | |||
| 18 | 18 | }); | |
| 19 | 19 | }); | |
| 20 | 20 | ||
| 21 | - const assertAbort = async (socket, testName) => { | ||
| 21 | + const assertAbort = common.mustCallAtLeast(async (socket, testName) => { | ||
| 22 | 22 | try { | |
| 23 | 23 | await once(socket, 'close'); | |
| 24 | 24 | assert.fail(`close ${testName} should have thrown`); | |
| 25 | 25 | } catch (err) { | |
| 26 | 26 | assert.strictEqual(err.name, 'AbortError'); | |
| 27 | 27 | } | |
| 28 | - }; | ||
| 28 | + }); | ||
| 29 | 29 | ||
| 30 | 30 | async function postAbort() { | |
| 31 | 31 | const ac = new AbortController(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,11 +8,6 @@ const truthyValues = [true, 1, 'true', {}, []]; | |||
| 8 | 8 | const delays = [[123, 0], [456123, 456], [-123000, 0], [undefined, 0]]; | |
| 9 | 9 | const falseyValues = [false, 0, '']; | |
| 10 | 10 | ||
| 11 | - const genSetKeepAlive = (desiredEnable, desiredDelay) => (enable, delay) => { | ||
| 12 | - assert.strictEqual(enable, desiredEnable); | ||
| 13 | - assert.strictEqual(delay, desiredDelay); | ||
| 14 | - }; | ||
| 15 | - | ||
| 16 | 11 | for (const value of truthyValues) { | |
| 17 | 12 | for (const delay of delays) { | |
| 18 | 13 | const server = net.createServer(); | |
@@ -26,7 +21,10 @@ for (const value of truthyValues) { | |||
| 26 | 21 | ); | |
| 27 | 22 | ||
| 28 | 23 | client._handle.setKeepAlive = common.mustCall( | |
| 29 | - genSetKeepAlive(true, delay[1]) | ||
| 24 | + (enable, actualDelay) => { | ||
| 25 | + assert.strictEqual(enable, true); | ||
| 26 | + assert.strictEqual(actualDelay, delay[1]); | ||
| 27 | + }, | ||
| 30 | 28 | ); | |
| 31 | 29 | ||
| 32 | 30 | client.on('end', common.mustCall(function() { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -50,9 +50,9 @@ const gcListener = { ongc() { collected = true; } }; | |||
| 50 | 50 | ||
| 51 | 51 | function done(sock) { | |
| 52 | 52 | globalThis.gc(); | |
| 53 | - setImmediate(() => { | ||
| 53 | + setImmediate(common.mustCall(() => { | ||
| 54 | 54 | assert.strictEqual(collected, true); | |
| 55 | 55 | sock.end(); | |
| 56 | 56 | server.close(); | |
| 57 | - }); | ||
| 57 | + })); | ||
| 58 | 58 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments