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

Build: Rework test NPM script #13871

Merged
merged 1 commit into from
Feb 12, 2021
Merged

Build: Rework test NPM script #13871

merged 1 commit into from
Feb 12, 2021

Conversation

gaetanmaisse
Copy link
Member

Applying #13559 step by step to not face gigantic conflicts or issues with the webpack 4/5 works.

What I did

Previously the unit tests were run with a custom script scripts/test.js.
This script was a kind of wrapper around Jest, handling just a few options (skipping all the unknown ones) and spawning Jest programmatically.
To simplify this process:

  • I extracted the only non-classic case in its own NPM script: yarn test-puppeteer
  • Just call Jest directly when running yarn test so all the options are forwarded properly to Jest.

⚠️ yarn test --core doesn't work anymore as --core isn't a Jest option, it is now simply yarn test. All the other options are still available:

  • --watch
  • --coverage
  • --runInBand
  • --w2 is now --> -w 2
  • --reportLeaks is now --> --detectLeaks
  • --update is now --> -u or --updateSnapshot

📝 We can now run the tests of a single workspace by simply use --projects, for instance: yarn test --projects examples/angular-cli

I also updated:

How to test

  • CI should be green and you should be able to run yarn test with any Jest option.

Previously the unit tests were run with a custom script `scripts/test.js`.
This script was a kind of wrapper around Jest, handling just a few options (skipping all the unknown ones) and spawning Jest programmatically.
To simplify this process:
 - I extracted the only non-classic case in its own NPM script: `yarn test-puppeteer`
 - Just call Jest directly when running `yarn test` so all the options are forwarded properly to Jest.

⚠️ `yarn test --core` doesn't work anymore as `--core` isn't a Jest option, it is now simply `yarn test`.
📝 To run the tests of a single workspace just use `--projects`, for instance: `yarn test --projects examples/angular-cli`
@gaetanmaisse gaetanmaisse added the maintenance User-facing maintenance tasks label Feb 11, 2021
@gaetanmaisse gaetanmaisse marked this pull request as ready for review February 11, 2021 08:27
@gaetanmaisse gaetanmaisse requested a review from a team February 11, 2021 08:28
Copy link
Contributor

@phated phated left a comment

Choose a reason for hiding this comment

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

Wow! Awesome! 🎊

@ndelangen ndelangen merged commit fabc8fb into next Feb 12, 2021
@ndelangen ndelangen deleted the tech/rework-unit-tests branch February 12, 2021 07:41
@ghengeveld
Copy link
Member

Omg my hero

Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

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

🙌

@gaetanmaisse gaetanmaisse mentioned this pull request Feb 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance User-facing maintenance tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants