Skip to content

Commit a4ee349

Browse files
committed
add esm integration test
1 parent ef84618 commit a4ee349

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import * as Sentry from '@sentry/node';
2+
import { loggingTransport } from '@sentry-internal/node-integration-tests';
3+
4+
Sentry.init({
5+
dsn: 'https://public@dsn.ingest.sentry.io/1337',
6+
release: '1.0',
7+
autoSessionTracking: false,
8+
transport: loggingTransport,
9+
debug: true,
10+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import * as Sentry from '@sentry/node';
2+
3+
Sentry.captureException(new Error('Test Error'));
4+
5+
// some more post context
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { join } from 'path';
2+
import { createRunner } from '../../utils/runner';
3+
4+
describe('ContextLines integration', () => {
5+
test('reads context lines from filenames with spaces', done => {
6+
expect.assertions(1);
7+
const instrumentPath = join(__dirname, 'instrument.mjs');
8+
9+
createRunner(__dirname, 'scenario with space.mjs')
10+
.withFlags('--import', instrumentPath)
11+
.expect({
12+
event: {
13+
exception: {
14+
values: [
15+
{
16+
value: 'Test Error',
17+
stacktrace: {
18+
frames: expect.arrayContaining([
19+
{
20+
filename: expect.stringMatching(/\/scenario with space.mjs$/),
21+
context_line: "Sentry.captureException(new Error('Test Error'));",
22+
pre_context: ["import * as Sentry from '@sentry/node';", ''],
23+
post_context: ['', '// some more post context'],
24+
colno: 25,
25+
lineno: 3,
26+
function: '?',
27+
in_app: true,
28+
module: 'scenario%20with%20space',
29+
},
30+
]),
31+
},
32+
},
33+
],
34+
},
35+
},
36+
})
37+
.start(done);
38+
});
39+
});

0 commit comments

Comments
 (0)