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

feat: skip transition in test for transition.utils #6395

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

peterpeterparker
Copy link
Member

@peterpeterparker peterpeterparker commented Feb 11, 2025

Motivation

Svelte v5 requires the web animation API which is not supported in emulated testing environment. That's why this PR makes transition.utils skip animating in test mode.

Notes

Changes

  • If process.env.NODE_ENV === "test" then no animation

@peterpeterparker peterpeterparker requested a review from a team as a code owner February 11, 2025 11:44
@peterpeterparker peterpeterparker marked this pull request as draft February 11, 2025 11:49
@@ -8,6 +8,11 @@ export const heightTransition = (
duration?: number;
}
) => {
// Prevent "TypeError: Cannot set properties of undefined (setting 'onfinish')" in vitest mode
if (process.env.NODE_ENV === "test") {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please do this in a way that doesn't disable it in the test for the transition itself so it doesn't break the test.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I don't know how. Created the draft to start the discussion. If you guys can take care of this, happy to close this PR afterwards.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah I don't know how.

Does this help?

// Tests can override these constants by setting them on the mockedConstants
// object in frontend/src/tests/utils/mockable-constants.test-utils.ts

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks. I can have a look next week or so.

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.

2 participants