Skip to content

Commit 58a9ebb

Browse files
committed
Add test for inspector import
1 parent 8d3bae0 commit 58a9ebb

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-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: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ 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+
.ignore('session')
83+
.start(done);
84+
});
85+
7986
test('Includes local variables for caught exceptions when enabled', done => {
8087
createRunner(__dirname, 'local-variables-caught.js')
8188
.ignore('session')

0 commit comments

Comments
 (0)