New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@zappar/jest-console-logs

Package Overview
Dependencies
Maintainers
11
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zappar/jest-console-logs - npm Package Compare versions

Comparing version

to
1.0.2

4

CHANGELOG.md
# Changelog
## [1.0.1] - 2022-01-24
- Updated dependencies
## [1.0.0-rc.1] - [1.0.0] - 2021-06-28

@@ -4,0 +8,0 @@

2

lib/index.d.ts

@@ -1,1 +0,1 @@

export { expectLogs, waitForLogs, expectSequential } from './logs';
export { expectLogs, waitForLogs, expectSequential } from "./logs";

@@ -1,2 +0,2 @@

import { Page } from 'puppeteer';
import { Page } from "puppeteer";
declare type Opts1 = {

@@ -3,0 +3,0 @@ expected: (string | RegExp)[];

@@ -22,7 +22,7 @@ "use strict";

const expectSequential = (opts) => new Promise((resolve, reject) => {
const { expected, page, timeoutMs, ignore, } = opts;
const { expected, page, timeoutMs, ignore } = opts;
let currentIndex = 0;
const timeout = setTimeout(() => {
page.off('console', compare);
reject(new Error('Timeout waiting for console logs'));
page.off("console", compare);
reject(new Error("Timeout waiting for console logs"));
}, timeoutMs);

@@ -34,8 +34,8 @@ function compare(evt) {

let passes = false;
if (typeof _expected === 'string' && evt.text() === _expected)
if (typeof _expected === "string" && evt.text() === _expected)
passes = true;
else if (typeof _expected !== 'string' && _expected.test(evt.text()))
else if (typeof _expected !== "string" && _expected.test(evt.text()))
passes = true;
if (!passes) {
page.off('console', compare);
page.off("console", compare);
clearTimeout(timeout);

@@ -48,3 +48,3 @@ reject(new Error(`Non-matching console log (got !== expected) "${evt.text()}" !== "${expected[currentIndex]}"`));

clearTimeout(timeout);
page.off('console', compare);
page.off("console", compare);
resolve();

@@ -54,3 +54,3 @@ }

}
page.on('console', compare);
page.on("console", compare);
});

@@ -70,3 +70,3 @@ exports.expectSequential = expectSequential;

for (let i = 0; i < expected.length; i += 1) {
if (typeof expected[i] === 'string') {
if (typeof expected[i] === "string") {
// Check if that string matches the current console log.

@@ -87,3 +87,3 @@ if (expected[i] === currentPageLog) {

// Stop listening for logs.
page.off('console', compare);
page.off("console", compare);
// Stop ticking 'out of time'.

@@ -95,6 +95,6 @@ clearTimeout(timeout);

const outOfTime = () => {
page.off('console', compare);
page.off("console", compare);
reject(new Error(`Could not find expected console logs: ${expected}`));
};
page.on('console', compare);
page.on("console", compare);
const timeout = setTimeout(outOfTime, timeoutMs);

@@ -106,8 +106,8 @@ });

const timeout = setTimeout(() => {
page.off('console', compare);
reject(new Error('Timeout waiting for console logs'));
page.off("console", compare);
reject(new Error("Timeout waiting for console logs"));
}, timeoutMs);
function compare(evt) {
if (evt.text() === log) {
page.off('console', compare);
page.off("console", compare);
clearTimeout(timeout);

@@ -117,5 +117,5 @@ resolve();

}
page.on('console', compare);
page.on("console", compare);
});
});
exports.waitForLogs = waitForLogs;
{
"name": "@zappar/jest-console-logs",
"version": "1.0.0",
"version": "1.0.2",
"description": "Capture and test console logs using jest/puppeteer",

@@ -31,30 +31,32 @@ "main": "lib/index.js",

"devDependencies": {
"@types/expect-puppeteer": "^2.2.1",
"@types/jest": "^22.2.3",
"@types/jest-environment-puppeteer": "^2.2.0",
"@types/node": "^14.14.35",
"@types/pixelmatch": "^5.2.2",
"@types/pngjs": "^6.0.0",
"@types/puppeteer": "^1.2.3",
"@typescript-eslint/eslint-plugin": "^4.18.0",
"@typescript-eslint/parser": "^4.18.0",
"eslint": "^7.22.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-plugin-import": "^2.22.1",
"file-loader": "^6.2.0",
"html-webpack-plugin": "^5.3.1",
"jest": "^27.0.5",
"jest-puppeteer": "^2.4.0",
"jsdom": "^16.5.1",
"puppeteer": "^1.3.0",
"ts-jest": "^27.0.3",
"ts-loader": "^8.0.18",
"typescript": "^4.2.3",
"webpack": "^5.27.2",
"webpack-cli": "^4.5.0",
"webpack-dev-server": "^3.11.1"
"@types/expect-puppeteer": "4.4.7",
"@types/jest": "27.4.0",
"@types/jest-environment-puppeteer": "4.4.1",
"@types/node": "15.14.1",
"@types/puppeteer": "5.4.4",
"@typescript-eslint/eslint-plugin": "5.10.0",
"@typescript-eslint/parser": "5.10.0",
"eslint": "8.7.0",
"eslint-config-airbnb-base": "15.0.0",
"eslint-config-prettier": "8.3.0",
"eslint-plugin-import": "2.25.4",
"eslint-plugin-prettier": "4.0.0",
"eslint-plugin-tsdoc": "0.2.14",
"eslint-webpack-plugin": "3.1.1",
"file-loader": "6.2.0",
"html-webpack-plugin": "5.5.0",
"jest": "27.4.7",
"jest-puppeteer": "6.0.3",
"prettier": "2.5.1",
"puppeteer": "9.1.1",
"ts-jest": "27.1.3",
"ts-loader": "9.2.6",
"typescript": "4.5.5",
"webpack": "5.67.0",
"webpack-cli": "4.9.1",
"webpack-dev-server": "4.7.3"
},
"peerDependencies": {
"puppeteer": "^1.3.0"
"puppeteer": ">=1.3.0 <=13.1.1"
}
}

@@ -24,3 +24,3 @@ # jest-console-logs

<!-- Added by: zapparadmin, at: Mon Jun 28 13:59:44 BST 2021 -->
<!-- Added by: zapparadmin, at: Mon Jan 24 12:33:14 GMT 2022 -->

@@ -27,0 +27,0 @@ <!--te-->