Conversation
…ve CI configuration BREAKING-CHANGE: Drop support to Node.js 20.x
a56b0b7 to
e71635b
Compare
There was a problem hiding this comment.
Pull request overview
This pull request modernizes the mini-sns-client package by updating Node.js version requirements, enhancing test coverage with comprehensive integration tests, and improving error handling robustness. The changes drop support for Node.js 20 and require Node.js ^22.14.0 or >=24.10.0, while introducing LocalStack and Testcontainers-based integration testing infrastructure.
Changes:
- Updated Node.js version requirements to ^22.14.0 or >=24.10.0, with corresponding updates to dependencies (@fgiova/aws-signature v4, @tsconfig/node22, semantic-release v25, and others)
- Added comprehensive integration test infrastructure using LocalStack and Testcontainers, with automated setup/teardown scripts for test environment provisioning
- Improved error handling in batch response parsing to gracefully handle malformed AWS SNS responses
Reviewed changes
Copilot reviewed 12 out of 15 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| .nvmrc | Set Node.js version to 22 for development |
| tsconfig.json | Updated to extend @tsconfig/node22 configuration |
| package.json | Updated Node.js engines requirement, upgraded dependencies, added test scripts for local development and integration testing |
| .env.dev | Added development environment configuration for AWS credentials |
| .gitignore | Fixed typo in first line, added test-env.json and tool directories to ignore list |
| .github/workflows/node.js.yml | Updated to test on Node.js 22 and 24 only, upgraded action versions, added permissions for OIDC publishing, removed NPM_TOKEN |
| test/scripts/runners/localstack.js | New LocalStack container runner with SNS/SQS bootstrap functionality |
| test/scripts/executors/before.js | New test setup script that starts LocalStack and creates test environment |
| test/scripts/executors/teardown.js | New test cleanup script that removes test environment file |
| test/helpers/localtest.ts | New helper to load test environment configuration and manage reaper cleanup |
| test/integration.ts | New comprehensive integration tests verifying SNS message publishing and SQS delivery |
| test/index.ts | Added test case for handling malformed batch response content |
| src/index.ts | Improved parseBatchResponseResult to return undefined for malformed responses, added type cast for method parameter |
| README.md | Updated Node.js requirements and clarified batch publishing behavior in documentation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - run: npm run build | ||
| - name: Semantic Release | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
There was a problem hiding this comment.
The NPM_TOKEN environment variable has been removed from the release workflow. While the id-token: write permission has been added for OIDC-based publishing, @semantic-release/npm version 13.x typically requires either: (1) NPM_TOKEN to be set, or (2) explicit provenance configuration in .releaserc. Without either, the release step may fail when attempting to publish to npm. Consider adding provenance configuration to the @semantic-release/npm plugin in .releaserc, or ensure that NPM_TOKEN is still available as a secret if OIDC alone is insufficient for your npm publishing setup.
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
| const { unlink } = require("node:fs/promises"); | ||
| const teardown = async () => { | ||
| if (!process.env.TEST_LOCAL) { | ||
| await unlink("test-env.json"); |
There was a problem hiding this comment.
The unlink operation on line 4 will throw an error if the file doesn't exist, potentially causing the test teardown to fail. Consider wrapping the unlink call in a try-catch block or using the force: true option with rm() instead of unlink() to silently ignore missing files.
| const { unlink } = require("node:fs/promises"); | |
| const teardown = async () => { | |
| if (!process.env.TEST_LOCAL) { | |
| await unlink("test-env.json"); | |
| const { rm } = require("node:fs/promises"); | |
| const teardown = async () => { | |
| if (!process.env.TEST_LOCAL) { | |
| await rm("test-env.json", { force: true }); |
| const reaper = runningContainers.find( | ||
| (container) => container.Labels["org.testcontainers.ryuk"] === "true", | ||
| ); | ||
| // biome-ignore lint/suspicious/noDoubleEquals: as is | ||
| const reaperNetwork = reaper.Ports.find((port) => port.PrivatePort == 8080); | ||
| const reaperPort = reaperNetwork.PublicPort; | ||
| const reaperIp = containerRuntimeClient.info.containerRuntime.host; | ||
| const reaperSessionId = reaper.Labels["org.testcontainers.session-id"]; |
There was a problem hiding this comment.
There's no null/undefined check for the reaper variable after the find() operation on line 16-17. If no container with the label "org.testcontainers.ryuk" is found, reaper will be undefined, and accessing reaper.Ports on line 20 will throw a TypeError. Consider adding a check like if (!reaper) throw new Error('Reaper container not found') before accessing its properties.
| // biome-ignore lint/suspicious/noDoubleEquals: as is | ||
| const reaperNetwork = reaper.Ports.find((port) => port.PrivatePort == 8080); |
There was a problem hiding this comment.
There's no null/undefined check for the reaperNetwork variable after the find() operation on line 20. If no port with PrivatePort 8080 is found, reaperNetwork will be undefined, and accessing reaperNetwork.PublicPort on line 21 will throw a TypeError. Consider adding validation to ensure the reaper network configuration is present before accessing its properties.
| // biome-ignore lint/suspicious/noDoubleEquals: as is | |
| const reaperNetwork = reaper.Ports.find((port) => port.PrivatePort == 8080); | |
| if (!reaper) { | |
| throw new Error("Reaper container not found (label org.testcontainers.ryuk=true)"); | |
| } | |
| // biome-ignore lint/suspicious/noDoubleEquals: as is | |
| const reaperNetwork = Array.isArray(reaper.Ports) | |
| ? reaper.Ports.find((port) => port.PrivatePort == 8080) | |
| : undefined; | |
| if (!reaperNetwork || typeof reaperNetwork.PublicPort === "undefined") { | |
| throw new Error("Reaper network configuration with PrivatePort 8080 not found"); | |
| } |
e71635b to
af8f284
Compare
This pull request introduces significant improvements to the development, testing, and CI/CD workflows for the project, focusing on modernizing Node.js support, enhancing test coverage (including integration tests with AWS-compatible services), and updating dependencies and documentation. The most important changes are grouped below by theme.
Node.js Version and Dependency Updates:
.nvmrc,package.json, and documentation accordingly. Updated dependencies, including@fgiova/aws-signatureto v4 and other dev dependencies for compatibility with newer Node.js versions. [1] [2] [3]actions/checkout@v5,actions/setup-node@v5). Adjusted release workflow to use Node.js 22.x. [1] [2] [3]Testing Enhancements:
.env.devfor local/test AWS credentials and region configuration.Documentation Updates:
README.mdto clarify supported Node.js versions, batch message publishing behavior, and updated type signatures in code examples. [1] [2]Code Quality and Robustness:
CI/CD and Permissions:
These changes collectively modernize the codebase, improve reliability and test coverage, and ensure compatibility with current Node.js and AWS SDK tooling.