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

Ignore build files from Jest tests #3155

Merged
merged 2 commits into from
Apr 26, 2024
Merged

Conversation

rmccar
Copy link
Contributor

@rmccar rmccar commented Apr 25, 2024

What is the context of this PR?

Fixes: #2941

If build files are present in your local repo after running yarn cdn-bundle command running yarn test will have some failing tests which fail on some JS imports. This is down to the files in the build directory also being run by jest but because these files are copies of the actual ones we want to run. But because these copies are in a different directory and the imports are using relative paths these paths no longer work so the tests fail.

This PR changes the Jest config so that those files in the build and templates folders are ignored by Jest, we don't want to run the tests in these folders as we would be running the same tests twice.

How to review this PR

  • Run yarn test on the main branch check that tests pass
  • Run RELEASE_VERSION=70.0.4 yarn cdn-bundle to create the cdn bundle files in your local repo
  • Run yarn build to create the build files in your local repo
  • Run yarn test on the main branch and see that the tests now fail
  • Switch to this branch and run yarn test again to see that the files in the build folders are now ignored and the tests pass

Checklist

This needs to be completed by the person raising the PR.

  • I have selected the correct Assignee
  • I have linked the correct Issue

@rmccar rmccar self-assigned this Apr 25, 2024
@rmccar rmccar added the Bug Something isn't working label Apr 25, 2024
Copy link

netlify bot commented Apr 25, 2024

Deploy Preview for ons-design-system-preview ready!

Name Link
🔨 Latest commit 9946f16
🔍 Latest deploy log https://app.netlify.com/sites/ons-design-system-preview/deploys/662b6dccebc161000850ed25
😎 Deploy Preview https://deploy-preview-3155--ons-design-system-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@rmccar rmccar force-pushed the ignore-build-files-from-jest-tests branch from 5ed2afe to 3bb1885 Compare April 25, 2024 13:37
@rmccar rmccar merged commit 1b1849d into main Apr 26, 2024
9 checks passed
@rmccar rmccar deleted the ignore-build-files-from-jest-tests branch April 26, 2024 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tests failing locally
3 participants