Skip to content

test: add package export smoke checks#1406

Open
Herrtian wants to merge 2 commits into
open-feature:mainfrom
Herrtian:test-package-format-exports
Open

test: add package export smoke checks#1406
Herrtian wants to merge 2 commits into
open-feature:mainfrom
Herrtian:test-package-format-exports

Conversation

@Herrtian

@Herrtian Herrtian commented May 24, 2026

Copy link
Copy Markdown

Closes #62

Adds a package export smoke check that packs the core, server, and web packages, installs the tarballs into a temporary fixture, compiles ESM and CJS consumers, and runs both outputs.

Checks:

  • npm run build
  • npm run test:package-exports
  • npx eslint scripts/test-package-exports.mjs
  • npx prettier --check scripts/test-package-exports.mjs package.json .github/workflows/pr-checks.yaml
  • git diff --check

@Herrtian Herrtian requested review from a team as code owners May 24, 2026 17:38

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

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.

Code Review

This pull request introduces a new test script, test-package-exports.mjs, and adds a corresponding test:package-exports entry to package.json. The script automates the validation of package exports by packing local workspaces, installing them into a temporary fixture project, and verifying that both ESM and CommonJS outputs compile and execute correctly. I have no feedback to provide as there were no review comments.

@Herrtian Herrtian force-pushed the test-package-format-exports branch 2 times, most recently from 44d9480 to ae506cf Compare June 2, 2026 21:52
@toddbaert

Copy link
Copy Markdown
Member

Thanks @Herrtian . I will take a look.

@toddbaert

Copy link
Copy Markdown
Member

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.

Signed-off-by: Herrtian <70463940+Herrtian@users.noreply.github.com>
@toddbaert toddbaert force-pushed the test-package-format-exports branch from ae506cf to a68edf1 Compare June 19, 2026 16:52
@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c22865b4-e0d1-44f6-b9d3-f8d966c125ba

📥 Commits

Reviewing files that changed from the base of the PR and between a68edf1 and 86e6c1d.

📒 Files selected for processing (1)
  • scripts/test-package-exports.mjs
🚧 Files skipped from review as they are similar to previous changes (1)
  • scripts/test-package-exports.mjs

📝 Walkthrough

Walkthrough

A new Node.js ESM script (scripts/test-package-exports.mjs) is added to validate SDK package exports for both ESM and CJS by packing workspaces into tarballs, generating TypeScript fixture projects, compiling with tsc, and executing the compiled outputs. The script is registered as test:package-exports in package.json and invoked in a new CI step after the build step.

Changes

Package exports ESM/CJS integration test

Layer / File(s) Summary
Script setup, constants, utilities, and fixture source generation
scripts/test-package-exports.mjs
Defines workspace/package lists, fixture flag config, promisified execFileAsync run helper with stdout/stderr capture, cross-platform npm wrapper, packPackage() for tarball creation, and sourceFor() to emit TypeScript that imports InMemoryProvider/OpenFeature, ErrorCode, and ServerProviderStatus, then asserts expected values.
Fixture project file writing
scripts/test-package-exports.mjs
Implements writeFixture(), which writes the fixture package.json and tsconfig.json, then calls sourceFor() to generate per-SDK .mts and .cts entrypoint files.
Pack, install, compile, and execute orchestration
scripts/test-package-exports.mjs
Implements main(): creates a temp dir, packs each workspace, writes the fixture, installs tarballs with --ignore-scripts, runs tsc, executes each SDK's .mjs and .cjs outputs, and cleans up via a finally block. Invoked at module load via top-level await.
npm script and CI step wiring
package.json, .github/workflows/pr-checks.yaml
Adds test:package-exports script entry in package.json and inserts a "Test package exports" CI step after the Build step in the PR checks workflow.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'test: add package export smoke checks' directly and clearly describes the main change: adding a new package export smoke test.
Description check ✅ Passed The description is related to the changeset, explaining what the package export smoke check does and listing the checks performed.
Linked Issues check ✅ Passed All code changes fully implement the requirements from issue #62: a new test script packages tarballs locally and imports them in ESM/CJS test applications, compiles, and runs both to validate dual-format exports work correctly.
Out of Scope Changes check ✅ Passed All changes are directly scoped to implementing the package export smoke check feature: the test script, workflow configuration, and package.json script addition are all necessary for this objective.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/test-package-exports.mjs`:
- Around line 14-15: The sdkPackages array is missing the `@openfeature/core`
package, which causes the smoke check test to skip generating and executing
ESM/CJS fixture imports for the core package. Add '`@openfeature/core`' to the
sdkPackages array definition so that the subsequent test logic (which iterates
over this array) will properly generate and execute fixture imports for all
three packages (core, server, and web), ensuring complete coverage of the PR
objective.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e22b902d-61a3-4b16-9f36-d125f642ad50

📥 Commits

Reviewing files that changed from the base of the PR and between 3c01041 and a68edf1.

📒 Files selected for processing (3)
  • .github/workflows/pr-checks.yaml
  • package.json
  • scripts/test-package-exports.mjs

Comment thread scripts/test-package-exports.mjs
Signed-off-by: Herrtian <70463940+Herrtian@users.noreply.github.com>
@Herrtian Herrtian force-pushed the test-package-format-exports branch from 26c7e13 to 86e6c1d Compare June 19, 2026 17:10

@toddbaert toddbaert left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @Herrtian . This looks great. I can't see any issues.

I wouldn't worry about Nest/Angular/React due to what I mention here.

I'll leave this open for a bit for other reviews, but merge next week. Thanks again!

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.

Create "sanity check" integration tests for ESM and CJS

2 participants