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

chore: use vitest #480

Closed
wants to merge 14 commits into from
Closed

chore: use vitest #480

wants to merge 14 commits into from

Conversation

manuel3108
Copy link
Member

Relates / 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, although the ui is pretty barebones and does not allow running filtered tests in example.

Currently a draft, as I needed to switch from pnpm to npm for the testing in order to make everything work. Now trying to figure out what causes the problem

Copy link

changeset-bot bot commented Jul 5, 2024

🦋 Changeset detected

Latest commit: 1ee50e2

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

Copy link

pkg-pr-new bot commented Jul 5, 2024

commit: 1ee50e2

pnpm add https://pkg.pr.new/svelte-add/svelte-add/@svelte-add/core@480
pnpm add https://pkg.pr.new/svelte-add/svelte-add/@svelte-add/testing-library@480
pnpm add https://pkg.pr.new/svelte-add/svelte-add@480
pnpm add https://pkg.pr.new/svelte-add/svelte-add/@svelte-add/website@480

Open in Stackblitz

@manuel3108
Copy link
Member Author

For whatever reason this works in CI.....

@benmccann
Copy link
Collaborator

I believe @dominikg setup the tests for create-svelte and handled whatever pnpm magic was needed there to make things work, so perhaps he'd be able to lend some advice on this one

@manuel3108
Copy link
Member Author

manuel3108 commented Jul 5, 2024

As soon as I switch this line from using npm to pnpm 26 out of 51 one tests start failing on windows:

await executeCli("pnpm", ["install", "--ignore-workspace"], output, { stdio: "pipe" });

I tried to reproduce the error in a codespace, but everything seems to work there, as in CI (well expect for the storybook tests, but I'm not interested in these atm). Also tried a to do a fresh clone on my machine, but I only got the same error as before.

Edit: As shown in the tests for create-svelte i tried to create pnpm-workspace files in different locations, sadly without success.
https://github.com/sveltejs/kit/blob/43544107269013e8b5160d268da25f1e003b6f6f/packages/create-svelte/test/check.js#L59

@dominikg
Copy link

dominikg commented Aug 1, 2024

I believe @dominikg setup the tests for create-svelte and handled whatever pnpm magic was needed there to make things work, so perhaps he'd be able to lend some advice on this one

tests for create-svelte are special as you have to prevent the local monorepo packages from bleeding in. so they generate a separate monorepo root in a temp dir. its weird and pretty specific to create-svelte.

a similar pattern could be used for svelte-add but not sure you need it unless you want e2e-tests that validate the adder worked by installing and building the e2e project again. but I'd be fine with snapshots validating expected file changes

This was referenced Aug 7, 2024
@manuel3108
Copy link
Member Author

Closing in favor of #544

@manuel3108 manuel3108 closed this Aug 10, 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