| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 8980d8c commit 1d9f427
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,8 +10,8 @@ const makeCallback = binding.makeCallback; | |||
| 10 | 10 | const mustCallCheckDomains = common.mustCall(checkDomains); | |
| 11 | 11 | ||
| 12 | 12 | // Make sure that using MakeCallback allows the error to propagate. | |
| 13 | - assert.throws(function() { | ||
| 14 | - makeCallback({}, function() { | ||
| 13 | + assert.throws(() => { | ||
| 14 | + makeCallback({}, () => { | ||
| 15 | 15 | throw new Error('hi from domain error'); | |
| 16 | 16 | }); | |
| 17 | 17 | }, /^Error: hi from domain error$/); | |
@@ -27,22 +27,22 @@ assert.throws(function() { | |||
| 27 | 27 | ||
| 28 | 28 | // Processing of the MicrotaskQueue is manually handled by node. They are not | |
| 29 | 29 | // processed until after the nextTickQueue has been processed. | |
| 30 | - Promise.resolve(1).then(common.mustCall(function() { | ||
| 30 | + Promise.resolve(1).then(common.mustCall(() => { | ||
| 31 | 31 | results.push(7); | |
| 32 | 32 | })); | |
| 33 | 33 | ||
| 34 | 34 | // The nextTick should run after all immediately invoked calls. | |
| 35 | - process.nextTick(common.mustCall(function() { | ||
| 35 | + process.nextTick(common.mustCall(() => { | ||
| 36 | 36 | results.push(3); | |
| 37 | 37 | ||
| 38 | 38 | // Run same test again but while processing the nextTickQueue to make sure | |
| 39 | 39 | // the following MakeCallback call breaks in the middle of processing the | |
| 40 | 40 | // queue and allows the script to run normally. | |
| 41 | - process.nextTick(common.mustCall(function() { | ||
| 41 | + process.nextTick(common.mustCall(() => { | ||
| 42 | 42 | results.push(6); | |
| 43 | 43 | })); | |
| 44 | 44 | ||
| 45 | - makeCallback({}, common.mustCall(function() { | ||
| 45 | + makeCallback({}, common.mustCall(() => { | ||
| 46 | 46 | results.push(4); | |
| 47 | 47 | })); | |
| 48 | 48 | ||
@@ -54,7 +54,7 @@ assert.throws(function() { | |||
| 54 | 54 | // MakeCallback is calling the function immediately, but should then detect | |
| 55 | 55 | // that a script is already in the middle of execution and return before | |
| 56 | 56 | // either the nextTickQueue or MicrotaskQueue are processed. | |
| 57 | - makeCallback({}, common.mustCall(function() { | ||
| 57 | + makeCallback({}, common.mustCall(() => { | ||
| 58 | 58 | results.push(1); | |
| 59 | 59 | })); | |
| 60 | 60 | ||
@@ -63,7 +63,7 @@ assert.throws(function() { | |||
| 63 | 63 | // and process them immediately. | |
| 64 | 64 | results.push(2); | |
| 65 | 65 | ||
| 66 | - setImmediate(common.mustCall(function() { | ||
| 66 | + setImmediate(common.mustCall(() => { | ||
| 67 | 67 | for (let i = 0; i < results.length; i++) { | |
| 68 | 68 | assert.strictEqual(results[i], i, | |
| 69 | 69 | `verifyExecutionOrder(${arg}) results: ${results}`); | |
@@ -72,14 +72,14 @@ assert.throws(function() { | |||
| 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 | 74 | setImmediate(function() { | |
| 75 | - makeCallback({}, common.mustCall(function() { | ||
| 75 | + makeCallback({}, common.mustCall(() => { | ||
| 76 | 76 | verifyExecutionOrder(2); | |
| 77 | 77 | })); | |
| 78 | 78 | }); | |
| 79 | 79 | } else if (arg === 2) { | |
| 80 | 80 | // Make sure there are no conflicts using node::MakeCallback() | |
| 81 | 81 | // within timers. | |
| 82 | - setTimeout(common.mustCall(function() { | ||
| 82 | + setTimeout(common.mustCall(() => { | ||
| 83 | 83 | verifyExecutionOrder(3); | |
| 84 | 84 | }), 10); | |
| 85 | 85 | } else if (arg === 3) { | |
@@ -94,16 +94,16 @@ assert.throws(function() { | |||
| 94 | 94 | function checkDomains() { | |
| 95 | 95 | // Check that domains are properly entered/exited when called in multiple | |
| 96 | 96 | // levels from both node::MakeCallback() and AsyncWrap::MakeCallback | |
| 97 | - setImmediate(common.mustCall(function() { | ||
| 97 | + setImmediate(common.mustCall(() => { | ||
| 98 | 98 | const d1 = domain.create(); | |
| 99 | 99 | const d2 = domain.create(); | |
| 100 | 100 | const d3 = domain.create(); | |
| 101 | 101 | ||
| 102 | - makeCallback({ domain: d1 }, common.mustCall(function() { | ||
| 102 | + makeCallback({ domain: d1 }, common.mustCall(() => { | ||
| 103 | 103 | assert.strictEqual(d1, process.domain); | |
| 104 | - makeCallback({ domain: d2 }, common.mustCall(function() { | ||
| 104 | + makeCallback({ domain: d2 }, common.mustCall(() => { | ||
| 105 | 105 | assert.strictEqual(d2, process.domain); | |
| 106 | - makeCallback({ domain: d3 }, common.mustCall(function() { | ||
| 106 | + makeCallback({ domain: d3 }, common.mustCall(() => { | ||
| 107 | 107 | assert.strictEqual(d3, process.domain); | |
| 108 | 108 | })); | |
| 109 | 109 | assert.strictEqual(d2, process.domain); | |
@@ -112,16 +112,16 @@ function checkDomains() { | |||
| 112 | 112 | })); | |
| 113 | 113 | })); | |
| 114 | 114 | ||
| 115 | - setTimeout(common.mustCall(function() { | ||
| 115 | + setTimeout(common.mustCall(() => { | ||
| 116 | 116 | const d1 = domain.create(); | |
| 117 | 117 | const d2 = domain.create(); | |
| 118 | 118 | const d3 = domain.create(); | |
| 119 | 119 | ||
| 120 | - makeCallback({ domain: d1 }, common.mustCall(function() { | ||
| 120 | + makeCallback({ domain: d1 }, common.mustCall(() => { | ||
| 121 | 121 | assert.strictEqual(d1, process.domain); | |
| 122 | - makeCallback({ domain: d2 }, common.mustCall(function() { | ||
| 122 | + makeCallback({ domain: d2 }, common.mustCall(() => { | ||
| 123 | 123 | assert.strictEqual(d2, process.domain); | |
| 124 | - makeCallback({ domain: d3 }, common.mustCall(function() { | ||
| 124 | + makeCallback({ domain: d3 }, common.mustCall(() => { | ||
| 125 | 125 | assert.strictEqual(d3, process.domain); | |
| 126 | 126 | })); | |
| 127 | 127 | assert.strictEqual(d2, process.domain); | |
@@ -134,10 +134,10 @@ function checkDomains() { | |||
| 134 | 134 | // Make sure nextTick, setImmediate and setTimeout can all recover properly | |
| 135 | 135 | // after a thrown makeCallback call. | |
| 136 | 136 | const d = domain.create(); | |
| 137 | - d.on('error', common.mustCall(function(e) { | ||
| 137 | + d.on('error', common.mustCall((e) => { | ||
| 138 | 138 | assert.strictEqual(e.message, `throw from domain ${id}`); | |
| 139 | 139 | })); | |
| 140 | - makeCallback({ domain: d }, function() { | ||
| 140 | + makeCallback({ domain: d }, () => { | ||
| 141 | 141 | throw new Error(`throw from domain ${id}`); | |
| 142 | 142 | }); | |
| 143 | 143 | throw new Error('UNREACHABLE'); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments