lets you know if a debugger is _actually_ attached
npm install debugger-is-attacheddebugger-is-attached
---
!Test
!npm
Lets you know if a debugger is _actually_ attached
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.
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!
``some fixture
describe(, () => {should do the things
beforeEach(async () => {
const
debugging = await debuggerIsAttached(),
timeout = debugging ? 300000 : 5000;
jest.setTimeout(timeout);
});
it(, async () => {``
// Arrange
// Act
// Assert
});
})