Skip to content

Commit

Permalink
Add test for inspector import
Browse files Browse the repository at this point in the history
  • Loading branch information
timfish committed May 27, 2024
1 parent 8d3bae0 commit 197d9a5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import * as Sentry from '@sentry/node';
import Hook from 'import-in-the-middle';

Hook((_, name) => {
if (name === 'inspector') {
throw new Error('No inspector!');
}
if (name === 'node:inspector') {
throw new Error('No inspector!');
}
});

Sentry.init({});
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ conditionalTest({ min: 18 })('LocalVariables integration', () => {
.start(done);
});

test('Should not import inspector when not in use', done => {
createRunner(__dirname, 'deny-inspector.mjs')
.withFlags('--import=@sentry/node/import')
.ensureNoErrorOutput()
.ignore('session')
.start(done);
});

test('Includes local variables for caught exceptions when enabled', done => {
createRunner(__dirname, 'local-variables-caught.js')
.ignore('session')
Expand Down

0 comments on commit 197d9a5

Please sign in to comment.