Configure Vitest for unit and browser tests (use @puppeteer/browsers and webdriverio) - #3010
Conversation
efde516 to
b3a02f9
Compare
📊 Packages dist files size differenceThanks for the PR! Here is the difference in size of the packages dist files between the base branch and the PR.
|
||||||||||||
acc22b4 to
1674a7e
Compare
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| node-version: [ '18.x', '20.x', '22.x', '24.x' ] |
There was a problem hiding this comment.
There is no need to unit tests in multiple Node.js versions, our assets/ code is supposed to run in a browser. We are testing the strict necessary
5104bce to
b3cf44a
Compare
b3cf44a to
01bea65
Compare
There was a problem hiding this comment.
In the future, it would be nice to shift the 1st argument (package location) and pass all the other arsg to pnpm exec vitest
| @@ -1 +1 @@ | |||
| 22.11 | |||
| 22.18 | |||
There was a problem hiding this comment.
So I can use import.meta.main (like __name__ == '__main__' in Python)
|
🤦🏻 thought you could use Vitest for "real" E2E testing like, visiting a page, but not at all. I will revert some part of this PR and move to raw WebdriverIO, Playwright, or Cypress |
This PR was squashed before being merged into the 2.x branch. Discussion ---------- Use Playwright for Browser testing | Q | A | ------------- | --- | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Docs? | no <!-- required for new features --> | Issues | Fix #3010 <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT <!-- Replace this notice by a description of your feature/bugfix. This will help reviewers and should be a good start for the documentation. Additionally (see https://symfony.com/releases): - Always add tests and ensure they pass. - For new features, provide some code snippets to help understand usage. - Features and deprecations must be submitted against branch main. - Update/add documentation as required (we can help!) - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry - Never break backward compatibility (see https://symfony.com/bc). --> Following #3010 (comment) 😅 Commits ------- c5b37fc Use Playwright to run E2E tests a13d427 Rework test_package.sh to allow passing tail args to vitest 6c474d4 Rename back vitest.config.unit.mjs to vitest.config.mjs
Moved all existing assets unit tests under
assets/test/unit, in order to introduceassets/test/browserfor pure E2E tests using a real Symfony app (in a future PR) and real browsers.I slightly improved the
test_package.shfor peerDependencies/importmap versions checks.Next steps are #3009