Skip to content

Conversation

@GabiGrin
Copy link
Collaborator

Summary

  • Add automated test to verify ES module compliance
  • Integrate ES module test into CI pipeline
  • Add npm script for running ES module tests

Background

This adds testing infrastructure to catch ES module import issues that would break the SDK when consumed by other ES module projects.

Changes

  • test-esm-strict.mjs: Strict Node.js ES module test
  • tests/esm-compliance.test.js: Vitest-based compliance test
  • package.json: Added test:esm script and updated main test script
  • .github/workflows/unit-tests.yml: Added ES module compliance check to CI

Test plan

  • ES module test passes with correct imports
  • ES module test fails with incorrect imports (verified manually)
  • CI integration works

Add automated testing to catch ES module import issues:
- New strict ES module test using Node.js directly
- Updated CI pipeline to run ES module compliance check
- Added npm script for ES module testing

This prevents future regressions where missing .js extensions
would break the SDK when consumed by ES module projects.
* Test to verify ES module compliance by importing the built SDK
* This test runs against the compiled output to catch import issues
*/
import { createClient } from '../dist/index.js';
Copy link
Collaborator

Choose a reason for hiding this comment

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

does this really catch stuff? aren't we good with test:esm? might be nicer DX to not have to run build to run the unit tests

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I verified it would have failed with the issue that I fixed in #33
if you have a better way to prevent sdk breaking prod let me know and I'll change

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we can move to "e2e" to be semantically correct

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.

3 participants