File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
packages/datadog-instrumentations Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,10 @@ addHook({ name: names }, function (url) {
59
59
isURL : true
60
60
} )
61
61
}
62
+
63
+ static [ Symbol . hasInstance ] ( instance ) {
64
+ return instance instanceof URL
65
+ }
62
66
}
63
67
} )
64
68
Original file line number Diff line number Diff line change 1
1
'use strict'
2
2
3
3
const agent = require ( '../../dd-trace/test/plugins/agent' )
4
+ const { assert } = require ( 'chai' )
4
5
const { channel } = require ( '../src/helpers/instrument' )
5
6
const names = [ 'url' , 'node:url' ]
6
7
@@ -68,6 +69,13 @@ names.forEach(name => {
68
69
} , sinon . match . any )
69
70
} )
70
71
72
+ it ( 'instanceof should work also for original instances' , ( ) => {
73
+ const OriginalUrl = Object . getPrototypeOf ( url . URL )
74
+ const originalUrl = new OriginalUrl ( 'https://www.datadoghq.com' )
75
+
76
+ assert . isTrue ( originalUrl instanceof url . URL )
77
+ } )
78
+
71
79
; [ 'host' , 'origin' , 'hostname' ] . forEach ( property => {
72
80
it ( `should publish on get ${ property } ` , ( ) => {
73
81
const urlObject = new url . URL ( '/path' , 'https://www.datadoghq.com' )
You can’t perform that action at this time.
0 commit comments