| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -167,6 +167,7 @@ export default [ | |||
| 167 | 167 | 'embedding', | |
| 168 | 168 | 'fixtures', | |
| 169 | 169 | 'fuzzers', | |
| 170 | + 'internet', | ||
| 170 | 171 | 'js-native-api', | |
| 171 | 172 | 'known_issues', | |
| 172 | 173 | 'message', | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -84,7 +84,7 @@ if (process.argv[2] !== 'child') { | |||
| 84 | 84 | worker.messagesReceived = []; | |
| 85 | 85 | ||
| 86 | 86 | // Handle the death of workers | |
| 87 | - worker.on('exit', (code, signal) => { | ||
| 87 | + worker.on('exit', common.mustCall((code, signal) => { | ||
| 88 | 88 | // Don't consider this the true death if the worker | |
| 89 | 89 | // has finished successfully | |
| 90 | 90 | // or if the exit code is 0 | |
@@ -108,9 +108,9 @@ if (process.argv[2] !== 'child') { | |||
| 108 | 108 | ||
| 109 | 109 | process.exit(1); | |
| 110 | 110 | } | |
| 111 | - }); | ||
| 111 | + })); | ||
| 112 | 112 | ||
| 113 | - worker.on('message', (msg) => { | ||
| 113 | + worker.on('message', common.mustCallAtLeast((msg) => { | ||
| 114 | 114 | if (msg.listening) { | |
| 115 | 115 | listening += 1; | |
| 116 | 116 | ||
@@ -134,7 +134,7 @@ if (process.argv[2] !== 'child') { | |||
| 134 | 134 | 'required number of ' + | |
| 135 | 135 | 'messages. Will now compare.'); | |
| 136 | 136 | ||
| 137 | - Object.keys(workers).forEach((pid) => { | ||
| 137 | + for (const pid of Object.keys(workers)) { | ||
| 138 | 138 | const worker = workers[pid]; | |
| 139 | 139 | ||
| 140 | 140 | let count = 0; | |
@@ -153,14 +153,14 @@ if (process.argv[2] !== 'child') { | |||
| 153 | 153 | count); | |
| 154 | 154 | ||
| 155 | 155 | assert.strictEqual(count, messages.length); | |
| 156 | - }); | ||
| 156 | + } | ||
| 157 | 157 | ||
| 158 | 158 | clearTimeout(timer); | |
| 159 | 159 | console.error('[PARENT] Success'); | |
| 160 | 160 | killSubprocesses(workers); | |
| 161 | 161 | } | |
| 162 | 162 | } | |
| 163 | - }); | ||
| 163 | + })); | ||
| 164 | 164 | })(x); | |
| 165 | 165 | } | |
| 166 | 166 | ||
@@ -196,14 +196,13 @@ if (process.argv[2] !== 'child') { | |||
| 196 | 196 | buf.length, | |
| 197 | 197 | common.PORT, | |
| 198 | 198 | LOCAL_BROADCAST_HOST, | |
| 199 | - (err) => { | ||
| 200 | - assert.ifError(err); | ||
| 199 | + common.mustSucceed(() => { | ||
| 201 | 200 | console.error('[PARENT] sent %s to %s:%s', | |
| 202 | 201 | util.inspect(buf.toString()), | |
| 203 | 202 | LOCAL_BROADCAST_HOST, common.PORT); | |
| 204 | 203 | ||
| 205 | 204 | process.nextTick(sendSocket.sendNext); | |
| 206 | - }, | ||
| 205 | + }), | ||
| 207 | 206 | ); | |
| 208 | 207 | }; | |
| 209 | 208 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -69,7 +69,7 @@ function launchChildProcess() { | |||
| 69 | 69 | } | |
| 70 | 70 | }); | |
| 71 | 71 | ||
| 72 | - worker.on('message', function(msg) { | ||
| 72 | + worker.on('message', common.mustCallAtLeast((msg) => { | ||
| 73 | 73 | if (msg.listening) { | |
| 74 | 74 | listening += 1; | |
| 75 | 75 | ||
@@ -94,7 +94,7 @@ function launchChildProcess() { | |||
| 94 | 94 | console.error('[PARENT] All workers have received the ' + | |
| 95 | 95 | 'required number of messages. Will now compare.'); | |
| 96 | 96 | ||
| 97 | - Object.keys(workers).forEach(function(pid) { | ||
| 97 | + for (const pid of Object.keys(workers)) { | ||
| 98 | 98 | const worker = workers[pid]; | |
| 99 | 99 | ||
| 100 | 100 | let count = 0; | |
@@ -112,14 +112,14 @@ function launchChildProcess() { | |||
| 112 | 112 | worker.pid, count); | |
| 113 | 113 | ||
| 114 | 114 | assert.strictEqual(count, messages.length); | |
| 115 | - }); | ||
| 115 | + } | ||
| 116 | 116 | ||
| 117 | 117 | clearTimeout(timer); | |
| 118 | 118 | console.error('[PARENT] Success'); | |
| 119 | 119 | killSubprocesses(workers); | |
| 120 | 120 | } | |
| 121 | 121 | } | |
| 122 | - }); | ||
| 122 | + })); | ||
| 123 | 123 | } | |
| 124 | 124 | ||
| 125 | 125 | function killSubprocesses(subprocesses) { | |
@@ -182,13 +182,12 @@ if (process.argv[2] !== 'child') { | |||
| 182 | 182 | buf.length, | |
| 183 | 183 | common.PORT, | |
| 184 | 184 | LOCAL_BROADCAST_HOST, | |
| 185 | - function(err) { | ||
| 186 | - assert.ifError(err); | ||
| 185 | + common.mustSucceed(() => { | ||
| 187 | 186 | console.error('[PARENT] sent "%s" to %s:%s', | |
| 188 | 187 | buf.toString(), | |
| 189 | 188 | LOCAL_BROADCAST_HOST, common.PORT); | |
| 190 | 189 | process.nextTick(sendSocket.sendNext); | |
| 191 | - }, | ||
| 190 | + }), | ||
| 192 | 191 | ); | |
| 193 | 192 | }; | |
| 194 | 193 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -144,7 +144,7 @@ if (process.argv[2] !== 'child') { | |||
| 144 | 144 | } | |
| 145 | 145 | }); | |
| 146 | 146 | ||
| 147 | - worker.on('message', (msg) => { | ||
| 147 | + worker.on('message', common.mustCallAtLeast((msg) => { | ||
| 148 | 148 | if (msg.listening) { | |
| 149 | 149 | listening += 1; | |
| 150 | 150 | ||
@@ -168,7 +168,7 @@ if (process.argv[2] !== 'child') { | |||
| 168 | 168 | 'required number of ' + | |
| 169 | 169 | 'messages. Will now compare.'); | |
| 170 | 170 | ||
| 171 | - Object.keys(workers).forEach((pid) => { | ||
| 171 | + for (const pid of Object.keys(workers)) { | ||
| 172 | 172 | const worker = workers[pid]; | |
| 173 | 173 | ||
| 174 | 174 | let count = 0; | |
@@ -189,14 +189,14 @@ if (process.argv[2] !== 'child') { | |||
| 189 | 189 | assert.strictEqual(count, worker.messagesNeeded.length, | |
| 190 | 190 | 'A worker received ' + | |
| 191 | 191 | 'an invalid multicast message'); | |
| 192 | - }); | ||
| 192 | + } | ||
| 193 | 193 | ||
| 194 | 194 | clearTimeout(timer); | |
| 195 | 195 | console.error('[PARENT] Success'); | |
| 196 | 196 | killSubprocesses(workers); | |
| 197 | 197 | } | |
| 198 | 198 | } | |
| 199 | - }); | ||
| 199 | + })); | ||
| 200 | 200 | } | |
| 201 | 201 | ||
| 202 | 202 | const sendSocket = dgram.createSocket({ | |
@@ -234,14 +234,13 @@ if (process.argv[2] !== 'child') { | |||
| 234 | 234 | buf.length, | |
| 235 | 235 | PORTS[msg.mcast], | |
| 236 | 236 | msg.mcast, | |
| 237 | - (err) => { | ||
| 238 | - assert.ifError(err); | ||
| 237 | + common.mustSucceed(() => { | ||
| 239 | 238 | console.error('[PARENT] sent %s to %s:%s', | |
| 240 | 239 | util.inspect(buf.toString()), | |
| 241 | 240 | msg.mcast, PORTS[msg.mcast]); | |
| 242 | 241 | ||
| 243 | 242 | process.nextTick(sendSocket.sendNext); | |
| 244 | - }, | ||
| 243 | + }), | ||
| 245 | 244 | ); | |
| 246 | 245 | }; | |
| 247 | 246 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -63,7 +63,7 @@ function launchChildProcess() { | |||
| 63 | 63 | } | |
| 64 | 64 | }); | |
| 65 | 65 | ||
| 66 | - worker.on('message', function(msg) { | ||
| 66 | + worker.on('message', common.mustCallAtLeast((msg) => { | ||
| 67 | 67 | if (msg.listening) { | |
| 68 | 68 | listening += 1; | |
| 69 | 69 | ||
@@ -88,7 +88,7 @@ function launchChildProcess() { | |||
| 88 | 88 | console.error('[PARENT] All workers have received the ' + | |
| 89 | 89 | 'required number of messages. Will now compare.'); | |
| 90 | 90 | ||
| 91 | - Object.keys(workers).forEach(function(pid) { | ||
| 91 | + for (const pid of Object.keys(workers)) { | ||
| 92 | 92 | const worker = workers[pid]; | |
| 93 | 93 | ||
| 94 | 94 | let count = 0; | |
@@ -106,14 +106,14 @@ function launchChildProcess() { | |||
| 106 | 106 | worker.pid, count); | |
| 107 | 107 | ||
| 108 | 108 | assert.strictEqual(count, messages.length); | |
| 109 | - }); | ||
| 109 | + } | ||
| 110 | 110 | ||
| 111 | 111 | clearTimeout(timer); | |
| 112 | 112 | console.error('[PARENT] Success'); | |
| 113 | 113 | killChildren(workers); | |
| 114 | 114 | } | |
| 115 | 115 | } | |
| 116 | - }); | ||
| 116 | + })); | ||
| 117 | 117 | } | |
| 118 | 118 | ||
| 119 | 119 | function killChildren(children) { | |
@@ -176,13 +176,12 @@ if (process.argv[2] !== 'child') { | |||
| 176 | 176 | buf.length, | |
| 177 | 177 | common.PORT, | |
| 178 | 178 | GROUP_ADDRESS, | |
| 179 | - function(err) { | ||
| 180 | - assert.ifError(err); | ||
| 179 | + common.mustSucceed((err) => { | ||
| 181 | 180 | console.error('[PARENT] sent "%s" to %s:%s', | |
| 182 | 181 | buf.toString(), | |
| 183 | 182 | GROUP_ADDRESS, common.PORT); | |
| 184 | 183 | process.nextTick(sendSocket.sendNext); | |
| 185 | - }, | ||
| 184 | + }), | ||
| 186 | 185 | ); | |
| 187 | 186 | }; | |
| 188 | 187 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -63,7 +63,7 @@ function launchChildProcess() { | |||
| 63 | 63 | } | |
| 64 | 64 | }); | |
| 65 | 65 | ||
| 66 | - worker.on('message', function(msg) { | ||
| 66 | + worker.on('message', common.mustCallAtLeast((msg) => { | ||
| 67 | 67 | if (msg.listening) { | |
| 68 | 68 | listening += 1; | |
| 69 | 69 | ||
@@ -88,7 +88,7 @@ function launchChildProcess() { | |||
| 88 | 88 | console.error('[PARENT] All workers have received the ' + | |
| 89 | 89 | 'required number of messages. Will now compare.'); | |
| 90 | 90 | ||
| 91 | - Object.keys(workers).forEach(function(pid) { | ||
| 91 | + for (const pid of Object.keys(workers)) { | ||
| 92 | 92 | const worker = workers[pid]; | |
| 93 | 93 | ||
| 94 | 94 | let count = 0; | |
@@ -106,14 +106,14 @@ function launchChildProcess() { | |||
| 106 | 106 | worker.pid, count); | |
| 107 | 107 | ||
| 108 | 108 | assert.strictEqual(count, messages.length); | |
| 109 | - }); | ||
| 109 | + } | ||
| 110 | 110 | ||
| 111 | 111 | clearTimeout(timer); | |
| 112 | 112 | console.error('[PARENT] Success'); | |
| 113 | 113 | killChildren(workers); | |
| 114 | 114 | } | |
| 115 | 115 | } | |
| 116 | - }); | ||
| 116 | + })); | ||
| 117 | 117 | } | |
| 118 | 118 | ||
| 119 | 119 | function killChildren(children) { | |
@@ -176,13 +176,12 @@ if (process.argv[2] !== 'child') { | |||
| 176 | 176 | buf.length, | |
| 177 | 177 | common.PORT, | |
| 178 | 178 | GROUP_ADDRESS, | |
| 179 | - function(err) { | ||
| 180 | - assert.ifError(err); | ||
| 179 | + common.mustSucceed(() => { | ||
| 181 | 180 | console.error('[PARENT] sent "%s" to %s:%s', | |
| 182 | 181 | buf.toString(), | |
| 183 | 182 | GROUP_ADDRESS, common.PORT); | |
| 184 | 183 | process.nextTick(sendSocket.sendNext); | |
| 185 | - }, | ||
| 184 | + }), | ||
| 186 | 185 | ); | |
| 187 | 186 | }; | |
| 188 | 187 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,6 +19,7 @@ function checkWrap(req) { | |||
| 19 | 19 | assert.ok(typeof req === 'object'); | |
| 20 | 20 | } | |
| 21 | 21 | ||
| 22 | + /* eslint-disable node-core/must-call-assert */ | ||
| 22 | 23 | const checkers = { | |
| 23 | 24 | checkA(r) { | |
| 24 | 25 | assert.ok(isIPv4(r.address)); | |
@@ -80,13 +81,14 @@ const checkers = { | |||
| 80 | 81 | assert.strictEqual(r.type, 'SRV'); | |
| 81 | 82 | }, | |
| 82 | 83 | }; | |
| 84 | + /* eslint-enable node-core/must-call-assert */ | ||
| 83 | 85 | ||
| 84 | - function TEST(f) { | ||
| 86 | + function test(f) { | ||
| 85 | 87 | function next() { | |
| 86 | 88 | const f = queue.shift(); | |
| 87 | 89 | if (f) { | |
| 88 | 90 | running = true; | |
| 89 | - f(done); | ||
| 91 | + f(done).then(common.mustCall()); | ||
| 90 | 92 | } | |
| 91 | 93 | } | |
| 92 | 94 | ||
@@ -115,7 +117,7 @@ function processResult(res) { | |||
| 115 | 117 | return types; | |
| 116 | 118 | } | |
| 117 | 119 | ||
| 118 | - TEST(async function test_sip2sip_for_naptr(done) { | ||
| 120 | + test(async function test_sip2sip_for_naptr(done) { | ||
| 119 | 121 | function validateResult(res) { | |
| 120 | 122 | const types = processResult(res); | |
| 121 | 123 | assert.ok(types.A && types.NS && types.NAPTR && types.SOA, | |
@@ -135,7 +137,7 @@ TEST(async function test_sip2sip_for_naptr(done) { | |||
| 135 | 137 | checkWrap(req); | |
| 136 | 138 | }); | |
| 137 | 139 | ||
| 138 | - TEST(async function test_google_for_cname_and_srv(done) { | ||
| 140 | + test(async function test_google_for_cname_and_srv(done) { | ||
| 139 | 141 | function validateResult(res) { | |
| 140 | 142 | const types = processResult(res); | |
| 141 | 143 | assert.ok(types.SRV); | |
@@ -154,7 +156,7 @@ TEST(async function test_google_for_cname_and_srv(done) { | |||
| 154 | 156 | checkWrap(req); | |
| 155 | 157 | }); | |
| 156 | 158 | ||
| 157 | - TEST(async function test_ptr(done) { | ||
| 159 | + test(async function test_ptr(done) { | ||
| 158 | 160 | function validateResult(res) { | |
| 159 | 161 | const types = processResult(res); | |
| 160 | 162 | assert.ok(types.PTR); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,7 +5,7 @@ const assert = require('assert'); | |||
| 5 | 5 | const dns = require('dns'); | |
| 6 | 6 | const domain = require('domain'); | |
| 7 | 7 | ||
| 8 | - const methods = [ | ||
| 8 | + [ | ||
| 9 | 9 | 'resolve4', | |
| 10 | 10 | 'resolve6', | |
| 11 | 11 | 'resolveCname', | |
@@ -17,13 +17,11 @@ const methods = [ | |||
| 17 | 17 | 'resolvePtr', | |
| 18 | 18 | 'resolveNaptr', | |
| 19 | 19 | 'resolveSoa', | |
| 20 | - ]; | ||
| 21 | - | ||
| 22 | - methods.forEach(function(method) { | ||
| 20 | + ].forEach(function(method) { | ||
| 23 | 21 | const d = domain.create(); | |
| 24 | - d.run(function() { | ||
| 22 | + d.run(common.mustCall(() => { | ||
| 25 | 23 | dns[method](addresses.INET_HOST, common.mustCall(() => { | |
| 26 | 24 | assert.strictEqual(process.domain, d, `${method} retains domain`); | |
| 27 | 25 | })); | |
| 28 | - }); | ||
| 26 | + })); | ||
| 29 | 27 | }); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments