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_runner: give the root test a harness reference · nodejs/node@15503ff

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal/test_runner
    • harness.js
    • test.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/test_runner/harness.js‎

Copy file name to clipboardExpand all lines: lib/internal/test_runner/harness.js
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ function setup(root) {
136136
createProcessEventHandler('unhandledRejection', root);
137137
const coverage = configureCoverage(root, globalOptions);
138138
const exitHandler = () => {
139-
root.coverage = collectCoverage(root, coverage);
139+
root.harness.coverage = collectCoverage(root, coverage);
140140
root.postRun(new ERR_TEST_FAILURE(
141141
'Promise resolution is still pending but the event loop has already resolved',
142142
kCancelledByParent));
@@ -160,6 +160,11 @@ function setup(root) {
160160
process.on('SIGTERM', terminationHandler);
161161
}
162162

163+
root.harness = {
164+
__proto__: null,
165+
bootstrapComplete: false,
166+
coverage: null,
167+
};
163168
root.startTime = hrtime();
164169

165170
wasRootSetup.add(root);
Collapse file

‎lib/internal/test_runner/test.js‎

Copy file name to clipboardExpand all lines: lib/internal/test_runner/test.js
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ class Test extends AsyncResource {
252252
this.#outerSignal?.addEventListener('abort', this.#abortHandler);
253253

254254
this.fn = fn;
255-
this.coverage = null; // Configured on the root test by the test harness.
255+
this.harness = null; // Configured on the root test by the test harness.
256256
this.mock = null;
257257
this.name = name;
258258
this.parent = parent;
@@ -651,8 +651,8 @@ class Test extends AsyncResource {
651651
this.reporter.diagnostic(this.nesting, kFilename, `todo ${counters.todo}`);
652652
this.reporter.diagnostic(this.nesting, kFilename, `duration_ms ${this.#duration()}`);
653653

654-
if (this.coverage) {
655-
this.reporter.coverage(this.nesting, kFilename, this.coverage);
654+
if (this.harness?.coverage) {
655+
this.reporter.coverage(this.nesting, kFilename, this.harness.coverage);
656656
}
657657

658658
this.reporter.push(null);

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.