Transforming import for jest to work & fixing test CI #982
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related issue
Closes #980
Context / Background
__tests__/__renderer__/workday-waiver.js
is failing due to one of its includes not being written in ES6 and needing transpilation.SyntaxError: Unexpected token 'export'
What change is being introduced by this PR?
Searched for many possible solutions. Seems this might be fixed in newer jest versions, but I think we should go that way after we fix our electron usage.
Leveraging a few solutions I found over the internet, this is the only solution I found to be working.
A few sources
https://stackoverflow.com/questions/75578896/running-test-with-jest-in-repo-using-yarn-syntaxerror-unexpected-token-export
https://stackoverflow.com/questions/49263429/jest-gives-an-error-syntaxerror-unexpected-token-export
https://jestjs.io/docs/configuration#transformignorepatterns-arraystring
Changes:
How will this be tested?
Running
npm run test:jest
Update 1:
Also added a node version to Checks.yml so that the CI can work through the Puppeteer include error. This is fixed in newer versions of node.
Update 2:
The repo has a patch for jest 3.0.0 and it seems there is a new 3.0.1 for which the patch fails.
Changed package.json to force the version we are patching.
Update 3:
Error happening for macos:
This test has a mock fix for Linux, attempting same for macos.
Update 4:
Fixing version of ubuntu to ubuntu-20.04 as actions on ubuntu-latest are getting stuck.
actions/runner-images#6698
actions/runner-images#6704
actions/runner#1819