GeezerVison is showing github.com — test: use template strings in parallel tests · nodejs/node@a055244
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-buffer-bigint64.js +13-13Lines changed: 13 additions & 13 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -7,49 +7,49 @@ const buf = Buffer.allocUnsafe(8); | 7 | 7 | ['LE', 'BE'].forEach(function(endianness) { | 8 | 8 | // Should allow simple BigInts to be written and read | 9 | 9 | let val = 123456789n; | 10 | | - buf['writeBigInt64' + endianness](val, 0); | 11 | | - let rtn = buf['readBigInt64' + endianness](0); | | 10 | + buf[`writeBigInt64${endianness}`](val, 0); | | 11 | + let rtn = buf[`readBigInt64${endianness}`](0); | 12 | 12 | assert.strictEqual(val, rtn); | 13 | 13 |
| 14 | 14 | // Should allow INT64_MAX to be written and read | 15 | 15 | val = 0x7fffffffffffffffn; | 16 | | - buf['writeBigInt64' + endianness](val, 0); | 17 | | - rtn = buf['readBigInt64' + endianness](0); | | 16 | + buf[`writeBigInt64${endianness}`](val, 0); | | 17 | + rtn = buf[`readBigInt64${endianness}`](0); | 18 | 18 | assert.strictEqual(val, rtn); | 19 | 19 |
| 20 | 20 | // Should read and write a negative signed 64-bit integer | 21 | 21 | val = -123456789n; | 22 | | - buf['writeBigInt64' + endianness](val, 0); | 23 | | - assert.strictEqual(val, buf['readBigInt64' + endianness](0)); | | 22 | + buf[`writeBigInt64${endianness}`](val, 0); | | 23 | + assert.strictEqual(val, buf[`readBigInt64${endianness}`](0)); | 24 | 24 |
| 25 | 25 | // Should read and write an unsigned 64-bit integer | 26 | 26 | val = 123456789n; | 27 | | - buf['writeBigUInt64' + endianness](val, 0); | 28 | | - assert.strictEqual(val, buf['readBigUInt64' + endianness](0)); | | 27 | + buf[`writeBigUInt64${endianness}`](val, 0); | | 28 | + assert.strictEqual(val, buf[`readBigUInt64${endianness}`](0)); | 29 | 29 |
| 30 | 30 | // Should throw a RangeError upon INT64_MAX+1 being written | 31 | 31 | assert.throws(function() { | 32 | 32 | const val = 0x8000000000000000n; | 33 | | - buf['writeBigInt64' + endianness](val, 0); | | 33 | + buf[`writeBigInt64${endianness}`](val, 0); | 34 | 34 | }, RangeError); | 35 | 35 |
| 36 | 36 | // Should throw a RangeError upon UINT64_MAX+1 being written | 37 | 37 | assert.throws(function() { | 38 | 38 | const val = 0x10000000000000000n; | 39 | | - buf['writeBigUInt64' + endianness](val, 0); | | 39 | + buf[`writeBigUInt64${endianness}`](val, 0); | 40 | 40 | }, { | 41 | 41 | code: 'ERR_OUT_OF_RANGE', | 42 | 42 | message: 'The value of "value" is out of range. It must be ' + | 43 | | - '>= 0n and < 2n ** 64n. Received 18_446_744_073_709_551_616n' | | 43 | + '>= 0n and < 2n ** 64n. Received 18_446_744_073_709_551_616n' | 44 | 44 | }); | 45 | 45 |
| 46 | 46 | // Should throw a TypeError upon invalid input | 47 | 47 | assert.throws(function() { | 48 | | - buf['writeBigInt64' + endianness]('bad', 0); | | 48 | + buf[`writeBigInt64${endianness}`]('bad', 0); | 49 | 49 | }, TypeError); | 50 | 50 |
| 51 | 51 | // Should throw a TypeError upon invalid input | 52 | 52 | assert.throws(function() { | 53 | | - buf['writeBigUInt64' + endianness]('bad', 0); | | 53 | + buf[`writeBigUInt64${endianness}`]('bad', 0); | 54 | 54 | }, TypeError); | 55 | 55 | }); |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-http-readable-data-event.js +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -10,14 +10,14 @@ let next = null; | 10 | 10 |
| 11 | 11 | const server = http.createServer((req, res) => { | 12 | 12 | res.writeHead(200, { | 13 | | - 'Content-Length': '' + (helloWorld.length + helloAgainLater.length) | | 13 | + 'Content-Length': `${(helloWorld.length + helloAgainLater.length)}` | 14 | 14 | }); | 15 | 15 |
| 16 | 16 | // We need to make sure the data is flushed | 17 | 17 | // before writing again | 18 | 18 | next = () => { | 19 | 19 | res.end(helloAgainLater); | 20 | | - next = () => {}; | | 20 | + next = () => { }; | 21 | 21 | }; | 22 | 22 |
| 23 | 23 | res.write(helloWorld); | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-http2-origin.js +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -70,7 +70,7 @@ const ca = readKey('fake-startcom-root-cert.pem', 'binary'); | 70 | 70 | } | 71 | 71 | ); | 72 | 72 | }); | 73 | | - const longInput = 'http://foo.bar' + 'a'.repeat(16383); | | 73 | + const longInput = `http://foo.bar${'a'.repeat(16383)}`; | 74 | 74 | throws( | 75 | 75 | () => session.origin(longInput), | 76 | 76 | { | @@ -107,7 +107,7 @@ const ca = readKey('fake-startcom-root-cert.pem', 'binary'); | 107 | 107 |
| 108 | 108 | // Test automatically sending origin on connection start | 109 | 109 | { | 110 | | - const origins = [ 'https://foo.org/a/b/c', 'https://bar.org' ]; | | 110 | + const origins = ['https://foo.org/a/b/c', 'https://bar.org']; | 111 | 111 | const server = createSecureServer({ key, cert, origins }); | 112 | 112 | server.on('stream', mustCall((stream) => { | 113 | 113 | stream.respond(); | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-http2-server-session-destroy.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -16,5 +16,5 @@ server.listen(0, common.localhostIPv4, common.mustCall(() => { | 16 | 16 |
| 17 | 17 | const port = server.address().port; | 18 | 18 | const host = common.localhostIPv4; | 19 | | - h2.connect('http://' + host + ':' + port, afterConnect); | | 19 | + h2.connect(`http://${host}:${port}`, afterConnect); | 20 | 20 | })); |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-promises-warning-on-unhandled-rejection.js +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -23,7 +23,7 @@ process.on('warning', common.mustCall((warning) => { | 23 | 23 | assert( | 24 | 24 | /Unhandled promise rejection/.test(warning.message), | 25 | 25 | 'Expected warning message to contain "Unhandled promise rejection" ' + | 26 | | - 'but did not. Had "' + warning.message + '" instead.' | | 26 | + `but did not. Had "${warning.message}" instead.` | 27 | 27 | ); | 28 | 28 | break; | 29 | 29 | case 2: | @@ -40,7 +40,7 @@ process.on('warning', common.mustCall((warning) => { | 40 | 40 | assert( | 41 | 41 | /Unhandled promise rejection/.test(warning.message), | 42 | 42 | 'Expected warning message to contain "Unhandled promise rejection" ' + | 43 | | - 'but did not. Had "' + warning.message + '" instead.' | | 43 | + `but did not. Had "${warning.message}" instead.` | 44 | 44 | ); | 45 | 45 | break; | 46 | 46 | case 5: | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-tls-psk-server.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -43,7 +43,7 @@ let gotWorld = false; | 43 | 43 | server.listen(0, () => { | 44 | 44 | const client = spawn(common.opensslCli, [ | 45 | 45 | 's_client', | 46 | | - '-connect', '127.0.0.1:' + server.address().port, | | 46 | + '-connect', `127.0.0.1:${server.address().port}`, | 47 | 47 | '-cipher', CIPHERS, | 48 | 48 | '-psk', KEY, | 49 | 49 | '-psk_identity', IDENTITY | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-worker-relative-path.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -5,7 +5,7 @@ const assert = require('assert'); | 5 | 5 | const { Worker, isMainThread, parentPort } = require('worker_threads'); | 6 | 6 |
| 7 | 7 | if (isMainThread) { | 8 | | - const w = new Worker('./' + path.relative('.', __filename)); | | 8 | + const w = new Worker(`./${path.relative('.', __filename)}`); | 9 | 9 | w.on('message', common.mustCall((message) => { | 10 | 10 | assert.strictEqual(message, 'Hello, world!'); | 11 | 11 | })); | |
|