Skip to content

Commit e1c972a

Browse files
committed
test(otel): make API loading fixtures portable to Windows
Windows treats drive-letter loader paths as URL schemes and resolves rooted paths against the current drive. Use URL and absolute-path forms that preserve the fixture intent on every platform.
1 parent ced8e31 commit e1c972a

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

packages/dd-trace/test/opentelemetry/api-loading.spec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const { execFileSync } = require('node:child_process')
55
const fs = require('node:fs')
66
const os = require('node:os')
77
const path = require('node:path')
8+
const { pathToFileURL } = require('node:url')
89

910
const { describe, it, afterEach } = require('mocha')
1011

@@ -46,7 +47,7 @@ describe('OpenTelemetry API copy loading', () => {
4647

4748
const args = []
4849
if (format === 'module') {
49-
args.push('--loader', path.join(DD_TRACE_PATH, 'initialize.mjs'))
50+
args.push('--loader', pathToFileURL(path.join(DD_TRACE_PATH, 'initialize.mjs')).href)
5051
}
5152
args.push(entry)
5253
const output = execFileSync(process.execPath, args, {

packages/dd-trace/test/opentelemetry/api.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ describe('opentelemetry/api', () => {
125125
})
126126

127127
it('resolves application copies from a directory entrypoint', () => {
128-
const entrypoint = '/app'
128+
const entrypoint = path.join(path.parse(process.cwd()).root, 'app')
129129
const applicationRequire = missingApplicationRequire()
130130
const createRequire = sinon.stub().returns(applicationRequire)
131131
const existsSync = sinon.stub().callsFake(fs.existsSync)

0 commit comments

Comments
 (0)