# debugger-is-attached

> lets you know if a debugger is _actually_ attached

Latest version **2.1.0** (published 2026-03-16) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install debugger-is-attached
pnpm add debugger-is-attached
yarn add debugger-is-attached
bun add debugger-is-attached
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2026-03-16 |
| First published | 2020-07-24 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Davyd McColl |
| Maintainers | fluffynuts |

## Links

- npm: https://www.npmjs.com/package/debugger-is-attached
- Repository: https://github.com/fluffynuts/debugger-is-attached
- Homepage: https://github.com/fluffynuts/debugger-is-attached#readme
- Issues: https://github.com/fluffynuts/debugger-is-attached/issues
- npm.io page: https://npm.io/package/debugger-is-attached

## Recent versions

- 2.1.0 (latest) — 2026-03-16
- 2.0.1 (beta) — 2026-03-16
- 1.4.0 — 2024-11-13
- 1.3.0 — 2024-11-13
- 1.2.0 — 2020-07-24
- 1.1.0 — 2020-07-24
- 1.0.0 — 2020-07-24

## README

debugger-is-attached
---
![Test](https://github.com/fluffynuts/debugger-is-attached/workflows/Tests/badge.svg)

![npm](https://img.shields.io/npm/v/debugger-is-attached)

## What?

Lets you know if the node inspector is attached (which it will be if someone
is intending to debug). Version 2 changes how this is done and can no longer
tell the difference between just having the inspector attached, and actually
having an active debugger. But for the case of extending test timeouts when
a dev is debugging, this method is still valid.

## 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.

## Usage

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

---
_Source: https://npm.io/package/debugger-is-attached · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
