File tree 6 files changed +61
-0
lines changed
dev-packages/node-integration-tests/suites/no-code
6 files changed +61
-0
lines changed Original file line number Diff line number Diff line change
1
+ setTimeout ( ( ) => {
2
+ throw new Error ( 'Test error' ) ;
3
+ } , 1000 ) ;
Original file line number Diff line number Diff line change
1
+ setTimeout ( ( ) => {
2
+ throw new Error ( 'Test error' ) ;
3
+ } , 1000 ) ;
Original file line number Diff line number Diff line change
1
+ import { conditionalTest } from '../../utils' ;
2
+ import { cleanupChildProcesses , createRunner } from '../../utils/runner' ;
3
+
4
+ const EVENT = {
5
+ exception : {
6
+ values : [
7
+ {
8
+ type : 'Error' ,
9
+ value : 'Test error' ,
10
+ } ,
11
+ ] ,
12
+ } ,
13
+ } ;
14
+
15
+ describe ( 'no-code init' , ( ) => {
16
+ afterAll ( ( ) => {
17
+ cleanupChildProcesses ( ) ;
18
+ } ) ;
19
+
20
+ test ( 'CJS' , done => {
21
+ createRunner ( __dirname , 'app.js' )
22
+ . withFlags ( '--require=@sentry/node/init' )
23
+ . withMockSentryServer ( )
24
+ . expect ( { event : EVENT } )
25
+ . start ( done ) ;
26
+ } ) ;
27
+
28
+ conditionalTest ( { min : 18 } ) ( '--import' , ( ) => {
29
+ test ( 'ESM' , done => {
30
+ createRunner ( __dirname , 'app.mjs' )
31
+ . withFlags ( '--import=@sentry/node/init' )
32
+ . withMockSentryServer ( )
33
+ . expect ( { event : EVENT } )
34
+ . start ( done ) ;
35
+ } ) ;
36
+ } ) ;
37
+ } ) ;
Original file line number Diff line number Diff line change 41
41
"import" : {
42
42
"default" : " ./build/loader-hook.mjs"
43
43
}
44
+ },
45
+ "./init" :{
46
+ "import" : {
47
+ "default" : " ./build/esm/init.js"
48
+ },
49
+ "require" : {
50
+ "default" : " ./build/cjs/init.js"
51
+ }
44
52
}
45
53
},
46
54
"typesVersions" : {
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ export default [
19
19
localVariablesWorkerConfig ,
20
20
...makeNPMConfigVariants (
21
21
makeBaseNPMConfig ( {
22
+ entrypoints : [ 'src/index.ts' , 'src/init.ts' ] ,
22
23
packageSpecificConfig : {
23
24
output : {
24
25
// set exports to 'named' or 'auto' so that rollup doesn't warn
Original file line number Diff line number Diff line change
1
+ import { init } from './sdk/init' ;
2
+
3
+ /**
4
+ * The @sentry/node/init export can be used with the node --import and --require args to initialize the SDK entirely via
5
+ * environment variables.
6
+ *
7
+ * > SENTRY_DSN=https://[email protected] /0 SENTRY_TRACES_SAMPLE_RATE=1.0 node --import=@sentry/node/init app.mjs
8
+ */
9
+ init ( ) ;
You can’t perform that action at this time.
0 commit comments