Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

test_runner: emit 'test:restarted' event when tests are restarted#59115

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

OkunadeNaheem
Copy link

@OkunadeNaheemOkunadeNaheem commentedJul 18, 2025
edited by RafaelGSS
Loading

Refs:#57206

emit a 'test:restarted' event from the test runner when a test file isrestarted due to file changes, if a timestamp reporter is present.this allows custom reporters to handle test restart events for loggingor other behaviors.
add a timeStamp() method to tests_stream that emits a custom'test:restarted' event when invoked. this allows reporters tolog timestamped messages on test restarts.Fixes:nodejs#57206
add a test that verifies the timeStamp event emitter triggerscorrectly when a test file is restarted. this ensures thetest_runner emits the 'test:restarted' event as expected.Fixes:nodejs#57206
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/test_runner

@nodejs-github-botnodejs-github-bot added needs-ciPRs that need a full CI run. test_runnerIssues and PRs related to the test runner subsystem. labelsJul 18, 2025
@OkunadeNaheem
Copy link
Author

Description
This pull request introduces a test:restarted event in the test_runner module.
The event is emitted whenever a test file is restarted due to file changes during watch mode, allowing reporters (such as a timestamp logger) to hook into the restart event.

Summary of changes:
test_runner/runner.js:
Emit the test:restarted event using the reporter’s timeStamp method when a test file restarts.

test_runner/tests_stream.js:
Added timeStamp() method to TestsStream for emitting timestamped messages. This method uses process.stdout.write following the Node.js guidelines on avoiding console.log in core code.

test/parallel/test-runner-restart-timestamp.js:
Added a test to verify that the test:restarted event is emitted when a test file is restarted.

@@ -0,0 +1,23 @@
'use strict';
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
'use strict';
// Flags: --expose-internals
'use strict';

@OkunadeNaheemOkunadeNaheem deleted the test_runner/add-restart-timestamp branchJuly 18, 2025 21:06
@OkunadeNaheemOkunadeNaheem restored the test_runner/add-restart-timestamp branchJuly 18, 2025 21:06
@OkunadeNaheemOkunadeNaheem deleted the test_runner/add-restart-timestamp branchJuly 18, 2025 21:07
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@RafaelGSSRafaelGSSRafaelGSS left review comments

Assignees
No one assigned
Labels
needs-ciPRs that need a full CI run.test_runnerIssues and PRs related to the test runner subsystem.
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@OkunadeNaheem@nodejs-github-bot@RafaelGSS

[8]ページ先頭

©2009-2025 Movatter.jp