Skip to content

test: add packaged import coverage#406

Draft
Bortlesboat wants to merge 1 commit intoa2aproject:mainfrom
Bortlesboat:codex/a2a-js-pack-install-test-294
Draft

test: add packaged import coverage#406
Bortlesboat wants to merge 1 commit intoa2aproject:mainfrom
Bortlesboat:codex/a2a-js-pack-install-test-294

Conversation

@Bortlesboat
Copy link
Copy Markdown

Summary

  • add a package-install harness to est-build that packs the SDK and installs it into throwaway consumers
  • verify ESM, CommonJS, and TypeScript consumers can import all published entrypoints from the packed artifact
  • keep the install flow cross-platform so the coverage works on Windows as well

Verification

  • npm run test-build
  • npx eslint scripts/test-package-install.mjs
  • npx prettier --check package.json scripts/test-package-install.mjs

Closes #294

Add a build-time package install harness that packs the SDK and verifies ESM, CJS, and TypeScript consumers can import every published entrypoint.

This fixes a2aproject#294
@github-actions
Copy link
Copy Markdown

🧪 Code Coverage

⬇️ Download Full Report

No coverage changes.

Generated by coverage-comment.yml

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new integration test script, scripts/test-package-install.mjs, which is integrated into the test-build lifecycle. The script verifies that the package can be correctly installed and imported in ESM, CJS, and TypeScript environments by creating a tarball and setting up temporary consumer projects. Feedback suggests optimizing the npm install command for speed by disabling audits and funding notices, and improving maintainability by dynamically reading peer dependencies from package.json instead of hardcoding them.

await mkdir(consumerDir, { recursive: true });
await writeJson(path.join(consumerDir, 'package.json'), packageJson);
await writeFile(path.join(consumerDir, probeName), probeContents);
runNpm(['install', '--silent', ...installDeps], consumerDir);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

To speed up the test execution, consider adding --no-audit and --no-fund to the npm install command. These checks are generally unnecessary for a throwaway consumer test environment.

  runNpm(['install', '--silent', '--no-audit', '--no-fund', ...installDeps], consumerDir);

void GrpcTransportFactory;
`;

const peerDeps = ['express', '@grpc/grpc-js', '@bufbuild/protobuf'];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Hardcoding the list of peer dependencies creates a maintenance burden and a risk of drift if package.json is updated. It would be more robust to read these directly from the root package.json file.

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.

[Test]: Automated test for package installation and imports resolution

1 participant