Skip to content

use playwright cli for test .only check #5755

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

Merged
merged 2 commits into from
Dec 16, 2024

Conversation

sharon-wang
Copy link
Member

@sharon-wang sharon-wang commented Dec 16, 2024

Implementation

  • use the playwright CLI to check for .only in test files, following the method in [Feature] probe for tests with .only without running any tests microsoft/playwright#28689 npx playwright test --list --forbid-only
    • we no longer use eslint+mocha to do this check
  • add option to skip the .only check by setting the environment variable SKIP_DOT_ONLY_CHECK (can be set to anything)
    • example usage: SKIP_DOT_ONLY_CHECK=1 git commit
  • rename the .only scripts to be tool-agnostic

QA Notes

  • committing tests without .only should not result in an error
  • committing files that aren't tests should not kick off the .only check
  • setting SKIP_DOT_ONLY_CHECK in the env before committing should skip the .only check
  • error in Git pre-commit hook errors during .only check #5735 should no longer occur since we are not using Eslint + Mocha to do this check

I have tested this on Mac and Windows.

add option to skip the .only check by setting the environment variable `SKIP_DOT_ONLY_CHECK`
Copy link

github-actions bot commented Dec 16, 2024

E2E Tests 🚀  ?
This PR will run tests tagged with: @critical

Copy link
Contributor

@testlabauto testlabauto left a comment

Choose a reason for hiding this comment

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

Very cool! Thanks!
LGTM!

@sharon-wang
Copy link
Member Author

This is working for me on Windows 👍

I was getting some incorrect behaviour, but realized I had to go into test/automation and run npm run compile to make sure the automation artifacts were generated.

Chris pointed out that the test failure is known. This PR only touches precommit-related scripts, so should be unrelated.

@sharon-wang sharon-wang merged commit ab68d97 into main Dec 16, 2024
6 of 8 checks passed
@sharon-wang sharon-wang deleted the use-playwright-dot-only-check branch December 16, 2024 20:13
@github-actions github-actions bot locked and limited conversation to collaborators Dec 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants