GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: remove unused function arguments in async-hooks tests · nodejs/node@2777bc4

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/async-hooks
    • test-promise.chain-promise-before-init-hooks.js
    • test-promise.js
    • test-promise.promise-before-init-hooks.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/async-hooks/test-promise.chain-promise-before-init-hooks.js‎

Copy file name to clipboardExpand all lines: test/async-hooks/test-promise.chain-promise-before-init-hooks.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ const { checkInvocations } = require('./hook-checks');
88
if (!common.isMainThread)
99
common.skip('Worker bootstrapping works differently -> different async IDs');
1010

11-
const p = new Promise(common.mustCall(function executor(resolve, reject) {
11+
const p = new Promise(common.mustCall(function executor(resolve) {
1212
resolve(5);
1313
}));
1414

15-
p.then(function afterresolution(val) {
15+
p.then(function afterResolution(val) {
1616
assert.strictEqual(val, 5);
1717
return val;
1818
});
Collapse file

‎test/async-hooks/test-promise.js‎

Copy file name to clipboardExpand all lines: test/async-hooks/test-promise.js
+10-12Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,22 @@ const hooks = initHooks();
1313

1414
hooks.enable();
1515

16-
const p = (new Promise(common.mustCall(executor)));
17-
p.then(afterresolution);
18-
19-
function executor(resolve, reject) {
20-
const as = hooks.activitiesOfTypes('PROMISE');
21-
assert.strictEqual(as.length, 1);
22-
const a = as[0];
23-
checkInvocations(a, { init: 1 }, 'while in promise executor');
24-
resolve(5);
25-
}
26-
27-
function afterresolution(val) {
16+
const p = new Promise(common.mustCall(executor));
17+
p.then(function afterResolution(val) {
2818
assert.strictEqual(val, 5);
2919
const as = hooks.activitiesOfTypes('PROMISE');
3020
assert.strictEqual(as.length, 2);
3121
checkInvocations(as[0], { init: 1 }, 'after resolution parent promise');
3222
checkInvocations(as[1], { init: 1, before: 1 },
3323
'after resolution child promise');
24+
});
25+
26+
function executor(resolve) {
27+
const as = hooks.activitiesOfTypes('PROMISE');
28+
assert.strictEqual(as.length, 1);
29+
const a = as[0];
30+
checkInvocations(a, { init: 1 }, 'while in promise executor');
31+
resolve(5);
3432
}
3533

3634
process.on('exit', onexit);
Collapse file

‎test/async-hooks/test-promise.promise-before-init-hooks.js‎

Copy file name to clipboardExpand all lines: test/async-hooks/test-promise.promise-before-init-hooks.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ const assert = require('assert');
55
const initHooks = require('./init-hooks');
66
const { checkInvocations } = require('./hook-checks');
77

8-
const p = new Promise(common.mustCall(function executor(resolve, reject) {
8+
const p = new Promise(common.mustCall(function executor(resolve) {
99
resolve(5);
1010
}));
1111

1212
// init hooks after promise was created
1313
const hooks = initHooks({ allowNoInit: true });
1414
hooks.enable();
1515

16-
p.then(function afterresolution(val) {
16+
p.then(function afterResolution(val) {
1717
assert.strictEqual(val, 5);
1818
const as = hooks.activitiesOfTypes('PROMISE');
1919
assert.strictEqual(as.length, 1);

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.