fix: mock browser env and set coverage to run both envs - #71
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the Jest test setup to exercise both Node and “browser” execution paths for unit tests by splitting unit tests into two Jest projects and adapting unit tests to provide an upload source compatible with each environment.
Changes:
- Split unit tests into
unit-nodeandunit-browserJest projects, with a browser-platform setup file that forcesstd-envto reportisNode: false. - Updated unit tests to use a shared
makeUploadSource()helper and to skip Node-only directory-upload assertions when running under the browser project. - Updated
test:utto run both unit projects, and added convenience scripts for running each project individually.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/utils.ts | Adds IS_BROWSER and makeUploadSource() to provide an env-appropriate upload source for unit tests. |
| tests/unit/trash.spec.ts | Uses makeUploadSource() for uploads to work across unit-node/unit-browser. |
| tests/unit/file.spec.ts | Uses makeUploadSource() and skips directory-upload tests in the browser project. |
| tests/unit/events.spec.ts | Uses makeUploadSource() for uploads. |
| tests/unit/abort.spec.ts | Uses makeUploadSource() and skips directory-upload test in the browser project. |
| tests/platform.browser.ts | Mocks std-env to force the browser code path during unit-browser runs. |
| package.json | Runs unit tests in both projects; adds per-project scripts. |
| jest.config.ts | Defines unit-node and unit-browser projects sharing the same unit test match set. |
| eslint.config.mjs | Adds Blob as a readonly global for linting. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.