Skip to content

Commit

Permalink
test_runner: move method to start(), fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sankalp1999 committed May 29, 2023
1 parent d4b38f6 commit 9033855
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/internal/test_runner/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ class Test extends AsyncResource {
this.nesting = 0;
this.only = testOnlyFlag;
this.reporter = new TestsStream();
this.reporter.begin(this.nesting, kFilename, this.testNumber, this.name, 'starting', 'starting');
// this.reporter.lifecycleRun(this.nesting, kFilename, this.testNumber, this.name, 'starting', 'starting');
this.runOnlySubtests = this.only;
this.testNumber = 0;
this.timeout = kDefaultTimeout;
Expand Down Expand Up @@ -479,7 +479,7 @@ class Test extends AsyncResource {
this.parent.addPendingSubtest(deferred);
return deferred.promise;
}

this.reporter.lifecycleRun(this.nesting, kFilename, this.testNumber, this.name, 'starting', 'starting');
return this.run();
}

Expand Down Expand Up @@ -783,7 +783,7 @@ class Suite extends Test {
}

async run() {
this.reporter.begin(this.nesting, kFilename, this.testNumber, this.name, 'starting', 'starting');
// this.reporter.lifecycleRun(this.nesting, kFilename, this.testNumber, this.name, 'starting', 'starting');

const hookArgs = this.getRunArgs();

Expand Down
2 changes: 1 addition & 1 deletion lib/internal/test_runner/tests_stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class TestsStream extends Readable {
}
}

begin(nesting, file, testNumber, name, details) {
lifecycleRun(nesting, file, testNumber, name, details) {
this[kEmitMessage]('test:lifecycle:run', { __proto__: null, name, nesting, file, testNumber, details });
}

Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-runner-reporters.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ describe('node:test reporters', { concurrency: true }, () => {
testFile]);
assert.strictEqual(child.stderr.toString(), '');
const stdout = child.stdout.toString();
assert.match(stdout, /{"test:lifecycle:run":\d+,"test:start":4,"test:pass":2,"test:fail":2,"test:plan":2,"test:diagnostic":\d+}$/);
assert.match(stdout, /{"test:lifecycle:run":4,"test:start":4,"test:pass":2,"test:fail":2,"test:plan":2,"test:diagnostic":\d+}$/);
assert.strictEqual(stdout.slice(0, filename.length + 2), `${filename} {`);
});
});
Expand All @@ -109,7 +109,7 @@ describe('node:test reporters', { concurrency: true }, () => {
assert.strictEqual(child.stderr.toString(), '');
assert.match(
child.stdout.toString(),
/^package: reporter-cjs{"test:lifecycle:run":\d+,"test:start":4,"test:pass":2,"test:fail":2,"test:plan":2,"test:diagnostic":\d+}$/,
/^package: reporter-cjs{"test:lifecycle:run":4,"test:start":4,"test:pass":2,"test:fail":2,"test:plan":2,"test:diagnostic":\d+}$/,
);
});

Expand Down

0 comments on commit 9033855

Please sign in to comment.