Skip to content

Commit 197d9a5

Browse files
committed
Add test for inspector import
1 parent 8d3bae0 commit 197d9a5

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import * as Sentry from '@sentry/node';
2+
import Hook from 'import-in-the-middle';
3+
4+
Hook((_, name) => {
5+
if (name === 'inspector') {
6+
throw new Error('No inspector!');
7+
}
8+
if (name === 'node:inspector') {
9+
throw new Error('No inspector!');
10+
}
11+
});
12+
13+
Sentry.init({});

dev-packages/node-integration-tests/suites/public-api/LocalVariables/test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,14 @@ conditionalTest({ min: 18 })('LocalVariables integration', () => {
7676
.start(done);
7777
});
7878

79+
test('Should not import inspector when not in use', done => {
80+
createRunner(__dirname, 'deny-inspector.mjs')
81+
.withFlags('--import=@sentry/node/import')
82+
.ensureNoErrorOutput()
83+
.ignore('session')
84+
.start(done);
85+
});
86+
7987
test('Includes local variables for caught exceptions when enabled', done => {
8088
createRunner(__dirname, 'local-variables-caught.js')
8189
.ignore('session')

0 commit comments

Comments
 (0)