Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@error-paparazzi/jest

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@error-paparazzi/jest - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

3

lib/index.d.ts

@@ -5,4 +5,5 @@ import { LaunchOptions } from "puppeteer";

}
export declare const screenshot: ({ launchOptions }?: IScreenshotOptions) => Promise<void>;
export declare const takeScreenshot: ({ launchOptions }?: IScreenshotOptions) => Promise<void>;
export declare const paparazzi: (fn: any, options?: IScreenshotOptions) => () => Promise<void>;
export declare const takeScreenshotOnTestError: (options?: IScreenshotOptions) => void;
//# sourceMappingURL=index.d.ts.map

@@ -10,3 +10,3 @@ "use strict";

const puppeteer_1 = __importDefault(require("puppeteer"));
exports.screenshot = async ({ launchOptions } = { launchOptions: {} }) => {
exports.takeScreenshot = async ({ launchOptions } = { launchOptions: {} }) => {
const browser = await puppeteer_1.default.launch(launchOptions);

@@ -19,15 +19,15 @@ const page = await browser.newPage();

};
exports.paparazzi = (fn, options = { launchOptions: {} }) => async () => {
try {
await fn();
}
catch (e) {
if (!is_ci_1.default)
await exports.takeScreenshot(options);
throw e;
}
};
exports.takeScreenshotOnTestError = (options = { launchOptions: {} }) => {
const wrapTestToMakeScreenshotOnError = (fn) => async () => {
try {
await fn();
}
catch (e) {
if (!is_ci_1.default)
await exports.screenshot(options);
throw e;
}
};
const wrapApply = (target, that, args) => {
args[1] = wrapTestToMakeScreenshotOnError(args[1]);
args[1] = exports.paparazzi(args[1], options);
target.apply(that, args);

@@ -34,0 +34,0 @@ };

{
"name": "@error-paparazzi/jest",
"version": "0.0.5",
"version": "0.0.6",
"description": "Make screenshot of JSDOM when your jest test failed",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -10,3 +10,3 @@ import isCi from "is-ci";

export const screenshot = async (
export const takeScreenshot = async (
{ launchOptions }: IScreenshotOptions = { launchOptions: {} }

@@ -22,16 +22,19 @@ ) => {

export const paparazzi = (
fn: any,
options: IScreenshotOptions = { launchOptions: {} }
) => async () => {
try {
await fn();
} catch (e) {
if (!isCi) await takeScreenshot(options);
throw e;
}
};
export const takeScreenshotOnTestError = (
options: IScreenshotOptions = { launchOptions: {} }
) => {
const wrapTestToMakeScreenshotOnError = (fn: any) => async () => {
try {
await fn();
} catch (e) {
if (!isCi) await screenshot(options);
throw e;
}
};
const wrapApply = (target: jest.It, that: any, args: Parameters<jest.It>) => {
args[1] = wrapTestToMakeScreenshotOnError(args[1]);
args[1] = paparazzi(args[1], options);
target.apply(that, args);

@@ -38,0 +41,0 @@ };

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc