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 fb98fa4

Browse filesBrowse files
cjihrigruyadorno
authored andcommitted
test_runner: refactor Promise chain in run()
This commit refactors the chain of functions in run() to use an async function instead of creating an awkward primordial-based Promise chain. PR-URL: #55958 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com> Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
1 parent 18c9496 commit fb98fa4
Copy full SHA for fb98fa4

File tree

Expand file treeCollapse file tree

1 file changed

+10
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+10
-3
lines changed
Open diff view settings
Collapse file

‎lib/internal/test_runner/runner.js‎

Copy file name to clipboardExpand all lines: lib/internal/test_runner/runner.js
+10-3Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ const {
1717
ArrayPrototypeSort,
1818
ObjectAssign,
1919
PromisePrototypeThen,
20-
PromiseResolve,
2120
PromiseWithResolvers,
2221
SafeMap,
2322
SafePromiseAll,
@@ -798,9 +797,17 @@ function run(options = kEmptyObject) {
798797
}
799798
}
800799

801-
const setupPromise = PromiseResolve(setup?.(root.reporter));
802-
PromisePrototypeThen(PromisePrototypeThen(PromisePrototypeThen(setupPromise, runFiles), postRun), teardown);
800+
const runChain = async () => {
801+
if (typeof setup === 'function') {
802+
await setup(root.reporter);
803+
}
804+
805+
await runFiles();
806+
postRun?.();
807+
teardown?.();
808+
};
803809

810+
runChain();
804811
return root.reporter;
805812
}
806813

0 commit comments

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