Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7cd9161

Browse filesBrowse files
M1chaelChenMylesBorins
authored andcommitted
test: refactor functions to es6
PR-URL: #23510 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
1 parent 22a4ec1 commit 7cd9161
Copy full SHA for 7cd9161

File tree

Expand file treeCollapse file tree

1 file changed

+6
-8
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-8
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-cluster-setup-master-multiple.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-cluster-setup-master-multiple.js
+6-8Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,12 @@ assert(cluster.isMaster);
3030
// makes that unnecessary. This is to make the test less fragile if the
3131
// implementation ever changes such that cluster.settings is mutated instead of
3232
// replaced.
33-
function cheapClone(obj) {
34-
return JSON.parse(JSON.stringify(obj));
35-
}
33+
const cheapClone = (obj) => JSON.parse(JSON.stringify(obj));
3634

3735
const configs = [];
3836

3937
// Capture changes
40-
cluster.on('setup', function() {
38+
cluster.on('setup', () => {
4139
console.log('"setup" emitted', cluster.settings);
4240
configs.push(cheapClone(cluster.settings));
4341
});
@@ -48,7 +46,7 @@ const execs = [
4846
'node-next-3',
4947
];
5048

51-
process.on('exit', function assertTests() {
49+
process.on('exit', () => {
5250
// Tests that "setup" is emitted for every call to setupMaster
5351
assert.strictEqual(configs.length, execs.length);
5452

@@ -58,14 +56,14 @@ process.on('exit', function assertTests() {
5856
});
5957

6058
// Make changes to cluster settings
61-
execs.forEach(function(v, i) {
62-
setTimeout(function() {
59+
execs.forEach((v, i) => {
60+
setTimeout(() => {
6361
cluster.setupMaster({ exec: v });
6462
}, i * 100);
6563
});
6664

6765
// cluster emits 'setup' asynchronously, so we must stay alive long
6866
// enough for that to happen
69-
setTimeout(function() {
67+
setTimeout(() => {
7068
console.log('cluster setup complete');
7169
}, (execs.length + 1) * 100);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.