@@ -14,6 +14,7 @@ const Module = require('module')
14
14
15
15
const ORCHESTRION_CONFIG = `
16
16
version: 1
17
+ dc_module: dc-polyfill
17
18
instrumentations:
18
19
- module_name: undici
19
20
version_range: ">=0.0.1"
@@ -33,6 +34,8 @@ describe('orchestrion', () => {
33
34
let rewriter
34
35
35
36
beforeEach ( function ( ) {
37
+ this . timeout ( 10000 )
38
+
36
39
sinon . restore ( )
37
40
// Set up logger
38
41
logger = {
@@ -42,7 +45,7 @@ describe('orchestrion', () => {
42
45
43
46
tempDir = fs . mkdtempSync ( path . join ( os . tmpdir ( ) , 'orchestrion-test-' ) )
44
47
execSync ( 'npm init -y' , { cwd : tempDir } )
45
- execSync ( 'npm install undici --save' , { cwd : tempDir } )
48
+ execSync ( 'npm install undici@5 dc-polyfill --save' , { cwd : tempDir } )
46
49
undiciDir = path . join ( tempDir , 'node_modules' , 'undici' )
47
50
48
51
// Initialize rewriter with orchestrion config
@@ -70,14 +73,15 @@ describe('orchestrion', () => {
70
73
expect ( result ) . to . have . property ( 'content' )
71
74
expect ( result . content ) . to . be . a ( 'string' )
72
75
expect ( result . content . length ) . to . be . greaterThan ( 0 )
76
+ expect ( result . content . indexOf ( 'orchestrion' ) ) . to . be . greaterThan ( 0 )
73
77
74
78
// Run the modified code and check that it's instrumented
75
79
const mod = new Module ( indexPath , module . parent )
76
80
mod . paths = Module . _nodeModulePaths ( path . dirname ( indexPath ) )
77
81
mod . filename = indexPath
78
82
mod . _compile ( result . content , indexPath )
79
83
80
- const dc = require ( 'diagnostics_channel ' )
84
+ const dc = mod . require ( 'dc-polyfill ' )
81
85
const tc = dc . tracingChannel ( 'orchestrion:undici:fetch_expr' )
82
86
let eventMessage
83
87
tc . subscribe ( {
0 commit comments