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 failures due to KeyframeEffect #12895

Closed
miina opened this issue Jan 2, 2023 · 4 comments · Fixed by #12950
Closed

Test failures due to KeyframeEffect #12895

miina opened this issue Jan 2, 2023 · 4 comments · Fixed by #12950
Assignees
Labels
P1 High priority, must do soon Type: Bug Something isn't working Type: Infrastructure Changes impacting testing infrastructure or build tooling

Comments

@miina
Copy link
Contributor

miina commented Jan 2, 2023

Bug Description

When enabling .tsx files, there are test failures with the following error in the animations package:
ReferenceError: KeyframeEffect is not defined

See https://github.com/GoogleForCreators/web-stories-wp/actions/runs/3824643543/jobs/6506964376#step:9:286

Also see https://github.com/GoogleForCreators/web-stories-wp/pull/12727/files#r1060169715 for context

Expected Behaviour

Steps to Reproduce

Screenshots

Additional Context

  • Plugin Version:
  • WordPress Version:
  • Operating System:
  • Browser:
@miina miina added Type: Bug Something isn't working Type: Infrastructure Changes impacting testing infrastructure or build tooling Pod: Prometheus labels Jan 2, 2023
@swissspidy
Copy link
Collaborator

That has less to do with tsx files but with this not existing in jsdom and some test using it.

We can mock it in setup-globals.js

@swissspidy swissspidy changed the title Test failures when enabling .tsx files in jest config Test failures due to KeyframeEffect Jan 8, 2023
@swissspidy swissspidy added P1 High priority, must do soon Pod: Prometheus and removed Pod: Prometheus labels Jan 8, 2023
@swissspidy
Copy link
Collaborator

Something like

window.KeyframeEffect = class KeyframeEffect {}

in setup-globals.js might already work.

@swissspidy
Copy link
Collaborator

Looks like this might be a bigger change.

There's all sorts of failures. Using jsdom-testing-mocks helps, but then there are still some failing tests in packages/animation/src/components/test/provider.tsx.

@barklund Since you rewrote the animation package, could you look into this?

To make sure .tsx files are tested, change this in jest.config.js:

-  testMatch: ['**/test/**/*.[jt]s'],
+  testMatch: ['**/test/**/*.{js,jsx,ts,tsx}'],

After that, npm run test:js:watch packages/animation will show the failing tests

@swissspidy
Copy link
Collaborator

Interestingly, this also includes failed tests because of Error: Should not happen. See #12946

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 High priority, must do soon Type: Bug Something isn't working Type: Infrastructure Changes impacting testing infrastructure or build tooling
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants