Skip to content

🔥 Remove Karma (configuration, dependencies and Karma-only test helpers) - #5142

Draft
thomas-lebeau wants to merge 2 commits into
thomas.lebeau/vitest-wdio-bs-spikefrom
thomas.lebeau/remove-karma
Draft

thomas-lebeau wants to merge 2 commits into
thomas.lebeau/vitest-wdio-bs-spikefrom
thomas.lebeau/remove-karma

Conversation

@thomas-lebeau

@thomas-lebeau thomas-lebeau commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

Karma is deprecated (RUM-8075). With #5135 (unit) and #5136 (unit-bs), all unit tests run on Vitest, so the Karma setup is now unused. Stacked on #5136.

Changes

Removes what was only used by Karma:

  • test/unit/karma.base.conf.js, test/unit/karma.bs.conf.js
  • the Karma reporter plugins (jasmineSeedReporterPlugin.js, karmaDuplicateTestNameReporterPlugin.js, karmaSkippedFailedReporterPlugin.js, karmaUnexpectedErrorLogReporterPlugin.js) and the globalThis / Object.hasOwn polyfill files
  • dependencies: karma, karma-browserstack-launcher, karma-jasmine, karma-junit-reporter, karma-sourcemap-loader, karma-spec-reporter, karma-webpack, plus swc-loader and @swc/core (added in ✨ [RUM-5500] React-router v7 support #3299 to transpile dependencies for Karma; nothing else uses them), and their LICENSE-3rdparty.csv entries
  • the karma-webpack update pins in renovate.json and .github/dependabot.yml (RUM-3130)
  • stale Karma mentions in AGENTS.md and comments

Kept: test/unit/browsers.conf.ts (BrowserStack browser matrix, used by the Vitest BrowserStack config), and jasmine-core / @types/jasmine / eslint-plugin-jasmine (used by the Jasmine compatibility shim until specs are migrated to the Vitest API).

Merges the test helpers that had a Karma version and a Vitest copy (selected through aliases in the Vitest config) into a single Vitest implementation, and drops the aliases:

  • registerCleanupTask runs tasks with onTestFinished
  • getCurrentJasmineSpec is tracked from forEach.ts (a setup file run for every test file)
  • disableJasmineUncaughtExceptionTracking uses Vitest-compatible listeners
  • allJsonSchemas uses import.meta.glob instead of webpack's require.context (no more JS + .d.ts pair)
  • vitest is declared as a devDependency of @datadog/browser-core, whose test helpers now import it

Follow-up: migrate specs to the Vitest API (then drop the Jasmine shim).

⚠️ Written with an AI agent (Claude Code).

Test instructions

yarn
yarn test:unit                                # Vitest, unchanged
node scripts/check-licenses.ts                # dependencies and LICENSE-3rdparty.csv match
git grep -i karma -- ':!yarn.lock' ':!*CHANGELOG.md'   # only historical mentions left

Checklist

  • Tested locally
  • Tested on staging
  • Added unit tests for this change.
  • Added e2e/integration tests for this change.
  • Updated documentation and/or relevant AGENTS.md file

@thomas-lebeau
thomas-lebeau added this pull request to stack #5137 October 14, 2026 14:53
@thomas-lebeau thomas-lebeau changed the title 🔥 remove the karma configuration and dependencies 🔥 Remove the Karma configuration and dependencies Oct 14, 2026
@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum Salesforce N/A 188.06 KiB N/A N/A N/A
Rum N/A 188.04 KiB N/A N/A N/A
Rum-salesforce Profiler N/A 8.35 KiB N/A N/A N/A
Rum Profiler 8.35 KiB 8.35 KiB 0 B 0.00% ✅
Rum-salesforce Recorder N/A 32.04 KiB N/A N/A N/A
Rum Recorder 32.04 KiB 32.04 KiB 0 B 0.00% ✅
Logs 59.44 KiB 59.44 KiB 0 B 0.00% ✅
Rum Slim 145.83 KiB 145.83 KiB 0 B 0.00% ✅
Worker N/A 22.96 KiB N/A N/A N/A
Rum Shopify N/A 218.48 KiB N/A N/A N/A
Rum-shopify Profiler N/A 8.35 KiB N/A N/A N/A
Rum-shopify Recorder N/A 4.85 KiB N/A N/A N/A

@datadog-prod-us1-4

datadog-prod-us1-4 Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Tests

✅ All CI checks and tests passed.

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
• Patch Coverage: 100.00%
• Overall Coverage: 78.26% (+0.10%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: aa33c28 | Docs | View more details | Give us feedback!

@thomas-lebeau thomas-lebeau changed the title 🔥 Remove the Karma configuration and dependencies 🔥 Remove Karma (configuration, dependencies and Karma-only test helpers) Oct 14, 2026
@thomas-lebeau
thomas-lebeau force-pushed the thomas.lebeau/remove-karma branch from 2702bc3 to e6dae91 Compare October 15, 2026 14:37
Unit tests (`unit`) and BrowserStack unit tests (`unit-bs`) now run on
Vitest: remove what was only used by Karma.

- karma.base.conf.js, karma.bs.conf.js, the Karma reporter plugins and the
  globalThis / Object.hasOwn polyfill files
- karma*, swc-loader and @swc/core (only used to transpile dependencies
  for Karma) dependencies, and their LICENSE-3rdparty.csv entries
- the karma-webpack update pins in renovate.json and dependabot.yml
- stale Karma mentions in docs and comments
…iases

The Karma versions of the test helpers are dead code now: replace them with
their Vitest implementations and remove the aliases redirecting to the
copies in test/unit-vitest.

- registerCleanupTask: runs tasks with `onTestFinished`
- getCurrentJasmineSpec: tracked from forEach.ts (run for every test file)
- disableJasmineUncaughtExceptionTracking: Vitest-compatible listeners
- allJsonSchemas: `import.meta.glob` instead of webpack's `require.context`
  (no more JS + d.ts pair)
- vitest declared as a devDependency of @datadog/browser-core, which now
  imports it in test helpers
@thomas-lebeau
thomas-lebeau force-pushed the thomas.lebeau/remove-karma branch from e6dae91 to aa33c28 Compare October 15, 2026 15:55

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant