Skip to content

test-assert-lite to run tests in browser - #35

Merged
kawanet merged 3 commits into
mainfrom
feature/playwright
Oct 9, 2026
Merged

kawanet merged 3 commits into
mainfrom
feature/playwright

Conversation

@kawanet

@kawanet kawanet commented Oct 9, 2026

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI lite review requested due to automatic review settings October 9, 2026 00:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Browser test execution and build paths are currently broken due to missing node:test/node:assert resolution in the import-map flow and a deleted shim still referenced by the benchmark Rollup config.

4 open findings
What changed in this PR

This PR refactors the browser test approach to run the existing Node-style test suites in a real Chromium environment, replacing the previous browser/tests.html + Mocha harness with an ESM test bundle plus an import map–driven CLI runner.

Changes:

  • Switch browser test bundling output from IIFE (bundled.js) to ESM (bundled.mjs) and adjust related build targets.
  • Replace the previous Playwright/Mocha HTML runner with a CLI-driven Chromium run using an import map, and add playwright-js-cli to devDependencies.
  • Make the entrypoint test suite more environment-aware by skipping Node-only require() checks outside Node.
File Description
test/​90.entrypoint.test.ts Skips Node-only require() entrypoint tests when not running under Node; uses dynamic node: imports.
package.json Adds playwright-js-cli and includes browser/import.mjs in published files.
builder/​rollup-builder-test.config.ts Tweaks Rollup externals handling (notably to avoid externalizing the multi-entry virtual module).
builder/​rollup-browser-test.config.ts Bundles browser tests as ESM and changes externalization/aliasing strategy for browser execution.
builder/​node-test.shim.ts Removed legacy Mocha-based node:test shim used by the prior browser harness.
builder/​node-assert.shim.ts Removed legacy node:assert shim used by the prior browser harness.
builder/​Makefile Updates browser test bundle target to bundled.mjs and trims comments around prior shimming approach.
browser/​vendor/​Makefile Switches vendored library bundling output format from IIFE to ESM.
browser/​tests.html Removes the old Mocha-in-HTML browser test runner page.
browser/​tests.cli.mjs Removes the old Playwright-driven HTML test runner script.
browser/​node-url.shim.mjs Loosens the shim function signature (runtime-only throw remains).
browser/​node-crypto.shim.mjs Refactors the crypto shim but introduces an inconsistent SHA-1 implementation naming/callsite.
browser/​Makefile Updates the CI entrypoint to use chromium-js with --script and --import-map.
browser/​import.mjs Adds an ESM entrypoint that re-exports createHash from the global SHA1.
browser/​import-map.json Adds an import map for browser runs (node shims + vendored libraries + package mapping).
.github/​workflows/​browser.yml Runs Browser CI on PRs and adds npm install before invoking the browser Makefile targets.

🧠 Review effort: Lite


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread browser/import-map.json Resolved
Comment thread builder/rollup-browser-test.config.ts Resolved
Comment on lines +24 to 26
- run: npm install
- run: make -C browser install
- run: make -C browser test
Comment thread builder/rollup-browser-test.config.ts Outdated
Comment on lines 28 to 32
@@ -57,12 +31,6 @@ const rollupConfig: RollupOptions = {
// run exercises the published artifact rather than the sources.
alias({
@kawanet
kawanet merged commit 879eb8b into main Oct 9, 2026
14 checks passed
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.

2 participants