Skip to content
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

test(sveltekit): Switch to vitest #7438

Merged
merged 1 commit into from
Mar 13, 2023
Merged

Conversation

AbhiPrasad
Copy link
Member

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 Lms24 March 13, 2023 14:25
Copy link
Member

@Lms24 Lms24 left a comment

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 develop Mar 13, 2023
@AbhiPrasad AbhiPrasad deleted the abhi-sveltekit-vitest branch March 13, 2023 15:35
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.

None yet

2 participants