GeezerVison is showing github.com — test: use arrow functions in addons tests · nodejs/node@ee40a00
File treeExpand file treeCollapse file tree Open diff view settings make-callback-domain-warning openssl-client-cert-engine stringbytes-external-exceed-max
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: test/addons/async-hello-world/test-makecallback.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -3,7 +3,7 @@ const common = require('../../common'); | 3 | 3 | const assert = require('assert'); | 4 | 4 | const { runMakeCallback } = require(`./build/${common.buildType}/binding`); | 5 | 5 |
| 6 | | -runMakeCallback(5, common.mustCall(function(err, val) { | | 6 | +runMakeCallback(5, common.mustCall((err, val) => { | 7 | 7 | assert.strictEqual(err, null); | 8 | 8 | assert.strictEqual(val, 10); | 9 | 9 | process.nextTick(common.mustCall()); | |
Collapse file Copy file name to clipboardExpand all lines: test/addons/async-hello-world/test.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -3,7 +3,7 @@ const common = require('../../common'); | 3 | 3 | const assert = require('assert'); | 4 | 4 | const { runCall } = require(`./build/${common.buildType}/binding`); | 5 | 5 |
| 6 | | -runCall(5, common.mustCall(function(err, val) { | | 6 | +runCall(5, common.mustCall((err, val) => { | 7 | 7 | assert.strictEqual(err, null); | 8 | 8 | assert.strictEqual(val, 10); | 9 | 9 | process.nextTick(common.mustCall()); | |
Collapse file Copy file name to clipboardExpand all lines: test/addons/make-callback-domain-warning/test.js +5-5Lines changed: 5 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -10,23 +10,23 @@ function makeCallback(object, cb) { | 10 | 10 | } | 11 | 11 |
| 12 | 12 | let latestWarning = null; | 13 | | -process.on('warning', function(warning) { | | 13 | +process.on('warning', (warning) => { | 14 | 14 | latestWarning = warning; | 15 | 15 | }); | 16 | 16 |
| 17 | 17 | const d = domain.create(); | 18 | 18 |
| 19 | 19 | // When domain is disabled, no warning will be emitted | 20 | | -makeCallback({ domain: d }, common.mustCall(function() { | | 20 | +makeCallback({ domain: d }, common.mustCall(() => { | 21 | 21 | assert.strictEqual(latestWarning, null); | 22 | 22 |
| 23 | | - d.run(common.mustCall(function() { | | 23 | + d.run(common.mustCall(() => { | 24 | 24 | // No warning will be emitted when no domain property is applied | 25 | | - makeCallback({}, common.mustCall(function() { | | 25 | + makeCallback({}, common.mustCall(() => { | 26 | 26 | assert.strictEqual(latestWarning, null); | 27 | 27 |
| 28 | 28 | // Warning is emitted when domain property is used and domain is enabled | 29 | | - makeCallback({ domain: d }, common.mustCall(function() { | | 29 | + makeCallback({ domain: d }, common.mustCall(() => { | 30 | 30 | assert.strictEqual(latestWarning.name, 'DeprecationWarning'); | 31 | 31 | assert.strictEqual(latestWarning.code, 'DEP0097'); | 32 | 32 | })); | |
Collapse file Copy file name to clipboardExpand all lines: test/addons/make-callback-recurse/test.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -71,7 +71,7 @@ assert.throws(() => { | 71 | 71 | if (arg === 1) { | 72 | 72 | // The tests are first run on bootstrap during LoadEnvironment() in | 73 | 73 | // src/node.cc. Now run the tests through node::MakeCallback(). | 74 | | - setImmediate(function() { | | 74 | + setImmediate(() => { | 75 | 75 | makeCallback({}, common.mustCall(() => { | 76 | 76 | verifyExecutionOrder(2); | 77 | 77 | })); | |
Collapse file Copy file name to clipboardExpand all lines: test/addons/openssl-client-cert-engine/test.js +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -43,14 +43,14 @@ const server = https.createServer(serverOptions, common.mustCall((req, res) => { | 43 | 43 | headers: {} | 44 | 44 | }; | 45 | 45 |
| 46 | | - const req = https.request(clientOptions, common.mustCall(function(response) { | | 46 | + const req = https.request(clientOptions, common.mustCall((response) => { | 47 | 47 | let body = ''; | 48 | 48 | response.setEncoding('utf8'); | 49 | | - response.on('data', function(chunk) { | | 49 | + response.on('data', (chunk) => { | 50 | 50 | body += chunk; | 51 | 51 | }); | 52 | 52 |
| 53 | | - response.on('end', common.mustCall(function() { | | 53 | + response.on('end', common.mustCall(() => { | 54 | 54 | assert.strictEqual(body, 'hello world'); | 55 | 55 | server.close(); | 56 | 56 | })); | |
Collapse file Copy file name to clipboardExpand all lines: test/addons/openssl-key-engine/test.js +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -45,14 +45,14 @@ const server = https.createServer(serverOptions, common.mustCall((req, res) => { | 45 | 45 | headers: {} | 46 | 46 | }; | 47 | 47 |
| 48 | | - const req = https.request(clientOptions, common.mustCall(function(response) { | | 48 | + const req = https.request(clientOptions, common.mustCall((response) => { | 49 | 49 | let body = ''; | 50 | 50 | response.setEncoding('utf8'); | 51 | | - response.on('data', function(chunk) { | | 51 | + response.on('data', (chunk) => { | 52 | 52 | body += chunk; | 53 | 53 | }); | 54 | 54 |
| 55 | | - response.on('end', common.mustCall(function() { | | 55 | + response.on('end', common.mustCall(() => { | 56 | 56 | assert.strictEqual(body, 'hello world'); | 57 | 57 | server.close(); | 58 | 58 | })); | |
Collapse file Copy file name to clipboardExpand all lines: test/addons/repl-domain-abort/test.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -31,7 +31,7 @@ if (common.isWindows) | 31 | 31 | buildPath = buildPath.replace(/\\/g, '/'); | 32 | 32 | let cb_ran = false; | 33 | 33 |
| 34 | | -process.on('exit', function() { | | 34 | +process.on('exit', () => { | 35 | 35 | assert(cb_ran); | 36 | 36 | console.log('ok'); | 37 | 37 | }); | |
Collapse file Copy file name to clipboardExpand all lines: test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-ascii.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -25,7 +25,7 @@ if (!binding.ensureAllocation(2 * kStringMaxLength)) | 25 | 25 | common.skip(skipMessage); | 26 | 26 |
| 27 | 27 | const stringLengthHex = kStringMaxLength.toString(16); | 28 | | -common.expectsError(function() { | | 28 | +common.expectsError(() => { | 29 | 29 | buf.toString('ascii'); | 30 | 30 | }, { | 31 | 31 | message: `Cannot create a string longer than 0x${stringLengthHex} ` + | |
Collapse file Copy file name to clipboardExpand all lines: test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-base64.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -25,7 +25,7 @@ if (!binding.ensureAllocation(2 * kStringMaxLength)) | 25 | 25 | common.skip(skipMessage); | 26 | 26 |
| 27 | 27 | const stringLengthHex = kStringMaxLength.toString(16); | 28 | | -common.expectsError(function() { | | 28 | +common.expectsError(() => { | 29 | 29 | buf.toString('base64'); | 30 | 30 | }, { | 31 | 31 | message: `Cannot create a string longer than 0x${stringLengthHex} ` + | |
Collapse file Copy file name to clipboardExpand all lines: test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-binary.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -27,7 +27,7 @@ if (!binding.ensureAllocation(2 * kStringMaxLength)) | 27 | 27 | common.skip(skipMessage); | 28 | 28 |
| 29 | 29 | const stringLengthHex = kStringMaxLength.toString(16); | 30 | | -common.expectsError(function() { | | 30 | +common.expectsError(() => { | 31 | 31 | buf.toString('latin1'); | 32 | 32 | }, { | 33 | 33 | message: `Cannot create a string longer than 0x${stringLengthHex} ` + | |
|