File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
datadog-instrumentations/src
dd-trace/test/appsec/rasp Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -259,8 +259,9 @@ function createWrapFunction (prefix = '', override = '') {
259
259
const operation = name . match ( / ^ ( .+ ?) ( S y n c ) ? ( \. n a t i v e ) ? $ / ) [ 1 ]
260
260
261
261
return function ( ) {
262
- if ( ! startChannel . hasSubscribers )
262
+ if ( ! startChannel . hasSubscribers ) {
263
263
return original . apply ( this , arguments )
264
+ }
264
265
265
266
const lastIndex = arguments . length - 1
266
267
const cb = typeof arguments [ lastIndex ] === 'function' && arguments [ lastIndex ]
Original file line number Diff line number Diff line change @@ -222,8 +222,13 @@ describe('AppsecFsPlugin', () => {
222
222
opStartCh . unsubscribe ( onStart )
223
223
}
224
224
} )
225
- it . only ( 'should clean up store when finishing op' , ( ) => {
225
+
226
+ it ( 'should clean up store when finishing op' , ( ) => {
226
227
let count = 4
228
+ // hack to node 18 and early 20.x
229
+ // with dc-polyfill addBind is not enough to force a channel.hasSubscribers === true
230
+ const onStart = ( ) => { }
231
+ opStartCh . subscribe ( onStart )
227
232
const onFinish = ( ) => {
228
233
const store = storage ( 'legacy' ) . getStore ( )
229
234
count --
@@ -237,14 +242,13 @@ describe('AppsecFsPlugin', () => {
237
242
storage ( 'legacy' ) . enterWith ( origStore )
238
243
239
244
opFinishCh . subscribe ( onFinish )
240
- console . log ( 'BEFORE - fs.readFileSync' )
241
245
242
246
fs . readFileSync ( path . join ( __dirname , 'fs-plugin.spec.js' ) )
243
247
244
- console . log ( 'AFTER - fs.readFileSync' )
245
248
assert . strictEqual ( count , 0 )
246
249
} finally {
247
250
opFinishCh . unsubscribe ( onFinish )
251
+ opStartCh . unsubscribe ( onStart )
248
252
}
249
253
} )
250
254
} )
You can’t perform that action at this time.
0 commit comments