Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
jest-prop-type-error
Advanced tools
Improves prop-types support in Jest by failing tests on prop-type errors instead of ignoring them
prop-types is a library from Facebook that makes it easy to verify that the props passed to a React component is of the correct type. However, it only allows us runtime type checking, which means some failures can slip by into production.
This is possible to solve with Jest by making prop-type errors throw instead of only logging a warning. In this case your tests would run and whenever a wrong prop is passed to a component, the prop-type validation would pick this up and fail the test. Then we would be able to verify that the props that are passed to our components are good compile-time, provided the tests run when we build our production bundle.
That is what this library does!
Read this blog for a more in-depth explanation.
yarn add -D jest-prop-type-error
In order to enable us to detect prop-type errors and fail the test, you need to
add the following to your package.json
's jest section.
"setupFiles": [
"jest-prop-type-error"
]
If there is no jest section in your package.json
, add one and use that.
Now simply run your tests like usual, and prop-type errors will throw instead of logging a warning!
Thanks to Stian Didriksen for the idea in his talk about Jest at the ReactJS Oslo Meetup 9th May 2018.
[1.1.0] - 2018-05-11
FAQs
Makes Jest throw on React prop-type failures
The npm package jest-prop-type-error receives a total of 24,897 weekly downloads. As such, jest-prop-type-error popularity was classified as popular.
We found that jest-prop-type-error demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.