Skip to content

Commit

Permalink
chore(core): emit warning for Node.js versions < 18.x (#6247)
Browse files Browse the repository at this point in the history
  • Loading branch information
trivikr committed Jul 2, 2024
1 parent 72db2b5 commit 3c64d78
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
describe("emitWarningIfUnsupportedVersion", () => {
let emitWarningIfUnsupportedVersion: any;
const emitWarning = process.emitWarning;
const supportedVersion = "16.0.0";
const supportedVersion = "18.0.0";

beforeEach(() => {
const module = require("./emitWarningIfUnsupportedVersion");
Expand All @@ -14,7 +14,7 @@ describe("emitWarningIfUnsupportedVersion", () => {
process.emitWarning = emitWarning;
});

describe.skip(`emits warning for Node.js <${supportedVersion}`, () => {
describe(`emits warning for Node.js <${supportedVersion}`, () => {
const getPreviousMajorVersion = (major: number) => (major === 0 ? 0 : major - 1);

const getPreviousMinorVersion = ([major, minor]: [number, number]) =>
Expand All @@ -38,12 +38,12 @@ describe("emitWarningIfUnsupportedVersion", () => {
expect(process.emitWarning).toHaveBeenCalledTimes(1);
expect(process.emitWarning).toHaveBeenCalledWith(
`NodeDeprecationWarning: The AWS SDK for JavaScript (v3) will
no longer support Node.js 14.x on May 1, 2024.
no longer support Node.js 16.x on January 6, 2025.
To continue receiving updates to AWS services, bug fixes, and security
updates please upgrade to an active Node.js LTS version.
updates please upgrade to a supported Node.js LTS version.
More information can be found at: https://a.co/dzr2AJd`
More information can be found at: https://a.co/74kJMmI`
);

// Verify that the warning emits only once.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,16 @@ let warningEmitted = false;
* @param version - The Node.js version string.
*/
export const emitWarningIfUnsupportedVersion = (version: string) => {
if (version && !warningEmitted && parseInt(version.substring(1, version.indexOf("."))) < 16) {
if (version && !warningEmitted && parseInt(version.substring(1, version.indexOf("."))) < 18) {
warningEmitted = true;
// ToDo: Turn back warning for future Node.js version deprecation
// process.emitWarning(
// `NodeDeprecationWarning: The AWS SDK for JavaScript (v3) will
// no longer support Node.js 14.x on May 1, 2024.
process.emitWarning(
`NodeDeprecationWarning: The AWS SDK for JavaScript (v3) will
no longer support Node.js 16.x on January 6, 2025.
// To continue receiving updates to AWS services, bug fixes, and security
// updates please upgrade to an active Node.js LTS version.
To continue receiving updates to AWS services, bug fixes, and security
updates please upgrade to a supported Node.js LTS version.
// More information can be found at: https://a.co/dzr2AJd`
// );
More information can be found at: https://a.co/74kJMmI`
);
}
};

0 comments on commit 3c64d78

Please sign in to comment.