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

debugger-is-attached

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

debugger-is-attached

lets you know if a debugger is _actually_ attached

  • 1.4.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
23
decreased by-70.51%
Maintainers
0
Weekly downloads
 
Created
Source

debugger-is-attached

Test

npm

What?

Lets you know if a debugger is actually attached

Why?

Sometimes I need to modify execution due to a debugger being attached. The most obvious use-case is for setting a longer test timeout when debugging a test.

There are other packages which do this!

Sort of. Some other attempts have been to observe the command-line parameters of the current process, which doesn't work when, eg, debugging a test in WebStorm. Also, debuggers can detach.

This solution is based on a GitHub comment so you know it's the real deal!

Usage

describe(`some fixture`, () => {
  beforeEach(async () => {
      const
        debugging = await debuggerIsAttached(),
        timeout = debugging ? 300000 : 5000;
      jest.setTimeout(timeout);
  });
  it(`should do the things`, async () => {
    // Arrange
    // Act
    // Assert
  });
})

Credits

  • to the author of the original comment, mscdex
  • newts for bootstrapping this easily so I could just "get it out the door"

FAQs

Package last updated on 13 Nov 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