Files
Mario Heiderich 5e23a03688 chore(test): migrate from Karma to Playwright for browser tests
Karma has been deprecated since April 2023 and has been blocking
Dependabot updates across the dev-dependency tree. This migration
replaces it with Playwright while preserving all existing test logic.

Changes:
- Replace Karma + karma-* plugin ecosystem with @playwright/test
- Add tiny zero-dep static file server for the Playwright webServer
- Add HTML runner pages for dist/purify.js and dist/purify.min.js that
  load QUnit, jQuery, DOMPurify, test-suite.js, and an ES module entry
- Add Playwright spec that drives each runner, waits for QUnit.done,
  and surfaces per-assertion failure detail on error
- Drop rollup-plugin-includepaths (was only aliasing 'purify' for Karma)
- Drop minimist (was only used by the old custom-launchers config)
- Update build-and-test.yml to install Playwright browsers and upload
  playwright-report/ artifact on failure

Unchanged:
- test/test-suite.js (2398 lines of QUnit assertions)
- test/bootstrap-test-suite.js
- test/fixtures/expect.mjs
- test/config/setup.js
- test/jsdom-node-runner.js, test/jsdom-node.js
- test/fuzz/**
- rollup.config.js, src/**, scripts/**

Browser coverage: chromium, firefox, and webkit run locally and on
non-BrowserStack CI (3 rendering engines: Blink, Gecko, WebKit).
The 28-browser BrowserStack matrix is temporarily disabled and will
be restored in a follow-up PR via browserstack-node-sdk.

Test counts verified identical pre/post migration:
911 QUnit tests × 2 suites, all passing.
2026-04-16 12:46:30 +02:00

46 lines
1.5 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>DOMPurify QUnit — purify.js</title>
<link
rel="stylesheet"
href="/node_modules/qunit/qunit/qunit.css"
/>
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<!-- QUnit must load first. Disable auto-start so we can register tests
from the (deferred) module script below before kicking QUnit off. -->
<script src="/node_modules/qunit/qunit/qunit.js"></script>
<script>
QUnit.config.autostart = false;
</script>
<!-- jQuery is required by the `XSS test: jQuery[…]` block in test-suite.js
which verifies DOMPurify output is safe when passed through
jQuery.fn.html(). -->
<script src="/node_modules/jquery/dist/jquery.js"></script>
<!-- DOMPurify (UMD build). Sets window.DOMPurify. -->
<script src="/dist/purify.js"></script>
<!-- Installs window.alert XSS-detection hook and the custom QUnit
`contains` assertion used throughout the test suite. -->
<script src="/test/config/setup.js"></script>
<!-- UMD test suite. Sets window.testSuite. -->
<script src="/test/test-suite.js"></script>
<!-- Tells entry.js which QUnit module name to register under. -->
<script>
window.__SUITE_NAME__ = 'DOMPurify src';
</script>
<!-- Loads the ESM fixture file, wires up QUnit, then calls QUnit.start(). -->
<script type="module" src="/test/browser/entry.js"></script>
</body>
</html>