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

jest-fail-on-console

Package Overview
Dependencies
Maintainers
0
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-fail-on-console

Utility to make jest tests fail when console.error() or console.warn() are used

  • 3.3.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
351K
decreased by-12.39%
Maintainers
0
Weekly downloads
 
Created

What is jest-fail-on-console?

The jest-fail-on-console npm package is designed to make your Jest tests fail if any console methods (like console.log, console.error, etc.) are called during the test run. This helps ensure that your tests are clean and free of unexpected console output, which can be indicative of underlying issues or forgotten debug statements.

What are jest-fail-on-console's main functionalities?

Fail on console.log

This feature makes the test fail if console.log is called during the test execution. It helps in identifying and removing unnecessary or forgotten console.log statements.

require('jest-fail-on-console');

// In your test file
it('should fail if console.log is called', () => {
  console.log('This will cause the test to fail');
  expect(true).toBe(true);
});

Fail on console.error

This feature makes the test fail if console.error is called during the test execution. It helps in catching errors that are logged to the console, ensuring they are properly handled.

require('jest-fail-on-console');

// In your test file
it('should fail if console.error is called', () => {
  console.error('This will cause the test to fail');
  expect(true).toBe(true);
});

Fail on console.warn

This feature makes the test fail if console.warn is called during the test execution. It helps in identifying and addressing warnings that are logged to the console.

require('jest-fail-on-console');

// In your test file
it('should fail if console.warn is called', () => {
  console.warn('This will cause the test to fail');
  expect(true).toBe(true);
});

Other packages similar to jest-fail-on-console

Keywords

FAQs

Package last updated on 02 Oct 2024

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