File tree 38 files changed +541
-245
lines changed
dev-packages/node-integration-tests
common-infix-parameterized
common-prefix-parameterized
common-prefix-parameterized-reverse
common-prefix-same-length-parameterized
common-prefix-same-length-parameterized copy
middle-layer-parameterized
baggage-other-vendors-with-sentry-entries
public-api/LocalVariables
38 files changed +541
-245
lines changed Original file line number Diff line number Diff line change 1
1
import { conditionalTest } from '../../utils' ;
2
- import { createRunner } from '../../utils/runner' ;
2
+ import { cleanupChildProcesses , createRunner } from '../../utils/runner' ;
3
3
4
4
const EXPECTED_ANR_EVENT = {
5
5
// Ensure we have context
@@ -52,6 +52,10 @@ const EXPECTED_ANR_EVENT = {
52
52
} ;
53
53
54
54
conditionalTest ( { min : 16 } ) ( 'should report ANR when event loop blocked' , ( ) => {
55
+ afterAll ( ( ) => {
56
+ cleanupChildProcesses ( ) ;
57
+ } ) ;
58
+
55
59
// TODO (v8): Remove this old API and this test
56
60
test ( 'Legacy API' , done => {
57
61
createRunner ( __dirname , 'legacy.js' ) . expect ( { event : EXPECTED_ANR_EVENT } ) . start ( done ) ;
Original file line number Diff line number Diff line change
1
+ import { loggingTransport , startExpressServerAndSendPortToRunner } from '@sentry-internal/node-integration-tests' ;
1
2
import * as Sentry from '@sentry/node' ;
2
3
import express from 'express' ;
3
4
@@ -6,6 +7,7 @@ const app = express();
6
7
Sentry . init ( {
7
8
dsn : 'https://public@dsn.ingest.sentry.io/1337' ,
8
9
release : '1.0' ,
10
+ transport : loggingTransport ,
9
11
} ) ;
10
12
11
13
app . use ( Sentry . Handlers . requestHandler ( ) ) ;
@@ -16,4 +18,4 @@ app.get('/test/express', () => {
16
18
17
19
app . use ( Sentry . Handlers . errorHandler ( ) ) ;
18
20
19
- export default app ;
21
+ startExpressServerAndSendPortToRunner ( app ) ;
Original file line number Diff line number Diff line change 1
- import { TestEnv , assertSentryEvent } from '../../../utils/index ' ;
1
+ import { cleanupChildProcesses , createRunner } from '../../../utils/runner ' ;
2
2
3
- test ( 'should capture and send Express controller error.' , async ( ) => {
4
- const env = await TestEnv . init ( __dirname , `${ __dirname } /server.ts` ) ;
5
- const event = await env . getEnvelopeRequest ( { url : `${ env . url } /express` } ) ;
6
-
7
- expect ( ( event [ 2 ] as any ) . exception . values [ 0 ] . stacktrace . frames . length ) . toBeGreaterThan ( 0 ) ;
3
+ afterAll ( ( ) => {
4
+ cleanupChildProcesses ( ) ;
5
+ } ) ;
8
6
9
- assertSentryEvent ( event [ 2 ] as any , {
10
- exception : {
11
- values : [
12
- {
13
- mechanism : {
14
- type : 'middleware' ,
15
- handled : false ,
16
- } ,
17
- type : 'Error' ,
18
- value : 'test_error' ,
7
+ test ( 'should capture and send Express controller error.' , done => {
8
+ const runner = createRunner ( __dirname , 'server.ts' )
9
+ . ignore ( 'session' , 'sessions' )
10
+ . expect ( {
11
+ event : {
12
+ exception : {
13
+ values : [
14
+ {
15
+ mechanism : {
16
+ type : 'middleware' ,
17
+ handled : false ,
18
+ } ,
19
+ type : 'Error' ,
20
+ value : 'test_error' ,
21
+ stacktrace : {
22
+ frames : expect . arrayContaining ( [
23
+ expect . objectContaining ( {
24
+ function : expect . any ( String ) ,
25
+ lineno : expect . any ( Number ) ,
26
+ colno : expect . any ( Number ) ,
27
+ } ) ,
28
+ ] ) ,
29
+ } ,
30
+ } ,
31
+ ] ,
19
32
} ,
20
- ] ,
21
- } ,
22
- } ) ;
33
+ } ,
34
+ } )
35
+ . start ( done ) ;
36
+
37
+ expect ( ( ) => runner . makeRequest ( 'get' , '/test/express' ) ) . rejects . toThrow ( ) ;
23
38
} ) ;
Original file line number Diff line number Diff line change
1
+ import { loggingTransport , startExpressServerAndSendPortToRunner } from '@sentry-internal/node-integration-tests' ;
1
2
import * as Sentry from '@sentry/node' ;
2
3
import * as Tracing from '@sentry/tracing' ;
3
4
import cors from 'cors' ;
@@ -11,6 +12,7 @@ Sentry.init({
11
12
// eslint-disable-next-line deprecation/deprecation
12
13
integrations : [ new Sentry . Integrations . Http ( { tracing : true } ) , new Tracing . Integrations . Express ( { app } ) ] ,
13
14
tracesSampleRate : 1.0 ,
15
+ transport : loggingTransport ,
14
16
} ) ;
15
17
16
18
app . use ( Sentry . Handlers . requestHandler ( ) ) ;
@@ -32,4 +34,4 @@ app.use('/api/v1', APIv1);
32
34
33
35
app . use ( Sentry . Handlers . errorHandler ( ) ) ;
34
36
35
- export default app ;
37
+ startExpressServerAndSendPortToRunner ( app ) ;
Original file line number Diff line number Diff line change 1
- import { TestEnv , assertSentryEvent } from '../../../../utils/index ' ;
1
+ import { cleanupChildProcesses , createRunner } from '../../../../utils/runner ' ;
2
2
3
- test ( 'should construct correct url with common infixes with multiple parameterized routers.' , async ( ) => {
4
- const env = await TestEnv . init ( __dirname , ` ${ __dirname } /server.ts` ) ;
5
- const event = await env . getEnvelopeRequest ( { url : env . url . replace ( 'test' , 'api/v1/user/3212' ) } ) ;
3
+ afterAll ( ( ) => {
4
+ cleanupChildProcesses ( ) ;
5
+ } ) ;
6
6
7
- assertSentryEvent ( event [ 2 ] as any , {
8
- message : 'Custom Message' ,
9
- transaction : 'GET /api/v1/user/:userId' ,
10
- } ) ;
7
+ test ( 'should construct correct url with common infixes with multiple parameterized routers.' , done => {
8
+ createRunner ( __dirname , 'server.ts' )
9
+ . ignore ( 'transaction' , 'session' , 'sessions' )
10
+ . expect ( { event : { message : 'Custom Message' , transaction : 'GET /api/v1/user/:userId' } } )
11
+ . start ( done )
12
+ . makeRequest ( 'get' , '/api/v1/user/3212' ) ;
11
13
} ) ;
Original file line number Diff line number Diff line change
1
+ import { loggingTransport , startExpressServerAndSendPortToRunner } from '@sentry-internal/node-integration-tests' ;
1
2
import * as Sentry from '@sentry/node' ;
2
3
import * as Tracing from '@sentry/tracing' ;
3
4
import cors from 'cors' ;
@@ -11,6 +12,7 @@ Sentry.init({
11
12
// eslint-disable-next-line deprecation/deprecation
12
13
integrations : [ new Sentry . Integrations . Http ( { tracing : true } ) , new Tracing . Integrations . Express ( { app } ) ] ,
13
14
tracesSampleRate : 1.0 ,
15
+ transport : loggingTransport ,
14
16
} ) ;
15
17
16
18
app . use ( Sentry . Handlers . requestHandler ( ) ) ;
@@ -32,4 +34,4 @@ app.use('/api2/v1', APIv1);
32
34
33
35
app . use ( Sentry . Handlers . errorHandler ( ) ) ;
34
36
35
- export default app ;
37
+ startExpressServerAndSendPortToRunner ( app ) ;
Original file line number Diff line number Diff line change 1
- import { TestEnv , assertSentryEvent } from '../../../../utils/index ' ;
1
+ import { cleanupChildProcesses , createRunner } from '../../../../utils/runner ' ;
2
2
3
- test ( 'should construct correct url with common infixes with multiple routers.' , async ( ) => {
4
- const env = await TestEnv . init ( __dirname , ` ${ __dirname } /server.ts` ) ;
5
- const event = await env . getEnvelopeRequest ( { url : env . url . replace ( 'test' , 'api2/v1/test/' ) } ) ;
3
+ afterAll ( ( ) => {
4
+ cleanupChildProcesses ( ) ;
5
+ } ) ;
6
6
7
- assertSentryEvent ( event [ 2 ] as any , {
8
- message : 'Custom Message' ,
9
- transaction : 'GET /api2/v1/test' ,
10
- } ) ;
7
+ test ( 'should construct correct url with common infixes with multiple routers.' , done => {
8
+ createRunner ( __dirname , 'server.ts' )
9
+ . ignore ( 'transaction' , 'session' , 'sessions' )
10
+ . expect ( { event : { message : 'Custom Message' , transaction : 'GET /api2/v1/test' } } )
11
+ . start ( done )
12
+ . makeRequest ( 'get' , '/api2/v1/test' ) ;
11
13
} ) ;
Original file line number Diff line number Diff line change
1
+ import { loggingTransport , startExpressServerAndSendPortToRunner } from '@sentry-internal/node-integration-tests' ;
1
2
import * as Sentry from '@sentry/node' ;
2
3
import * as Tracing from '@sentry/tracing' ;
3
4
import cors from 'cors' ;
@@ -11,6 +12,7 @@ Sentry.init({
11
12
// eslint-disable-next-line deprecation/deprecation
12
13
integrations : [ new Sentry . Integrations . Http ( { tracing : true } ) , new Tracing . Integrations . Express ( { app } ) ] ,
13
14
tracesSampleRate : 1.0 ,
15
+ transport : loggingTransport ,
14
16
} ) ;
15
17
16
18
app . use ( Sentry . Handlers . requestHandler ( ) ) ;
@@ -32,4 +34,4 @@ app.use('/api', root);
32
34
33
35
app . use ( Sentry . Handlers . errorHandler ( ) ) ;
34
36
35
- export default app ;
37
+ startExpressServerAndSendPortToRunner ( app ) ;
Original file line number Diff line number Diff line change 1
- import { TestEnv , assertSentryEvent } from '../../../../utils/index ' ;
1
+ import { cleanupChildProcesses , createRunner } from '../../../../utils/runner ' ;
2
2
3
- test ( 'should construct correct urls with multiple parameterized routers (use order reversed).' , async ( ) => {
4
- const env = await TestEnv . init ( __dirname , ` ${ __dirname } /server.ts` ) ;
5
- const event = await env . getEnvelopeRequest ( { url : env . url . replace ( 'test' , 'api/v1/user/1234/' ) } ) ;
3
+ afterAll ( ( ) => {
4
+ cleanupChildProcesses ( ) ;
5
+ } ) ;
6
6
7
- assertSentryEvent ( event [ 2 ] as any , {
8
- message : 'Custom Message' ,
9
- transaction : 'GET /api/v1/user/:userId' ,
10
- } ) ;
7
+ test ( 'should construct correct urls with multiple parameterized routers (use order reversed).' , done => {
8
+ createRunner ( __dirname , 'server.ts' )
9
+ . ignore ( 'transaction' , 'session' , 'sessions' )
10
+ . expect ( { event : { message : 'Custom Message' , transaction : 'GET /api/v1/user/:userId' } } )
11
+ . start ( done )
12
+ . makeRequest ( 'get' , '/api/v1/user/1234/' ) ;
11
13
} ) ;
Original file line number Diff line number Diff line change
1
+ import { loggingTransport , startExpressServerAndSendPortToRunner } from '@sentry-internal/node-integration-tests' ;
1
2
import * as Sentry from '@sentry/node' ;
2
3
import * as Tracing from '@sentry/tracing' ;
3
4
import cors from 'cors' ;
@@ -11,6 +12,7 @@ Sentry.init({
11
12
// eslint-disable-next-line deprecation/deprecation
12
13
integrations : [ new Sentry . Integrations . Http ( { tracing : true } ) , new Tracing . Integrations . Express ( { app } ) ] ,
13
14
tracesSampleRate : 1.0 ,
15
+ transport : loggingTransport ,
14
16
} ) ;
15
17
16
18
app . use ( Sentry . Handlers . requestHandler ( ) ) ;
@@ -32,4 +34,4 @@ app.use('/api/v1', APIv1);
32
34
33
35
app . use ( Sentry . Handlers . errorHandler ( ) ) ;
34
36
35
- export default app ;
37
+ startExpressServerAndSendPortToRunner ( app ) ;
Original file line number Diff line number Diff line change 1
- import { TestEnv , assertSentryEvent } from '../../../../utils/index ' ;
1
+ import { cleanupChildProcesses , createRunner } from '../../../../utils/runner ' ;
2
2
3
- test ( 'should construct correct urls with multiple parameterized routers.' , async ( ) => {
4
- const env = await TestEnv . init ( __dirname , ` ${ __dirname } /server.ts` ) ;
5
- const event = await env . getEnvelopeRequest ( { url : env . url . replace ( 'test' , 'api/v1/user/1234/' ) } ) ;
3
+ afterAll ( ( ) => {
4
+ cleanupChildProcesses ( ) ;
5
+ } ) ;
6
6
7
- assertSentryEvent ( event [ 2 ] as any , {
8
- message : 'Custom Message' ,
9
- transaction : 'GET /api/v1/user/:userId' ,
10
- } ) ;
7
+ test ( 'should construct correct urls with multiple parameterized routers.' , done => {
8
+ createRunner ( __dirname , 'server.ts' )
9
+ . ignore ( 'transaction' , 'session' , 'sessions' )
10
+ . expect ( { event : { message : 'Custom Message' , transaction : 'GET /api/v1/user/:userId' } } )
11
+ . start ( done )
12
+ . makeRequest ( 'get' , '/api/v1/user/1234/' ) ;
11
13
} ) ;
Original file line number Diff line number Diff line change
1
+ import { loggingTransport , startExpressServerAndSendPortToRunner } from '@sentry-internal/node-integration-tests' ;
1
2
import * as Sentry from '@sentry/node' ;
2
3
import * as Tracing from '@sentry/tracing' ;
3
4
import cors from 'cors' ;
@@ -11,6 +12,7 @@ Sentry.init({
11
12
// eslint-disable-next-line deprecation/deprecation
12
13
integrations : [ new Sentry . Integrations . Http ( { tracing : true } ) , new Tracing . Integrations . Express ( { app } ) ] ,
13
14
tracesSampleRate : 1.0 ,
15
+ transport : loggingTransport ,
14
16
} ) ;
15
17
16
18
app . use ( Sentry . Handlers . requestHandler ( ) ) ;
@@ -32,4 +34,4 @@ app.use('/api', root);
32
34
33
35
app . use ( Sentry . Handlers . errorHandler ( ) ) ;
34
36
35
- export default app ;
37
+ startExpressServerAndSendPortToRunner ( app ) ;
Original file line number Diff line number Diff line change 1
- import { TestEnv , assertSentryEvent } from '../../../../utils/index ' ;
1
+ import { cleanupChildProcesses , createRunner } from '../../../../utils/runner ' ;
2
2
3
- test ( 'should construct correct url with multiple parameterized routers of the same length (use order reversed).' , async ( ) => {
4
- const env = await TestEnv . init ( __dirname , ` ${ __dirname } /server.ts` ) ;
5
- const event = await env . getEnvelopeRequest ( { url : env . url . replace ( 'test' , 'api/v1/1234/' ) } ) ;
3
+ afterAll ( ( ) => {
4
+ cleanupChildProcesses ( ) ;
5
+ } ) ;
6
6
7
- assertSentryEvent ( event [ 2 ] as any , {
8
- message : 'Custom Message' ,
9
- transaction : 'GET /api/v1/:userId' ,
10
- } ) ;
7
+ test ( 'should construct correct url with multiple parameterized routers of the same length (use order reversed).' , done => {
8
+ createRunner ( __dirname , 'server.ts' )
9
+ . ignore ( 'transaction' , 'session' , 'sessions' )
10
+ . expect ( { event : { message : 'Custom Message' , transaction : 'GET /api/v1/:userId' } } )
11
+ . start ( done )
12
+ . makeRequest ( 'get' , '/api/v1/1234/' ) ;
11
13
} ) ;
Original file line number Diff line number Diff line change
1
+ import { loggingTransport , startExpressServerAndSendPortToRunner } from '@sentry-internal/node-integration-tests' ;
1
2
import * as Sentry from '@sentry/node' ;
2
3
import * as Tracing from '@sentry/tracing' ;
3
4
import cors from 'cors' ;
@@ -11,6 +12,7 @@ Sentry.init({
11
12
// eslint-disable-next-line deprecation/deprecation
12
13
integrations : [ new Sentry . Integrations . Http ( { tracing : true } ) , new Tracing . Integrations . Express ( { app } ) ] ,
13
14
tracesSampleRate : 1.0 ,
15
+ transport : loggingTransport ,
14
16
} ) ;
15
17
16
18
app . use ( Sentry . Handlers . requestHandler ( ) ) ;
@@ -32,4 +34,4 @@ app.use('/api/v1', APIv1);
32
34
33
35
app . use ( Sentry . Handlers . errorHandler ( ) ) ;
34
36
35
- export default app ;
37
+ startExpressServerAndSendPortToRunner ( app ) ;
Original file line number Diff line number Diff line change 1
- import { TestEnv , assertSentryEvent } from '../../../../utils/index ' ;
1
+ import { cleanupChildProcesses , createRunner } from '../../../../utils/runner ' ;
2
2
3
- test ( 'should construct correct url with multiple parameterized routers of the same length.' , async ( ) => {
4
- const env = await TestEnv . init ( __dirname , ` ${ __dirname } /server.ts` ) ;
5
- const event = await env . getEnvelopeRequest ( { url : env . url . replace ( 'test' , 'api/v1/1234/' ) } ) ;
3
+ afterAll ( ( ) => {
4
+ cleanupChildProcesses ( ) ;
5
+ } ) ;
6
6
7
- assertSentryEvent ( event [ 2 ] as any , {
8
- message : 'Custom Message' ,
9
- transaction : 'GET /api/v1/:userId' ,
10
- } ) ;
7
+ test ( 'should construct correct url with multiple parameterized routers of the same length.' , done => {
8
+ createRunner ( __dirname , 'server.ts' )
9
+ . ignore ( 'transaction' , 'session' , 'sessions' )
10
+ . expect ( { event : { message : 'Custom Message' , transaction : 'GET /api/v1/:userId' } } )
11
+ . start ( done )
12
+ . makeRequest ( 'get' , '/api/v1/1234/' ) ;
11
13
} ) ;
Original file line number Diff line number Diff line change
1
+ import { loggingTransport , startExpressServerAndSendPortToRunner } from '@sentry-internal/node-integration-tests' ;
1
2
import * as Sentry from '@sentry/node' ;
2
3
import * as Tracing from '@sentry/tracing' ;
3
4
import cors from 'cors' ;
@@ -11,6 +12,7 @@ Sentry.init({
11
12
// eslint-disable-next-line deprecation/deprecation
12
13
integrations : [ new Sentry . Integrations . Http ( { tracing : true } ) , new Tracing . Integrations . Express ( { app } ) ] ,
13
14
tracesSampleRate : 1.0 ,
15
+ transport : loggingTransport ,
14
16
} ) ;
15
17
16
18
app . use ( Sentry . Handlers . requestHandler ( ) ) ;
@@ -32,4 +34,4 @@ app.use('/api/v1', APIv1);
32
34
33
35
app . use ( Sentry . Handlers . errorHandler ( ) ) ;
34
36
35
- export default app ;
37
+ startExpressServerAndSendPortToRunner ( app ) ;
Original file line number Diff line number Diff line change 1
- import { TestEnv , assertSentryEvent } from '../../../../utils/index ' ;
1
+ import { cleanupChildProcesses , createRunner } from '../../../../utils/runner ' ;
2
2
3
- test ( 'should construct correct urls with multiple routers.' , async ( ) => {
4
- const env = await TestEnv . init ( __dirname , ` ${ __dirname } /server.ts` ) ;
5
- const event = await env . getEnvelopeRequest ( { url : env . url . replace ( 'test' , 'api/v1/test/' ) } ) ;
3
+ afterAll ( ( ) => {
4
+ cleanupChildProcesses ( ) ;
5
+ } ) ;
6
6
7
- assertSentryEvent ( event [ 2 ] as any , {
8
- message : 'Custom Message' ,
9
- transaction : 'GET /api/v1/test' ,
10
- } ) ;
7
+ test ( 'should construct correct urls with multiple routers.' , done => {
8
+ createRunner ( __dirname , 'server.ts' )
9
+ . ignore ( 'transaction' , 'session' , 'sessions' )
10
+ . expect ( { event : { message : 'Custom Message' , transaction : 'GET /api/v1/test' } } )
11
+ . start ( done )
12
+ . makeRequest ( 'get' , '/api/v1/test' ) ;
11
13
} ) ;
You can’t perform that action at this time.
0 commit comments