Skip to content

chore(site): Make tests faster #6543

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 8 commits into from
Mar 13, 2023
Merged

chore(site): Make tests faster #6543

merged 8 commits into from
Mar 13, 2023

Conversation

BrunoQuaresma
Copy link
Collaborator

@BrunoQuaresma BrunoQuaresma commented Mar 9, 2023

  • Use @swc/jest instead of ts-jest
  • Allow GH Actions to use more workers
  • Upgrade Jest
  • Scoped a few ByRole queries to make the queries faster

FYI: Compared with main, this branch runs tests 50% faster on GitHub Actions.

@BrunoQuaresma BrunoQuaresma changed the title refactor(site): Make tests faster chore(tests): Make tests faster Mar 9, 2023
@BrunoQuaresma BrunoQuaresma changed the title chore(tests): Make tests faster chore(site): Make tests faster Mar 9, 2023
module.exports = {
maxWorkers,
testTimeout: 10_000,
maxWorkers: 8,
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this value going to be set in CI anyways? It'd be ideal to use all 64 cores in dogfood

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, but when it happens into 64 cores at the same time, the output is kinda crazy. I think we can remove it if it is too slow tho but with 8 workers, it is kinda fast.

Copy link
Member

Choose a reason for hiding this comment

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

Makes sense!

@@ -20,7 +20,7 @@ export const FullScreenLoader: FC = () => {
const styles = useStyles()

return (
<div className={styles.root}>
<div className={styles.root} data-testid="loader">
Copy link
Member

@Kira-Pilot Kira-Pilot Mar 10, 2023

Choose a reason for hiding this comment

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

Is it still slow if we keep querying using getByRole but also use within? Just curious when we have to add a data-testid and when we can avoid it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, the getByRole does a lot of "math" behind the scenes to calculate the right role of an element. When we do a within, we reduce the number of elements the getByRole has to iterate over to find the right element.

@BrunoQuaresma BrunoQuaresma merged commit 813b549 into main Mar 13, 2023
@BrunoQuaresma BrunoQuaresma deleted the bq/test-improvements branch March 13, 2023 16:35
@github-actions github-actions bot locked and limited conversation to collaborators Mar 13, 2023
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.

4 participants