Skip to content

test(sveltekit): Switch to vitest - #7438

Merged
AbhiPrasad merged 1 commit into
developfrom
abhi-sveltekit-vitest
Mar 13, 2023
Merged

test(sveltekit): Switch to vitest#7438
AbhiPrasad merged 1 commit into
developfrom
abhi-sveltekit-vitest

Conversation

@AbhiPrasad

Copy link
Copy Markdown
Contributor

Sveltekit uses is esm only and uses conditional exports, which doesn't play nicely with our current version of jest.

 FAIL test/server/load.test.ts
● Test suite failed to run
Cannot find module '@sveltejs/kit' from 'test/server/load.test.ts'
7 | // @ts-ignore sdf
8 | // eslint-disable-next-line import/no-unresolved
> 9 | import * as Kit from '@sveltejs/kit';
| ^
10 |
11 | // Kit.error = jest.fn();
12 | import { wrapLoadWithSentry } from '../../src/server/load';
at Resolver._throwModNotFoundError (../../node_modules/jest-resolve/build/resolver.js:427:11)
at Object.<anonymous> (test/server/load.test.ts:9:1)

We can't update jest for now, so swapping to use vitest instead.

Bonus is that vitest is waaaaay faster, but it is restricted to Node 14+ (which we are fine for Sveltekit).

@AbhiPrasad
AbhiPrasad requested a review from Lms24March 13, 2023 14:25

@Lms24Lms24 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice!

@AbhiPrasad
AbhiPrasad merged commit ba99e7c into developMar 13, 2023
@AbhiPrasad
AbhiPrasad deleted the abhi-sveltekit-vitest branch March 13, 2023 15:35
Sign up for freeto 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.

2 participants

@AbhiPrasad@Lms24