Skip to content

Commit f8884a2

Browse files
committed
This is a combination of 2 commits.
use dc-polyfill, and longer test timeout for orchestrion test
1 parent e193161 commit f8884a2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

test/orchestrion.spec.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const Module = require('module')
1414

1515
const ORCHESTRION_CONFIG = `
1616
version: 1
17+
dc_module: dc-polyfill
1718
instrumentations:
1819
- module_name: undici
1920
version_range: ">=0.0.1"
@@ -33,6 +34,8 @@ describe('orchestrion', () => {
3334
let rewriter
3435

3536
beforeEach(function () {
37+
this.timeout(10000)
38+
3639
sinon.restore()
3740
// Set up logger
3841
logger = {
@@ -42,7 +45,7 @@ describe('orchestrion', () => {
4245

4346
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'orchestrion-test-'))
4447
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 })
4649
undiciDir = path.join(tempDir, 'node_modules', 'undici')
4750

4851
// Initialize rewriter with orchestrion config
@@ -70,14 +73,15 @@ describe('orchestrion', () => {
7073
expect(result).to.have.property('content')
7174
expect(result.content).to.be.a('string')
7275
expect(result.content.length).to.be.greaterThan(0)
76+
expect(result.content.indexOf('orchestrion')).to.be.greaterThan(0)
7377

7478
// Run the modified code and check that it's instrumented
7579
const mod = new Module(indexPath, module.parent)
7680
mod.paths = Module._nodeModulePaths(path.dirname(indexPath))
7781
mod.filename = indexPath
7882
mod._compile(result.content, indexPath)
7983

80-
const dc = require('diagnostics_channel')
84+
const dc = mod.require('dc-polyfill')
8185
const tc = dc.tracingChannel('orchestrion:undici:fetch_expr')
8286
let eventMessage
8387
tc.subscribe({

0 commit comments

Comments
 (0)