Skip to content

Commit

Permalink
add esm integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
Lms24 committed Dec 2, 2024
1 parent ef84618 commit a4ee349
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import * as Sentry from '@sentry/node';
import { loggingTransport } from '@sentry-internal/node-integration-tests';

Sentry.init({
dsn: 'https://public@dsn.ingest.sentry.io/1337',
release: '1.0',
autoSessionTracking: false,
transport: loggingTransport,
debug: true,
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import * as Sentry from '@sentry/node';

Sentry.captureException(new Error('Test Error'));

// some more post context
39 changes: 39 additions & 0 deletions dev-packages/node-integration-tests/suites/contextLines/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { join } from 'path';
import { createRunner } from '../../utils/runner';

describe('ContextLines integration', () => {
test('reads context lines from filenames with spaces', done => {
expect.assertions(1);
const instrumentPath = join(__dirname, 'instrument.mjs');

createRunner(__dirname, 'scenario with space.mjs')
.withFlags('--import', instrumentPath)
.expect({
event: {
exception: {
values: [
{
value: 'Test Error',
stacktrace: {
frames: expect.arrayContaining([
{
filename: expect.stringMatching(/\/scenario with space.mjs$/),
context_line: "Sentry.captureException(new Error('Test Error'));",
pre_context: ["import * as Sentry from '@sentry/node';", ''],
post_context: ['', '// some more post context'],
colno: 25,
lineno: 3,
function: '?',
in_app: true,
module: 'scenario%20with%20space',
},
]),
},
},
],
},
},
})
.start(done);
});
});

0 comments on commit a4ee349

Please sign in to comment.