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(svelte): Use vitest instead of jest #10350

Merged
merged 11 commits into from
Feb 14, 2024

Conversation

JonathonRP
Copy link
Contributor

@JonathonRP JonathonRP commented Jan 25, 2024

Before submitting a pull request, please take a look at our
Contributing guidelines and verify:

  • If you've added code that should be tested, please add tests.
  • Ensure your code lints and the test suite passes (yarn lint) & (yarn test).

@JonathonRP
Copy link
Contributor Author

@Lms24, did the best I could. hopefully I didn't miss anything or much.
should help get closer to closing - #10318

Copy link
Member

@AbhiPrasad AbhiPrasad left a comment

Choose a reason for hiding this comment

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

Nice, running CI - let's see what it says!

packages/svelte/package.json Outdated Show resolved Hide resolved
@JonathonRP JonathonRP changed the title update @sentry/svelte to us vitest update @sentry/svelte to use vitest Jan 25, 2024
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.

Hi @JonathonRP thanks for helping out!

The changes look reasonable to me. CI is not yet happy so I'd recommend running

  • yarn build
  • yarn test
  • yarn lint
    locally within the svelte package.

@JonathonRP
Copy link
Contributor Author

Hi @JonathonRP thanks for helping out!

The changes look reasonable to me. CI is not yet happy so I'd recommend running

  • yarn build
  • yarn test
  • yarn lint
    locally within the svelte package.

thanks, I wasn't sure how to run now I know, running and trying to resolve issues as I go

@JonathonRP
Copy link
Contributor Author

JonathonRP commented Jan 26, 2024

@Lms24, running tests it looks like tests fail because assumptions about how the component name should be populated has changes.
example first test it expects to get the current component name even though component name was not provided. Should I update these tests?

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.

Thanks for making the changes! I just saw that you're targeting my PR instead of develop. I'd like to keep these changes atomic though (I'd argue upgrading to vitest is a good change regardless of what we do with #10312). if you could change the target to develop we can merge in this change right now. This should also fix the svelte test fails for now.

@JonathonRP JonathonRP changed the base branch from lms/ref-svelte-component-tracking-svelte-5 to develop January 27, 2024 16:19
@JonathonRP JonathonRP force-pushed the lms/ref-sentry-svelte-vitest branch from d547177 to aaee6fb Compare January 27, 2024 16:33
@JonathonRP
Copy link
Contributor Author

@Lms24 branch is changed to develop

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.

Hmm looks like there's still an error with the vitest config: https://github.com/getsentry/sentry-javascript/actions/runs/7679861958/job/20960439408?pr=10350#step:5:869

Does running yarn test work locally for you?

Also, to fix the lint error, please rebase your PR to the latest develop changes. Unfortunately a formatting error made it to develop, causing the lint job to fail.

@JonathonRP JonathonRP force-pushed the lms/ref-sentry-svelte-vitest branch from aaee6fb to 18545b6 Compare January 29, 2024 16:54
@JonathonRP
Copy link
Contributor Author

@Lms24 I worked to get the tests to pass as much as I can, I'll need further help if more work is needed to pass more tests

@Lms24
Copy link
Member

Lms24 commented Jan 30, 2024

Ah I see, this might require more adjustments. I'll take a look when I have a minute.

@JonathonRP
Copy link
Contributor Author

@Lms24 I see that 8.0.0 is getting pretty close, and hoping this gets addressed soon.

@Lms24
Copy link
Member

Lms24 commented Feb 2, 2024

We're still a couple of weeks away from a stable 8.0.0 release but yes it's getting closer. Had a brief look today and it seems like svelte testing library isn't correctly set up for vitest. The conponent lifecycle hooks aren't called as a result and hence the tests fail.
I can continue work on this or if you still want to I'm happy to let you continue.

@JonathonRP
Copy link
Contributor Author

We're still a couple of weeks away from a stable 8.0.0 release but yes it's getting closer. Had a brief look today and it seems like svelte testing library isn't correctly set up for vitest. The conponent lifecycle hooks aren't called as a result and hence the tests fail.
I can continue work on this or if you still want to I'm happy to let you continue.

Thank you, I'll take a look and see if I can solve it properly tomorrow

@JonathonRP JonathonRP force-pushed the lms/ref-sentry-svelte-vitest branch from c78a283 to 074953b Compare February 4, 2024 01:14
@JonathonRP
Copy link
Contributor Author

@Lms24 I took sometime and figured out how to get svelte lifecycle events firing again with vitest, it's an svelte4 and svelte5 issue with vitest.

@JonathonRP JonathonRP force-pushed the lms/ref-sentry-svelte-vitest branch from d21d594 to 88b39bf Compare February 5, 2024 17:08
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.

Awesome, thanks a lot for sticking with us @JonathonRP - Looks good to me now. Will merge soon!

@Lms24 Lms24 changed the title update @sentry/svelte to use vitest test(svelte): Use vitest instead of jest Feb 6, 2024
@JonathonRP
Copy link
Contributor Author

@Lms24 just making sure this isn't forgotten.

@Lms24 Lms24 merged commit 07ac62f into getsentry:develop Feb 14, 2024
35 checks passed
Lms24 added a commit that referenced this pull request Feb 14, 2024
To not run in watch mode we need to specifically run `vitest run`
instead of `vitest` (missed this when reviewing #10350).
- `yarn test` will run the test suites once
- `yarn test:watch` will continue to run the tests in watch mode

Also unstaled `yarn.lock` which we also seem to have missed in #10350
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.

4 participants