File tree 1 file changed +15
-6
lines changed
dev-packages/e2e-tests/test-applications/node-profiling
1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change
1
+ function assertUnpatechedRequire ( cycle ) {
2
+ if ( globalThis . require !== undefined ) {
3
+ // Test that globalThis.require is not defined by any side effects of the profiling
4
+ // https://github.com/getsentry/sentry-javascript/issues/13662
5
+ throw new Error (
6
+ `globalThis.require should not be defined ${ cycle } , check that profiling integration is not defining it, received: ` +
7
+ typeof globalThis . require ,
8
+ ) ;
9
+ }
10
+ }
11
+
12
+ assertUnpatechedRequire ( 'at startup' ) ;
1
13
import * as Sentry from '@sentry/node' ;
14
+ assertUnpatechedRequire ( 'after importing sentry/node' ) ;
2
15
import { nodeProfilingIntegration } from '@sentry/profiling-node' ;
3
-
16
+ assertUnpatechedRequire ( 'after importing sentry/profiling-node' ) ;
4
17
const wait = ms => new Promise ( resolve => setTimeout ( resolve , ms ) ) ;
5
18
6
19
Sentry . init ( {
@@ -14,8 +27,4 @@ Sentry.startSpan({ name: 'Precompile test' }, async () => {
14
27
await wait ( 500 ) ;
15
28
} ) ;
16
29
17
- // Test that globalThis.require is not defined by any side effects of the profiling
18
- // https://github.com/getsentry/sentry-javascript/issues/13662
19
- if ( globalThis . require !== undefined ) {
20
- throw new Error ( 'globalThis.require should not be defined, check that profiling integration is not defining it, received: ' + typeof globalThis . require ) ;
21
- }
30
+ assertUnpatechedRequire ( 'after a span was created' ) ;
You can’t perform that action at this time.
0 commit comments