
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
jest-element-snapshots
Advanced tools
Make capturing & comparing snapshots of the puppeteer DOM easier!
npm install jest-element-snapshots --save-devsetupTestFrameworkScriptFile is a good place)require("jest-element-snapshots")();
This will install the .toMatchDOMSnapshot() functionality onto .expect(). See the Installation API section for available options.
it("should generate some consistent output", async () => {
await page.goto("http://example.com");
// Will look up the element in puppeteer,
// grab its .outerHTML value,
// and compare it against any previous snapshot value
//
// This is an **async** matcher so use await!
await expect("body").toMatchDOMSnapshot();
});
jest-element-snapshots exports a function that will take one optional arg, an object of configuration params.
All params are optional.
pageA reference to the puppeteer page object. If you're using jest-puppeteer the default will work fine.
waitForIf truthy will make the matcher wait for the selector to exist in the DOM before attempting to read the element from the DOM. If falsey the matcher will attempt to read the element from the DOM immediately.
expect(<string|ElementHandle> element).toMatchDOMSnapshot(<string> hint, <object> options)
elementEither a string CSS selector, or a puppeteer ElementHandle. Will be used to locate the element in the DOM to snapshot.
hintA string that is passed to the underlying jest .toMatchSnapshot() code as the hint parameter to give snapshots an extra name, useful for differentiating multiple snapshots in a single test.
optionsSnapshot-specific options, will override any options set globally.
waitForIf truthy will make the matcher wait for the selector to exist in the DOM before attempting to read the element from the DOM. If falsey the matcher will attempt to read the element from the DOM immediately.
FAQs
Test against snapshots of DOM elements
The npm package jest-element-snapshots receives a total of 1 weekly downloads. As such, jest-element-snapshots popularity was classified as not popular.
We found that jest-element-snapshots 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.