Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(vitest): add Vite plugin for Svelte browser import and autocleanup #362

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
mcous merged 6 commits into main from vite-plugin
Apr 24, 2024

Conversation

@mcous
Copy link
Collaborator

@mcous mcous commented Apr 22, 2024

This PR adds a Vite plugin export to more reliably configure STL with Vitest:

  • Ensure browser Svelte imported instead of node via resolve.conditions
  • Add auto cleanup without global "afterEach" to test.setupFiles automatically

Closes #359

Copy link
Collaborator

@yanick yanick left a comment

Choose a reason for hiding this comment

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

Pretty good idea! Should be mentioned in the README, probably?

Copy link
Collaborator Author

mcous commented Apr 23, 2024

Done! I will undraft once I've smoke tested the latest changes with a real-world test suite + put up a docs PR

Copy link
Collaborator Author

mcous commented Apr 23, 2024

Pushed a couple package.json fixes based usage with an actual test suite. Docs PR is up, this one is ready to go!

src/vite.js Outdated
*/
const addAutoCleanup = (config) => {
const test = config.test ?? {}
const setupFiles = test.setupFiles ?? []
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

setupFiles may be string | string[], need to account for that case

@mcous mcous merged commit ed541de into main Apr 24, 2024
@mcous mcous deleted the vite-plugin branch April 24, 2024 13:43
Copy link

🎉 This PR is included in version 5.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@yanick yanick yanick approved these changes

Assignees

No one assigned

Labels

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Feature proposal: Vite plugin

3 participants

AltStyle によって変換されたページ (->オリジナル) /