File tree 9 files changed +2854
-13
lines changed
test/manual/webpack-domain
9 files changed +2854
-13
lines changed Original file line number Diff line number Diff line change 4
4
5
5
- "You miss 100 percent of the chances you don't take. — Wayne Gretzky" — Michael Scott
6
6
7
+ ## 5.15.2
8
+
9
+ - [ hub] fix: Remove dynamicRequire, Fix require call (#2521 )
10
+
7
11
## 5.15.1
8
12
9
13
- [ browser] fix: Prevent crash for react native instrumenting fetch (#2510 )
Original file line number Diff line number Diff line change @@ -454,7 +454,8 @@ export function getCurrentHub(): Hub {
454
454
*/
455
455
function getHubFromActiveDomain ( registry : Carrier ) : Hub {
456
456
try {
457
- const domain = require ( 'domain' ) ;
457
+ const req = require ;
458
+ const domain = req ( 'domain' ) ;
458
459
const activeDomain = domain . active ;
459
460
460
461
// If there no active domain, just return global hub
Original file line number Diff line number Diff line change 56
56
"fix" : " run-s fix:tslint fix:prettier" ,
57
57
"fix:prettier" : " prettier --write \" {src,test}/**/*.ts\" " ,
58
58
"fix:tslint" : " tslint --fix -t stylish -p ." ,
59
- "test" : " run-s test:jest test:express" ,
59
+ "test" : " run-s test:jest test:express test:webpack " ,
60
60
"test:jest" : " jest" ,
61
61
"test:watch" : " jest --watch" ,
62
62
"test:express" : " node test/manual/express-scope-separation/start.js" ,
63
+ "test:webpack" : " cd test/manual/webpack-domain/ && yarn && yarn webpack && node dist/bundle.js" ,
63
64
"version" : " node ../../scripts/versionbump.js src/version.ts"
64
65
},
65
66
"jest" : {
Original file line number Diff line number Diff line change
1
+ dist
Original file line number Diff line number Diff line change
1
+ import * as Sentry from '@sentry/node' ;
2
+
3
+ let remaining = 2 ;
4
+
5
+ class DummyTransport {
6
+ sendEvent ( event ) {
7
+ -- remaining ;
8
+
9
+ if ( ! remaining ) {
10
+ console . error ( 'SUCCESS: Webpack Node Domain test OK!' ) ;
11
+ process . exit ( 0 ) ;
12
+ }
13
+
14
+ return Promise . resolve ( {
15
+ status : 'success' ,
16
+ } ) ;
17
+ }
18
+ }
19
+
20
+ Sentry . init ( {
21
+ dsn : 'https://a@example.com/1' ,
22
+ transport : DummyTransport ,
23
+ beforeSend ( event ) {
24
+ if ( event . message === 'inside' ) {
25
+ if ( event . tags . a !== 'x' && event . tags . b !== 'c' ) {
26
+ console . error ( 'FAILED: Scope contains incorrect tags' ) ;
27
+ process . exit ( 1 ) ;
28
+ }
29
+ }
30
+ if ( event . message === 'outside' ) {
31
+ if ( event . tags . a !== 'b' ) {
32
+ console . error ( 'FAILED: Scope contains incorrect tags' ) ;
33
+ process . exit ( 1 ) ;
34
+ }
35
+ }
36
+ return event ;
37
+ } ,
38
+ } ) ;
39
+
40
+ Sentry . configureScope ( scope => {
41
+ scope . setTag ( 'a' , 'b' ) ;
42
+ } ) ;
43
+
44
+ const d = require ( 'domain' ) . create ( ) ;
45
+ d . run ( ( ) => {
46
+ Sentry . configureScope ( scope => {
47
+ scope . setTag ( 'a' , 'x' ) ;
48
+ scope . setTag ( 'b' , 'c' ) ;
49
+ } ) ;
50
+ Sentry . captureMessage ( 'inside' ) ;
51
+ } ) ;
52
+
53
+ Sentry . captureMessage ( 'outside' ) ;
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " webpack-domain" ,
3
+ "version" : " 1.0.0" ,
4
+ "main" : " index.js" ,
5
+ "license" : " MIT" ,
6
+ "dependencies" : {
7
+ "@sentry/node" : " ../../../" ,
8
+ "webpack" : " ^4.42.1"
9
+ },
10
+ "devDependencies" : {
11
+ "webpack-cli" : " ^3.3.11"
12
+ }
13
+ }
Original file line number Diff line number Diff line change
1
+ const path = require ( 'path' ) ;
2
+
3
+ module . exports = {
4
+ entry : './index.js' ,
5
+ output : {
6
+ path : path . resolve ( __dirname , 'dist' ) ,
7
+ filename : 'bundle.js'
8
+ } ,
9
+ target : "node" ,
10
+ } ;
You can’t perform that action at this time.
0 commit comments