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

feat(test runner): allow stopping testrun with escape #32584

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Skn0tt
Copy link
Member

@Skn0tt Skn0tt commented Sep 12, 2024

Closes #32579

@Skn0tt Skn0tt requested a review from dgozman September 12, 2024 07:13
@Skn0tt Skn0tt self-assigned this Sep 12, 2024

This comment has been minimized.

@pavelfeldman
Copy link
Member

What do you think about handling the first Ctrl+C (Cmd+C) to stop? It might be a bit more discoverable. Esc is designed to be used for escape sequences in the terminal environments, so there is an expectation that something follows Esc.

@Skn0tt
Copy link
Member Author

Skn0tt commented Sep 12, 2024

We're already doing that, see https://github.com/microsoft/playwright/pull/32584/files#diff-6a03ad981aab4989f4c00a92fbeb80df93f97bbd33e1e66bd292cfbffcf3a943R273.

We're listening to both Ctrl+C, Escape and their Control sequence equivalents. Do you think we should be listening exclusively to Ctrl+C?

@pavelfeldman
Copy link
Member

We're listening to both Ctrl+C, Escape and their Control sequence equivalents. Do you think we should be listening exclusively to Ctrl+C?

I misunderstood the intention behind the patch.


process.stdin.on('keypress', handler);

return {
Copy link
Member

Choose a reason for hiding this comment

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

returning the callback effect-style would also work. We only use Disposable when we interoperate with vscode.

Copy link
Member Author

Choose a reason for hiding this comment

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

done in f0de6cc

});

void result.finally(reader.dispose);
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 readKeyPress should have this code, not readCommand

Copy link
Member Author

Choose a reason for hiding this comment

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

i've moved readKeyPress to return a promise in f0de6cc. That changes quite a bit about the code, but makes it easier to reason about in general - and it also moves the disposal into readKeyPress 👍

This comment has been minimized.

This comment has been minimized.

Copy link
Contributor

Test results for "tests 1"

2 failed
❌ [playwright-test] › babel.spec.ts:135:5 › should not transform external
❌ [playwright-test] › watch.spec.ts:822:5 › should stop testrun on pressing escape

35488 passed, 659 skipped
✔️✔️✔️

Merge workflow run.

@Skn0tt
Copy link
Member Author

Skn0tt commented Sep 17, 2024

Unsure why this is failing on Windows. Need to investigate

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.

[Internal]: Watch mode should have a way of stopping tests
2 participants