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

fix(cli): ensure that pre- and post-test output is flushed at the appropriate times #22611

Merged
merged 2 commits into from Feb 28, 2024

Conversation

mmastrac
Copy link
Member

@mmastrac mmastrac commented Feb 27, 2024

Some deno_std tests were failing to print output that was resolved after the last test finished. In addition, output printed before tests began would sometimes appear above the "running X tests ..." line, and sometimes below it depending on timing.

We now guarantee that all output is flushed before and after tests run, making the output consistent.

Pre-test and post-test output are captured in ------ pre-test output ------ and ------ post-test output ------ blocks to differentiate them from the regular output blocks.

Here's an example of a test (that is much noisier than normal, but an example of what the output will look like):

Check ./load_unload.ts
------- pre-test output -------
load
----- output end -----
running 1 test from ./load_unload.ts
test ...
------- output -------
test
----- output end -----
test ... ok ([WILDCARD])
------- post-test output -------
unload
----- output end -----

@mmastrac mmastrac changed the title test(cli): add an interleave test to detect channel issues fix(cli): ensure that pre- and post-test output is flushed at the appropriate times Feb 27, 2024
#[tokio::test]
async fn websocket_server_idletimeout() {
test_util::timeout!(60);
Copy link
Member Author

Choose a reason for hiding this comment

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

This test was using deno test to bypass a hang, but that stopped working with this change. I (mostly) fixed the test by just forcing an exit.

Copy link
Member

@dsherret dsherret left a comment

Choose a reason for hiding this comment

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

LGTM!

Comment on lines 9 to 13
----- output end -----
test ... ok ([WILDCARD])
------- post-test output -------
unload
----- output end -----
Copy link
Member

Choose a reason for hiding this comment

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

This is a bit confusing - we have output end two end. Is this actually expected?

Copy link
Member Author

Choose a reason for hiding this comment

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

The output end matches with post-test output.

Maybe I can clarify this by making the pairs ------- post-test output ------- and ------- post-test output end ------- instead. WDYT?

Copy link
Member

Choose a reason for hiding this comment

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

I think it will be less confusing, so +1 from me

@mmastrac mmastrac enabled auto-merge (squash) February 28, 2024 21:44
@mmastrac mmastrac merged commit b6e44f9 into denoland:main Feb 28, 2024
17 checks passed
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.

None yet

3 participants