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