Skip to content

Add Node.js and bun tests to release pipeline#115

Merged
cb-srinaths merged 10 commits intomasterfrom
test/bun-worker
Apr 23, 2026
Merged

Add Node.js and bun tests to release pipeline#115
cb-srinaths merged 10 commits intomasterfrom
test/bun-worker

Conversation

@cb-srinaths
Copy link
Copy Markdown
Collaborator

@cb-srinaths cb-srinaths commented Apr 22, 2026

Test importing the esm worker and run tests on node 20/22/24 and Bun

@snyk-io
Copy link
Copy Markdown

snyk-io Bot commented Apr 22, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Copy link
Copy Markdown

@hivel-marco hivel-marco Bot left a comment

Choose a reason for hiding this comment

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

PR Complexity Score: 3.4 - Simple

View Breakdown
  • Lines Changed: 234
  • Files Changed: 7
  • Complexity Added: 18
  • Raw Score: 52.68
Overview

This PR adds continuous integration and improves test and build tooling for the Chargebee library, including support for multiple Node versions and Bun. It refines test configuration with a dedicated tsconfig.test.json and new worker-bundle tests to verify ESM worker exports. It also adjusts Git ignore rules so ESM fixture scripts are tracked and slightly optimizes the release workflow.

Key Changes
  • Introduces a CI GitHub Actions workflow that runs install, build, and test across Node 20/22/24 and adds a separate job to build and test with Bun.
  • Enhances the release workflow by enabling npm cache for the Node setup step to speed up publishing.
  • Updates .gitignore to keep .mjs files under test/fixtures and test/scripts in version control while still ignoring other JS artifacts.
  • Adjusts the npm test script to use a dedicated tsconfig.test.json, improving TypeScript/ts-node configuration isolation for tests.
  • Adds a worker-bundle test suite that verifies the built ESM worker bundle exports all expected webhook-related values and works correctly when loaded inside a Node worker thread (type: 'module').
  • Introduces tsconfig.test.json to configure test compilation behavior and ts-node (including experimental resolver and CommonJS override for runtime).
Risks & Considerations
  • The CI workflow assumes npm ci, npm run build, and npm test work in all Node matrix versions and in the Bun environment; incompatibilities or missing Bun support could cause CI failures.
  • Worker-bundle tests depend on esm/chargebee.esm.worker.js being built; if build outputs change path or name, tests will need to be updated accordingly.
  • The use of ts-node with experimentalResolver and overridden module settings may mask or introduce module-resolution issues that differ from the production build configuration.
  • Ensuring that .mjs fixtures are now tracked may surface previously unnoticed linting or tooling constraints on those files.
File-level change summary
File Change summary
.github/workflows/ci.yml Adds a new CI workflow that runs install, build, and tests across Node 20/22/24 and under Bun.
.github/workflows/release.yml Enables npm caching in the release workflow’s Node setup to speed up publish runs and fixes EOF newline.
.gitignore Updates ignore rules to continue ignoring JS files while explicitly including .mjs files in test fixtures and scripts.
package.json Updates the test script to use TS_NODE_PROJECT=./tsconfig.test.json for more controlled test TypeScript compilation.
test/fixtures/load-esm-worker-bundle.mjs Adds an ESM worker-thread fixture that loads the built ESM worker bundle and checks for required webhook exports.
test/worker-bundle.test.ts Adds mocha tests that validate the ESM worker bundle’s exports and its ability to run correctly inside a Node worker thread.
tsconfig.test.json Introduces a dedicated TypeScript configuration for tests, including ts-node settings and module options.

Comment thread test/worker-bundle.test.ts
@cb-srinaths cb-srinaths merged commit 9840deb into master Apr 23, 2026
7 checks passed
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.

2 participants