test: lock browser package export contract#165
Conversation
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Overview
VerificationThe test file
The test correctly validates all the browser export contracts mentioned in the PR description. Files Reviewed (1 file)
Reviewed by minimax-m2.5-20260211 · 169,725 tokens |
There was a problem hiding this comment.
Code Review
This pull request adds a new test suite to validate the published package contract, including browser entrypoints and build scripts. The review feedback suggests replacing process.cwd() with relative path resolution to ensure the tests are robust across different execution environments, particularly in monorepo setups.
| }; | ||
|
|
||
| function readPackageJson(): PackageJsonShape { | ||
| const packagePath = path.resolve(process.cwd(), 'package.json'); |
There was a problem hiding this comment.
Using process.cwd() to resolve the path to package.json can be unreliable in monorepo environments where the current working directory might be the repository root instead of the package root. This can lead to tests reading the wrong configuration or failing to find the file. It is more robust to resolve paths relative to the test file's location.
| }); | ||
|
|
||
| it('retains the browser-root source entry used by the root browser export', () => { | ||
| const browserRootPath = path.resolve(process.cwd(), 'src/browser-root.ts'); |
There was a problem hiding this comment.
Summary
Adds a regression test that locks the browser-facing package contract exposed by
@hashgraphonline/standards-sdk.This is the source-side follow-up to the downstream alias churn: the SDK itself should keep exporting and building the browser entrypoints that consumers rely on instead of encouraging package aliases as a workaround.
What Changed
__tests__/package-exports.test.tsbrowserexport still points atbrowser-root./browserstays exportedbuildandprepublishOnlysrc/browser-root.tsremains presentVerification
pnpm exec jest --config jest.config.json --runInBand --coverage=false __tests__/browser-entry.test.ts __tests__/package-exports.test.tspnpm run lintpnpm run typecheckpnpm run buildScope
This PR intentionally avoids unrelated dirty worktree changes in the local checkout and only carries the regression coverage for the package contract.