Skip to content
This repository has been archived by the owner on Oct 20, 2024. It is now read-only.

chore: use vitest #544

Closed
wants to merge 9 commits into from
Closed

chore: use vitest #544

wants to merge 9 commits into from

Conversation

manuel3108
Copy link
Member

@manuel3108 manuel3108 commented Aug 10, 2024

Superseeds: #480
In preparation for #461

Command to test adders locally will slightly change with this:

pnpm test tailwindcss

will now be

pnpm test -t tailwindcss

You can also use pnpm test:ui which will also spin up vitest ui.

In the future this will allow us to use snapshots to test the outputs of the adders. As vitest now uses proper multi-threading this may also help with speeding up the testing. Currently most time is spent preparing the storybook tests.

Here a few crucial notes:

  • I was hoping we could just use vitest in @svelte-add/testing-library. But apparently vitest only detects tests in the package you run it in, and not in other dependencies. That's why I'm just passing down the describe and test methods.
  • If you filter the adders to test with -t tailwindcss it will still apply all adders, but only run the tests for the adder specified. I did not find an api that allows us to get the current testcase filter
  • Since the -t option is just a regex filter you could in theory also test only the kit-js templates with -t kit-js
  • chore: use vitest #480 did more work, but was pretty hard to review. I decided to create multiple small PR to make things easier (tests for svelte@5 / snapshot tests).
  • This PR contains a few POC's for unit testing as well, especially for the ast-manipulation package.
  • Integrations are only run during CI by default, as they take loads of time locally and hinder the execution of the unit tests

Copy link

changeset-bot bot commented Aug 10, 2024

🦋 Changeset detected

Latest commit: 43d3999

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@svelte-add/testing-library Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@manuel3108 manuel3108 mentioned this pull request Aug 10, 2024
Copy link

pkg-pr-new bot commented Aug 10, 2024

commit: 43d3999

pnpm add https://pkg.pr.new/svelte-add/svelte-add/@svelte-add/testing-library@544

Open in Stackblitz

@manuel3108
Copy link
Member Author

routify tests are also failing on main.

@manuel3108 manuel3108 force-pushed the chore/use-vitest-v2 branch from 36da3e9 to 5cedf52 Compare August 13, 2024 17:37
@manuel3108 manuel3108 marked this pull request as draft August 22, 2024 14:29
@manuel3108
Copy link
Member Author

superseded by internal PR

@manuel3108 manuel3108 closed this Sep 27, 2024
@benmccann benmccann deleted the chore/use-vitest-v2 branch September 27, 2024 19:32
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.

1 participant