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

console-silencer

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

console-silencer

silences console.log/error output except for those originating from testrunner

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

console-silencer

This zero-dependencies module allows you to silence console.log and console.error from the code that is currently tested without silencing the logs of your testrunner. Module is intended for use in Node JS v8.x enviroment.

Installation

To install please run

npm i -D console-silencer

Usage

This module exports a function that accepts one argument - a String with the word pattern of your testrunner logs (usually the name of the test running tool. Inside the first file executed in your test suite you need to require this module

require('console-silencer')('mocha');

or, if it seems more convinient to you:

const silencer = require('console-silencer');
silencer('mocha');

The function shall replace console.log and console.error functions with the one that checks its stack and if this stack includes an argument pattern as a substring - makes log into console, otherwise it does nothing.

Keywords

FAQs

Package last updated on 27 Jul 2018

Did you know?

Socket

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.

Install

Related posts

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