Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,14 @@
# Language Platform
/* @DataDog/lang-platform-js

/.github/actions/ @DataDog/lang-platform-js

/integration-tests/bun/ @DataDog/lang-platform-js
/integration-tests/coverage/ @DataDog/lang-platform-js
/integration-tests/coverage-child-process.spec.js @DataDog/lang-platform-js
/integration-tests/coverage-fixtures/parent.js @DataDog/lang-platform-js
/integration-tests/coverage-fixtures/worker.js @DataDog/lang-platform-js
/integration-tests/coverage-manual-process.spec.js @DataDog/lang-platform-js
/integration-tests/init.spec.js @DataDog/lang-platform-js
/integration-tests/package-guardrails.spec.js @DataDog/lang-platform-js
/integration-tests/package-guardrails/flush.js @DataDog/lang-platform-js
Expand Down
7 changes: 3 additions & 4 deletions .github/actions/plugins/upstream/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ runs:
- uses: ./.github/actions/node/latest
- run: yarn test:plugins:upstream
shell: bash
- uses: ./.github/actions/coverage
with:
flags: plugins-upstream-${{ github.job }}
dd_api_key: ${{ steps.dd-sts.outputs.api_key }}
# `test:plugins:upstream` runs each plugin's upstream test suite (e.g., axios's own tests)
# against the unit-test harness, which intentionally does not produce NYC coverage for
# dd-trace. Skip the coverage/upload step entirely here.
- if: always()
uses: ./.github/actions/testagent/logs
with:
Expand Down
5 changes: 5 additions & 0 deletions .github/actions/testagent/logs/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ runs:
using: composite
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
# Preserve untracked artifacts (coverage/, .nyc_output/, node_modules/) produced by earlier
# test steps. Without this, the default `git clean -ffdx` wipes them before subsequent
# steps such as Codecov upload can pick them up.
clean: false
- name: Create Artifacts Directories
run: |
mkdir -p "./artifacts/logs"
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/aiguard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ jobs:
with:
version: ${{ matrix.version }}
- uses: ./.github/actions/install
- run: yarn test:integration:aiguard
- run: yarn test:integration:aiguard:coverage
- uses: ./.github/actions/coverage
with:
flags: aiguard-integration-${{ matrix.version }}
dd_api_key: ${{ steps.dd-sts.outputs.api_key }}
- uses: ./.github/actions/push_to_test_optimization
if: "!cancelled()"
with:
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/appsec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,11 @@ jobs:
with:
version: ${{ matrix.version }}
- uses: ./.github/actions/install
- run: yarn test:integration:appsec
- run: yarn test:integration:appsec:coverage
- uses: ./.github/actions/coverage
with:
flags: appsec-integration-${{ matrix.version }}
dd_api_key: ${{ steps.dd-sts.outputs.api_key }}
- uses: ./.github/actions/push_to_test_optimization
if: "!cancelled()"
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/debugger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- uses: ./.github/actions/install
- run: yarn test:code-origin:ci
- run: yarn test:debugger:ci
- run: yarn test:integration:debugger
- run: yarn test:integration:debugger:coverage
- if: always()
uses: ./.github/actions/testagent/logs
with:
Expand Down
24 changes: 18 additions & 6 deletions .github/workflows/openfeature.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ jobs:
id: dd-sts
- uses: ./.github/actions/node/latest
- uses: ./.github/actions/install
- run: yarn test:integration:openfeature
- run: yarn test:integration:openfeature:coverage
- uses: ./.github/actions/coverage
with:
flags: openfeature-macos
dd_api_key: ${{ steps.dd-sts.outputs.api_key }}
- uses: ./.github/actions/push_to_test_optimization
if: "!cancelled()"
with:
Expand All @@ -74,13 +78,17 @@ jobs:
id: dd-sts
- uses: ./.github/actions/node/oldest-maintenance-lts
- uses: ./.github/actions/install
- run: yarn test:integration:openfeature
- run: yarn test:integration:openfeature:coverage
- uses: ./.github/actions/node/newest-maintenance-lts
- run: yarn test:integration:openfeature
- run: yarn test:integration:openfeature:coverage
- uses: ./.github/actions/node/active-lts
- run: yarn test:integration:openfeature
- run: yarn test:integration:openfeature:coverage
- uses: ./.github/actions/node/latest
- run: yarn test:integration:openfeature
- run: yarn test:integration:openfeature:coverage
- uses: ./.github/actions/coverage
with:
flags: openfeature-ubuntu
dd_api_key: ${{ steps.dd-sts.outputs.api_key }}
- uses: ./.github/actions/push_to_test_optimization
if: "!cancelled()"
with:
Expand All @@ -99,7 +107,11 @@ jobs:
- uses: ./.github/actions/install
with:
cache: "true"
- run: yarn test:integration:openfeature
- run: yarn test:integration:openfeature:coverage
- uses: ./.github/actions/coverage
with:
flags: openfeature-windows
dd_api_key: ${{ steps.dd-sts.outputs.api_key }}
- uses: ./.github/actions/push_to_test_optimization
if: "!cancelled()"
with:
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -494,9 +494,13 @@ jobs:
# Disable core dumps since some integration tests intentionally abort and core dump generation takes around 5-10s
- uses: ./.github/actions/install
- run: sudo sysctl -w kernel.core_pattern='|/bin/false'
- run: yarn test:integration
- run: yarn test:integration:coverage
- run: yarn test:integration:esbuild
- run: yarn test:integration:webpack
- uses: ./.github/actions/coverage
with:
flags: platform-integration-${{ matrix.version }}
dd_api_key: ${{ steps.dd-sts.outputs.api_key }}
- uses: ./.github/actions/push_to_test_optimization
if: "!cancelled()"
with:
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/profiling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- uses: ./.github/actions/node/latest
- uses: ./.github/actions/install
- run: yarn test:profiler:ci
- run: yarn test:integration:profiler
- run: yarn test:integration:profiler:coverage
- uses: ./.github/actions/coverage
with:
flags: profiling-macos
Expand All @@ -56,16 +56,16 @@ jobs:
- uses: ./.github/actions/node/oldest-maintenance-lts
- uses: ./.github/actions/install
- run: yarn test:profiler:ci
- run: yarn test:integration:profiler
- run: yarn test:integration:profiler:coverage
- uses: ./.github/actions/node/newest-maintenance-lts
- run: yarn test:profiler:ci
- run: yarn test:integration:profiler
- run: yarn test:integration:profiler:coverage
- uses: ./.github/actions/node/active-lts
- run: yarn test:profiler:ci
- run: yarn test:integration:profiler
- run: yarn test:integration:profiler:coverage
- uses: ./.github/actions/node/latest
- run: yarn test:profiler:ci
- run: yarn test:integration:profiler
- run: yarn test:integration:profiler:coverage
- uses: ./.github/actions/coverage
with:
flags: profiling-ubuntu
Expand All @@ -89,7 +89,7 @@ jobs:
with:
cache: "true"
- run: yarn test:profiler:ci
- run: yarn test:integration:profiler
- run: yarn test:integration:profiler:coverage
- uses: ./.github/actions/coverage
with:
flags: profiling-windows
Expand Down
52 changes: 44 additions & 8 deletions .github/workflows/test-optimization.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,12 @@ jobs:
version: [oldest, maintenance, active, latest]
name: ${{ github.workflow }} / integration (node-${{ matrix.version }})
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: ./.github/actions/dd-sts-api-key
id: dd-sts
- uses: ./.github/actions/node
with:
version: ${{ matrix.version }}
Expand All @@ -58,7 +62,11 @@ jobs:
with:
path: ~/.cache/ms-playwright
key: playwright-browsers-${{ runner.os }}-${{ steps.playwright-version.outputs.version }}
- run: yarn test:integration:testopt
- run: yarn test:integration:testopt:coverage
- uses: ./.github/actions/coverage
with:
flags: test-optimization-testopt-${{ matrix.version }}
dd_api_key: ${{ steps.dd-sts.outputs.api_key }}

integration-playwright:
strategy:
Expand Down Expand Up @@ -103,10 +111,14 @@ jobs:
with:
path: /github/home/.cache/ms-playwright
key: playwright-browsers-oldest-dd${{ steps.dd-version.outputs.major }}
- run: yarn test:integration:playwright
- run: yarn test:integration:playwright:coverage
env:
NODE_OPTIONS: "-r ./ci/init"
DD_API_KEY: ${{ steps.dd-sts.outputs.api_key }}
- uses: ./.github/actions/coverage
with:
flags: test-optimization-playwright-${{ matrix.node-version }}-${{ matrix.playwright-version }}
dd_api_key: ${{ steps.dd-sts.outputs.api_key }}

integration-mocha:
strategy:
Expand All @@ -127,11 +139,15 @@ jobs:
with:
version: ${{ matrix.version }}
- uses: ./.github/actions/install
- run: yarn test:integration:mocha
- run: yarn test:integration:mocha:coverage
env:
NODE_OPTIONS: "-r ./ci/init"
MOCHA_VERSION: ${{ matrix.mocha-version }}
DD_API_KEY: ${{ steps.dd-sts.outputs.api_key }}
- uses: ./.github/actions/coverage
with:
flags: test-optimization-mocha-${{ matrix.version }}-${{ matrix.mocha-version }}
dd_api_key: ${{ steps.dd-sts.outputs.api_key }}

integration-jest:
strategy:
Expand All @@ -152,11 +168,15 @@ jobs:
with:
version: ${{ matrix.version }}
- uses: ./.github/actions/install
- run: yarn test:integration:jest
- run: yarn test:integration:jest:coverage
env:
NODE_OPTIONS: "-r ./ci/init"
JEST_VERSION: ${{ matrix.jest-version }}
DD_API_KEY: ${{ steps.dd-sts.outputs.api_key }}
- uses: ./.github/actions/coverage
with:
flags: test-optimization-jest-${{ matrix.version }}-${{ matrix.jest-version }}
dd_api_key: ${{ steps.dd-sts.outputs.api_key }}

integration-cucumber:
strategy:
Expand All @@ -177,11 +197,15 @@ jobs:
with:
version: ${{ matrix.version }}
- uses: ./.github/actions/install
- run: yarn test:integration:cucumber
- run: yarn test:integration:cucumber:coverage
env:
NODE_OPTIONS: "-r ./ci/init"
CUCUMBER_VERSION: ${{ matrix.cucumber-version }}
DD_API_KEY: ${{ steps.dd-sts.outputs.api_key }}
- uses: ./.github/actions/coverage
with:
flags: test-optimization-cucumber-${{ matrix.version }}-${{ matrix.cucumber-version }}
dd_api_key: ${{ steps.dd-sts.outputs.api_key }}

integration-selenium:
strategy:
Expand Down Expand Up @@ -219,10 +243,14 @@ jobs:
sudo mv chromedriver-linux64/chromedriver /usr/bin/chromedriver
sudo chmod +x /usr/bin/chromedriver
- uses: ./.github/actions/install
- run: yarn test:integration:selenium
- run: yarn test:integration:selenium:coverage
env:
NODE_OPTIONS: "-r ./ci/init"
DD_API_KEY: ${{ steps.dd-sts.outputs.api_key }}
- uses: ./.github/actions/coverage
with:
flags: test-optimization-selenium-${{ matrix.version }}
dd_api_key: ${{ steps.dd-sts.outputs.api_key }}

integration-cypress:
strategy:
Expand Down Expand Up @@ -257,13 +285,17 @@ jobs:
path: ~/.cache/Cypress
key: cypress-binary-${{ matrix.cypress-version }}
- run: yarn config set ignore-engines true
- run: yarn test:integration:cypress --ignore-engines
- run: yarn test:integration:cypress:coverage --ignore-engines
env:
CYPRESS_VERSION: ${{ matrix.cypress-version }}
NODE_OPTIONS: "-r ./ci/init"
CYPRESS_MODULE_TYPE: ${{ matrix.module-type }}
OPTIONS_OVERRIDE: 1
DD_API_KEY: ${{ steps.dd-sts.outputs.api_key }}
- uses: ./.github/actions/coverage
with:
flags: test-optimization-cypress-${{ matrix.version }}-${{ matrix.cypress-version }}-${{ matrix.module-type }}
dd_api_key: ${{ steps.dd-sts.outputs.api_key }}

integration-vitest:
runs-on: ubuntu-latest
Expand All @@ -284,7 +316,11 @@ jobs:
with:
version: ${{ matrix.version }}
- uses: ./.github/actions/install
- run: yarn test:integration:vitest
- run: yarn test:integration:vitest:coverage
env:
NODE_OPTIONS: "-r ./ci/init"
DD_API_KEY: ${{ steps.dd-sts.outputs.api_key }}
- uses: ./.github/actions/coverage
with:
flags: test-optimization-vitest-${{ matrix.version }}
dd_api_key: ${{ steps.dd-sts.outputs.api_key }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ lib-cov

# Coverage directory used by tools like istanbul
coverage/
!integration-tests/coverage/
!integration-tests/coverage/**
*.lcov

# nyc test coverage
Expand Down
7 changes: 6 additions & 1 deletion .mocharc.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
'use strict'

// Bump default timeout under NYC / the integration coverage harness; require-hook overhead
// can push otherwise-fast tests past 5s without indicating a real regression.
// eslint-disable-next-line eslint-rules/eslint-process-env
const coverageActive = Boolean(process.env.NYC_CONFIG || process.env.DD_TRACE_INTEGRATION_COVERAGE_ROOT)

module.exports = {
allowUncaught: true,
color: true,
exit: true,
timeout: 5000,
timeout: coverageActive ? 7500 : 5000,
require: ['packages/dd-trace/test/setup/mocha.js'],
reporter: 'mocha-multi-reporters',
reporterOption: [
Expand Down
12 changes: 12 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,18 @@ export default [
'eslint-rules/eslint-env-aliases': 'error',
'eslint-rules/eslint-log-printf-style': 'error',

// Inline `.evaluate(<fn>)` callbacks (Playwright/Puppeteer) are serialized with
// `toString()` and run in chromium — NYC counter bumps inside would ReferenceError.
// Import the helper from a `*-browser-scripts.js` file (excluded from NYC) instead.
'no-restricted-syntax': ['error', {
selector:
"CallExpression[callee.property.name='evaluate']" +
":matches([arguments.0.type='ArrowFunctionExpression'], [arguments.0.type='FunctionExpression'])",
message:
'Move the inline `.evaluate(...)` callback into a `*-browser-scripts.js` file ' +
'(NYC-excluded in nyc.config.js) and import it here.',
}],

'n/no-restricted-require': ['error', [
...GLOBAL_RESTRICTED_REQUIRES,
{
Expand Down
3 changes: 3 additions & 0 deletions integration-tests/ci-visibility-intake.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const multer = require('multer')
const upload = multer()

const { FakeAgent } = require('./helpers')
const { COVERAGE_SLOWDOWN } = require('./coverage/runtime')

const DEFAULT_SETTINGS = {
code_coverage: true,
Expand Down Expand Up @@ -363,6 +364,7 @@ class FakeCiVisIntake extends FakeAgent {
// to make the assertions pass. It times out after maxGatheringTime so it should
// always be faster or as fast as gatherPayloads
gatherPayloadsMaxTimeout (payloadMatch, onPayload, maxGatheringTime = 15000) {
maxGatheringTime *= COVERAGE_SLOWDOWN
const payloads = []
return new Promise((resolve, reject) => {
const timeoutId = setTimeout(() => {
Expand Down Expand Up @@ -394,6 +396,7 @@ class FakeCiVisIntake extends FakeAgent {
}

gatherPayloads (payloadMatch, gatheringTime = 15000) {
gatheringTime *= COVERAGE_SLOWDOWN
const payloads = []
return new Promise((resolve, reject) => {
setTimeout(() => {
Expand Down
3 changes: 3 additions & 0 deletions integration-tests/code-origin.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ describe('Code Origin for Spans', function () {
proc = await spawnProc(appFile, {
cwd,
env: {
// NYC rewrites the compiled JS which breaks --enable-source-maps resolution
// back to typescript.ts, so opt the child out of the coverage harness.
DD_TRACE_INTEGRATION_COVERAGE_DISABLE: '1',
NODE_OPTIONS: '--enable-source-maps',
DD_TRACE_AGENT_URL: `http://localhost:${agent.port}`,
},
Expand Down
Loading
Loading