Skip to content

Conversation

@AbhiPrasad
Copy link
Member

As per https://vitest.dev/config/#globals

By default, vitest does not provide global APIs for explicitness

I think we should follow vitest defaults here and explicitly import in the APIs that we need. This refactors our Svelte SDK tests to do so.

ref #11084

This change also removes environment: 'jsdom' from the vite config in favour of explicitly adding jsdom environment via the @vitest-environment pragma to the specific test file that needs it. This should means that our server tests are not polluted with jsdom globals, and that future writers have to explicitly opt-in to the behaviour.

I was also getting some ts errors in the tests, so addressed those as well.

@AbhiPrasad AbhiPrasad requested a review from a team July 23, 2024 23:27
@AbhiPrasad AbhiPrasad self-assigned this Jul 23, 2024
@AbhiPrasad AbhiPrasad requested review from Lms24 and mydea and removed request for a team July 23, 2024 23:27
@AbhiPrasad AbhiPrasad merged commit 3c7e220 into develop Jul 24, 2024
@AbhiPrasad AbhiPrasad deleted the abhi-vitest-svelte branch July 24, 2024 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants