
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
jest-webpack
Advanced tools
Use webpack loader and plugins you want to build modules into individual files and test them with jest.
A helper tool and webpack plugin to integrate jest and webpack.
Add it to your project as a developer dependency. And run it like webpack or webpack-dev-server from the command line or as a package.json script.
npm install --save-dev jest-webpack
or with yarn
yarn add -D jest-webpack
Add it as a package.json script
{
"name": "my-package",
"scripts": {
"test": "jest-webpack"
npm test
Run it with jest options
npm test -- --testPathPattern test-just-this-file
jest-webpack currently works with a lot of jest options out of the bag since there is no special handling needed and they can just be passed to jest by the tool. You can see what is so far specifically tested so far in https://github.com/mzgoddard/jest-webpack/issues/3.
jest-webpack uses a webpack plugin to add related plugins that are responsible for 4 operations.
TestEntriesPlugin finds test files that jest will operate on and creates entry chunks for them.EntryReferencePlugin creates additional entries for any other files that are depended on by those test files. These entries return objects pointing to the various transformations of that file. If a css file is depended on by both css-loader and css-loader/locals for example, both of the outputs of those loaders will be in the same file. Files then depending on those outputs reference the entry chunk and use the exported member for their needed version of the original file.EmitChangedAssetsPlugin removes entry chunks that already exist in the destination folder. It also includes package.json for the tested project.RunJestWhenDonePlugin runs jest when webpack is done. It runs jest from the destination folder so jest uses the webpack transformed files. This lets jest determine what files changed and which runs to test again instead of testing all the files again.This way of integrating jest and webpack is fairly transparent, requiring little modification to a webpack project. Used along with source-map-support, you can also get source maps.
Thanks to Colch for letting me take over development of a jest-webpack integration as the jest-webpack npm package.
FAQs
Use webpack loader and plugins you want to build modules into individual files and test them with jest.
The npm package jest-webpack receives a total of 923 weekly downloads. As such, jest-webpack popularity was classified as not popular.
We found that jest-webpack demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.