Skip to content

Commit f4ee844

Browse files
authored
use no async context frame option for now (#5706)
1 parent 9702e5b commit f4ee844

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

.github/workflows/debugger.yml

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ jobs:
2828
- uses: ./.github/actions/install
2929
- run: yarn test:debugger:ci
3030
- run: yarn test:integration:debugger
31+
env:
32+
OPTIONS_OVERRIDE: 1
3133
- if: always()
3234
uses: ./.github/actions/testagent/logs
3335
with:

packages/dd-trace/test/setup/core.js

+33
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const sinon = require('sinon')
44
const chai = require('chai')
55
const sinonChai = require('sinon-chai')
66
const proxyquire = require('../proxyquire')
7+
const { NODE_MAJOR } = require('../../../../version')
78

89
{
910
// get-port can often return a port that is already in use, thanks to a race
@@ -48,3 +49,35 @@ if (/^v\d+\.x$/.test(process.env.GITHUB_BASE_REF || '')) {
4849
process.env.DD_INJECTION_ENABLED = 'true'
4950
process.env.DD_INJECT_FORCE = 'true'
5051
}
52+
53+
// TODO(bengl): remove this block once we can properly support Node.js 24 without it
54+
if (NODE_MAJOR >= 24 && !process.env.OPTIONS_OVERRIDE) {
55+
const childProcess = require('child_process')
56+
const { exec, fork } = childProcess
57+
58+
childProcess.exec = function (...args) {
59+
const opts = args[1]
60+
if (opts) {
61+
if (opts?.env?.NODE_OPTIONS && !opts.env.NODE_OPTIONS.includes('--no-async-context-frame')) {
62+
opts.env.NODE_OPTIONS += ' --no-async-context-frame'
63+
} else {
64+
opts.env ||= {}
65+
opts.env.NODE_OPTIONS = '--no-async-context-frame'
66+
}
67+
}
68+
return exec.apply(this, args)
69+
}
70+
71+
childProcess.fork = function (...args) {
72+
const opts = args[1]
73+
if (opts) {
74+
if (opts?.env?.NODE_OPTIONS && !opts.env.NODE_OPTIONS.includes('--no-async-context-frame')) {
75+
opts.env.NODE_OPTIONS += ' --no-async-context-frame'
76+
} else {
77+
opts.env ||= {}
78+
opts.env.NODE_OPTIONS = '--no-async-context-frame'
79+
}
80+
}
81+
return fork.apply(this, args)
82+
}
83+
}

0 commit comments

Comments
 (0)