fix(test): Update jestConfig to not transform json file #366
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.
Overview of the change
Update jestConfig to exclude json file in the transform config.
Reasons behind it
The existing regex matches
.json
file as well, as a result any json file will be transformed too. This was not a problem beforejest-runtime 24.8
, but after Renovate updatedjest-runtime
in our repo to version 24.8, our test failed, see the error message here https://buildkite.com/seek/adv-account-management-ui/builds/2897#c7d0685f-bde2-4acb-a01c-4e8a3a1e9fa0/158-262.I did some search and found this Jest issue (jestjs/jest#8426 (comment)) similar to the error we got. I fixed the error in our repo by explicitly exclude json file from being transformed, see the commit at here https://github.com/SEEK-Jobs/adv-account-management-ui/pull/500/commits/04f74ba1e750fc7f538c3fbf2c02816ff9b37f4e.
And after that I checked the default jest config for Sku, I think the regex for matching js file was unintentionally matching
json
files based on the comment above the code. Hence this PR.