cypress-log-to-output
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "cypress-log-to-output", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Sends all browser console logs to stdout while running your Cypress tests.", | ||
@@ -5,0 +5,0 @@ "main": "src/log-to-output.js", |
const CDP = require('chrome-remote-interface') | ||
const chalk = require('chalk') | ||
let eventFilter | ||
const severityColors = { | ||
@@ -23,2 +25,6 @@ 'verbose': (a) => a, | ||
function logEntry(params) { | ||
if (eventFilter && !eventFilter('browser', params.entry)) { | ||
return | ||
} | ||
const { level, source, text, timestamp, url, lineNumber, stackTrace, args } = params.entry | ||
@@ -54,2 +60,6 @@ const color = severityColors[level] | ||
function logConsole(params) { | ||
if (eventFilter && !eventFilter('console', params)) { | ||
return | ||
} | ||
const { type, args, timestamp } = params | ||
@@ -75,3 +85,4 @@ const level = type === 'error' ? 'error' : 'verbose' | ||
function install(on) { | ||
function install(on, filter) { | ||
eventFilter = filter | ||
on('before:browser:launch', browserLaunchHandler) | ||
@@ -78,0 +89,0 @@ } |
5378
105