Skip to content

Commit

Permalink
Override jest version used by react-scripts
Browse files Browse the repository at this point in the history
running tests with coverage flag produces the below errors:

Handlebars: Access has been denied to resolve the property "statements" because it is not an "own property" of its parent.
You can add a runtime option to disable the check or this warning:
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
Handlebars: Access has been denied to resolve the property "branches" because it is not an "own property" of its parent.
You can add a runtime option to disable the check or this warning:
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
Handlebars: Access has been denied to resolve the property "functions" because it is not an "own property" of its parent.
You can add a runtime option to disable the check or this warning:
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
Handlebars: Access has been denied to resolve the property "lines" because it is not an "own property" of its parent.
You can add a runtime option to disable the check or this warning:
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details

This happens to have been yet another breaking change that does not
respect semver versioning for `handlebars` package. This is a package whose
dependecy graph is as follows: react-scripts/jest/jest-cli/istanbul-reporters/handlebars.

We cannot simply remove and add the correct minor version for handlebars to fix this error
, One other alternative would be upgrading the react-scripts version to a version
where they have upgraded all the underlying dependencies all the way to
istanbul-reporters; to a version of the latter that recognizes and is able to work
with the handlebars' changed api. This version of react-scripts does not yet exist
but there is a Pr for it here facebook/create-react-app#8362.

The other alternative and option was to use selective dependency resolution
to override and specify a jest version without needlessy upgrading react-scripts.

This has the disadvantage that we get a few warnings of some configuration options
that jest has deprecated that the current version of react-scripts uses.
  • Loading branch information
peterMuriuki committed Apr 14, 2020
1 parent 2318855 commit 808b164
Show file tree
Hide file tree
Showing 2 changed files with 1,194 additions and 617 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,5 +168,8 @@
"tslint-plugin-prettier": "^2.0.1",
"tslint-react": "^3.6.0",
"typestrict": "^1.0.2"
},
"resolutions": {
"react-scripts/jest": "25.3.0"
}
}
Loading

0 comments on commit 808b164

Please sign in to comment.