FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

test_runner: emit start event when subtest starts by sankalp1999 · Pull Request #47797 · nodejs/node · GitHub

/ node Public

test_runner: emit start event when subtest starts - #47797

Closed
sankalp1999 wants to merge 8 commits into
nodejs:mainfrom
sankalp1999:test-runner-start-event
Closed

test_runner: emit start event when subtest starts#47797
sankalp1999 wants to merge 8 commits into
nodejs:mainfrom
sankalp1999:test-runner-start-event

Conversation

Copy link
Copy Markdown
Contributor

emit a start event to show message just after a test/subtest start

Fixes: #46727

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/test_runner

nodejs-github-bot added dont-land-on-v14.x needs-ci PRs that need a full CI run. test_runner Issues and PRs related to the test runner subsystem. labels May 1, 2023
sankalp1999 marked this pull request as draft May 1, 2023 10:46

Copy link
Copy Markdown
Contributor Author

@MoLow I request your review.

sankalp1999 commented May 9, 2023
edited
Loading

Copy link
Copy Markdown
Contributor Author

Thanks @MoLow. I have made a test:begin (name_to_be_decided) event in the test_streams file since test:start is already being used.

Not sure if I need to make changes in the textual output in the reporters as you mentioned "this means the event will only be usable through the run API but not via one of the existing reporters"

@MoLow
(#46727 (comment))

If code changes look fine, can proceed with doc changes and tests (a file pointer would be helpful in this case)

sankalp1999 marked this pull request as ready for review May 9, 2023 17:21
Comment thread lib/internal/test_runner/test.js Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

please revert unrelated change

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

does anything call this method?
I would start by adding this method to this test file, then make sure it passes

assert.match(stdout, /{"test:start":4,"test:pass":2,"test:fail":2,"test:plan":2,"test:diagnostic":\d+}$/);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

no this is the new event so, not called anywhere yet.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Just throwing an idea out there: having both begin and start is confusing. I could also picture people asking for more of these lifecycle events. I would namespace this event further and name it test:lifecycle:run, where lifecycle can be used to indicate what is happening in the test runner and is less about reporting results.

cjihrig commented May 24, 2023

Copy link
Copy Markdown
Contributor

@sankalp1999 are you still working on this?

sankalp1999 commented May 25, 2023
edited
Loading

Copy link
Copy Markdown
Contributor Author

@cjihrig apologise, got busy with other stuff. Getting back to try this next.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

can remove ...directive I guess

Copy link
Copy Markdown
Contributor Author

Ok I saw upstream has changed significantly.

sankalp1999 force-pushed the test-runner-start-event branch from ee93ebc to d4b38f6 Compare May 25, 2023 17:08
}
}

begin(nesting, file, testNumber, name, details) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
begin(nesting, file, testNumber, name, details) {
lifecycleRun(nesting, file, testNumber, name, details) {

Comment thread test/parallel/test-runner-reporters.js Outdated
assert.strictEqual(child.stderr.toString(), '');
const stdout = child.stdout.toString();
assert.match(stdout, /{"test:start":4,"test:pass":2,"test:fail":2,"test:plan":2,"test:diagnostic":\d+}$/);
assert.match(stdout, /{"test:lifecycle:run":\d+,"test:start":4,"test:pass":2,"test:fail":2,"test:plan":2,"test:diagnostic":\d+}$/);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
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+}$/);

there should be a deterministic number of tests running

MoLow commented May 28, 2023

Copy link
Copy Markdown
Member

there seem to be related test failures

Comment thread lib/internal/test_runner/test.js Outdated
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');

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

will remove comments in next commit if CI passes.

Copy link
Copy Markdown
Contributor Author

CI was passing. Removed the comments.

I think I can proceed with the doc changes as well.

sankalp1999 force-pushed the test-runner-start-event branch from 85a46a4 to f7dbe8a Compare May 30, 2023 09:21
}

async run() {

MoLow May 30, 2023
edited
Loading

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

please revert

return deferred.promise;
}

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I think this should be emitted before the if

}

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I think test:enqueue is a better name, @cjihrig WDYT?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I don't feel too strongly, but I wouldn't say "enqueue" just rolls off the tongue.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I agree, but in terms of distinction from test:start I think it is much better than test:lifecycle:run

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run. test_runner Issues and PRs related to the test runner subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Indicate when a test is started in test_runner

5 participants


Back | FazBrowse Home | New Git URL