Skip to content

[BUG]: Playwright projects and config filters ignored when DD_TRACE_ENABLED=true #6655

@hatufacci

Description

@hatufacci

Tracer Version(s)

5.71.0

Node.js Version(s)

22.18.0

Bug Report

@playwright/test version: 1.55.0

When running Playwright tests with Datadog CI Visibility enabled (DD_TRACE_ENABLED=true), the test runner ignores projects, testMatch, and grep filters defined in the Playwright config file. Instead, all tests in the directory are executed, even when the config should restrict the selection.

Steps to Reproduce:

Use Playwright with a config file that defines multiple projects and uses testMatch/grep for filtering.
Set DD_TRACE_ENABLED=true and run tests via npx playwright test --config=playwright.config.ts.
Observe that all tests are run, not just those matching the config filters.
Expected Behavior:
Only tests matching the projects, testMatch, and grep filters in the config should be executed.

Actual Behavior:
All tests are executed, ignoring the config’s filtering logic.

Disabling DD_TRACE_ENABLED restores correct test selection.

Reproduction Code

example of playwright config:

import { defineConfig } from "@playwright/test";
import dotenv from "dotenv";

dotenv.config({ quiet: true });

export default defineConfig({
timeout: 1200000,
testDir: "./tests/serverside/data",
globalSetup: require.resolve("./tests/global.setup.ts"),
globalTeardown: require.resolve("./tests/global.teardown.ts"),
/* Run tests in files in parallel /
fullyParallel: true,
/
Fail the build on CI if you accidentally left test.only in the source code. /
forbidOnly: !!process.env.CI,
/
Retry on CI only /
retries: process.env.CI ? 1 : 0,
/
Opt out of parallel tests on CI. /
workers: process.env.CI ? 10 : 6,
reporter: process.env.CI
? [["html"], ["json", { outputFile: "test-results.json" }], ["junit", { outputFile: "junit-report.xml" }]]
: "html",
use: {
browserName: "chromium",
headless: true,
actionTimeout: 15000,
baseURL: process.env.FUNCTIONS_APP_URL,
contextOptions: {
viewport: { width: 1440, height: 900 },
},
/
Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: "retain-on-failure",
video: "retain-on-failure",
screenshot: "only-on-failure",
},
projects: [
{
name: "setupPipeline",
testMatch: ["/da.setup.spec.ts"],
},
{
name: "audienceDB",
dependencies: ["setupPipeline"],
grep: RegExp("(C3115370)"),
testMatch: ["
/pipelineDB.spec.ts"],
},
{
name: "settings",
dependencies: ["setupPipeline"],
testMatch: ["/dataSettings.spec.ts"],
},
{
name: "filters",
dependencies: ["setupPipeline"],
testMatch: ["
/dataFilters.spec.ts"],
},
],
});

Error Logs

Running 2122 tests using 10 workers

but with DD_TRACE_ENABLED=false (correct number of tests)
Running 32 tests using 10 workers

Tracer Config

DD_TRACE_ENABLED=true

Operating System

Ubuntu 22.04.5 LTS (Jammy Jellyfish)

Bundling

Unsure

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions