Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid late start message after test has finished in --runInBand mode #81

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

JoostK
Copy link

@JoostK JoostK commented Nov 26, 2023

The start message that is sent over a test's MessageChannel may arrive after the tests' Promise has already resolved, i.e. the finished callback has already been executed. This results in excessive status message logging, as the late start event does activate the test as "running" even though it has already finished, rendering it in the "running" state forever (and consequently generating excessive status messages as more and more tests become considered "running").

Fixes #76

@JoostK JoostK marked this pull request as ready for review November 27, 2023 08:41
src/index.js Outdated
result => void onResult(test, result),
error => void onFailure(test, error)
result => {
finished = true;
Copy link
Owner

Choose a reason for hiding this comment

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

Could we instead set mc.port2.onmessage to null?

Copy link
Author

Choose a reason for hiding this comment

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

That could work, yes, although I think it needs to be a noop closure. Will attempt this and push the changes.

Copy link
Author

Choose a reason for hiding this comment

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

null is indeed accepted, so pushed an update.

The start message that is sent over a test's MessageChannel may arrive after
the tests' Promise has already resolved, i.e. the finished callback has
already been executed. This results in excessive status message logging,
as the late start event does activate the test as "running" even though
it has already finished, rendering it in the "running" state forever (and
consequently generating excessive status messages as more and more tests become
considered "running").

Fixes nicolo-ribaudo#76
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Repeated status logging due to ordering inconsistency
2 participants