Repository navigation
test-assert-lite to run tests in browser - #35
Merged
Merged
Conversation
There was a problem hiding this comment.
🟡 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-clito 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 on lines
+24
to
26
| - run: npm install | ||
| - run: make -C browser install | ||
| - run: make -C browser test |
Comment on lines
28
to
32
| @@ -57,12 +31,6 @@ const rollupConfig: RollupOptions = { | |||
| // run exercises the published artifact rather than the sources. | |||
| alias({ | |||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


No description provided.