Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
@rws-air/jestscreenshot
Advanced tools
Jest reporter plugin to take Puppeteer screenshots on failing tests
Project Status
Bundle Sizes
Versions
Our Badges
yarn add -D @rws-air/jestscreenshot @types/jest-environment-puppeteer jest-circus jest-environment-puppeteer
const JestScreenshot = require('@rws-air/jestscreenshot');
This library supports uploading your screenshots to Slack by providing the SLACK_WEBTOKEN
environment variable, or, through the slackToken
option. You will also nede to provide the Slack Channel ID(s) through the option slackChannels
and setting slackUpload
option to true
.
Please note that you cannot use ES module imports in the jest-enviroment.ts
file. Jest does not support them.
// jest.config.js
module.exports = {
testRunner: 'jest-circus/runner',
testEnvironment: '<rootDir>/__tests__/jest-environment.js',
testMatch: ['<rootDir>/__tests__/index.test.ts'],
globalSetup: 'jest-environment-puppeteer/setup',
globalTeardown: 'jest-environment-puppeteer/teardown',
setupFilesAfterEnv: ['expect-puppeteer', '<rootDir>/__tests__/jest-framework.ts']
};
// jest-framework.ts
jest.retryTimes(2);
// jest-environment.ts
/* eslint-disable @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports, @typescript-eslint/explicit-member-accessibility */
const PuppeteerEnvironment = require('jest-environment-puppeteer');
const JestScreenshot = require('@rws-air/jestscreenshot');
require('jest-circus');
const retryAttempts = process.env.RETRY_ATTEMPTS || 2;
// @ts-ignore
class CustomEnvironment extends PuppeteerEnvironment {
async setup() {
await super.setup();
if (!process.env.CI) await this.localSetup();
}
async teardown() {
// @ts-ignore
await this.global.page.waitFor(2000);
await super.teardown();
}
async handleTestEvent(event, state) {
if (event.name === 'test_fn_failure') {
if (state.currentlyRunningTest.invocations > retryAttempts) {
const testName = state.currentlyRunningTest.name;
const jestScreenshot = new JestScreenshot({
page: this.global.page,
dirName: __dirname,
testName,
slackChannels: ['ChannelID'],
slackUpload: true
});
await jestScreenshot.setup();
}
}
}
}
module.exports = CustomEnvironment;
Check out the docs on github pages
FAQs
Jest reporter plugin to take Puppeteer screenshots on failing tests
The npm package @rws-air/jestscreenshot receives a total of 44 weekly downloads. As such, @rws-air/jestscreenshot popularity was classified as not popular.
We found that @rws-air/jestscreenshot demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.