Skip to content

Commit c885ff2

Browse files
Add unit test to know when oldest node lts changes (#863)
* add unit test to know when oldest node lts changes * change end date to a month before oldst lts end date * Update packages/backend-function/src/factory.test.ts Co-authored-by: Edward Foyle <[email protected]> --------- Co-authored-by: Edward Foyle <[email protected]>
1 parent e5da97e commit c885ff2

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

.changeset/calm-books-refuse.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@aws-amplify/backend-function': patch
3+
---
4+
5+
Add unit test to know when oldest Node LTS changes to update default function runtime

packages/backend-function/src/factory.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,5 +337,15 @@ void describe('AmplifyFunctionFactory', () => {
337337
new Error('runtime must be one of the following: 16, 18, 20')
338338
);
339339
});
340+
341+
void it('throws when the oldest maintained Node LTS reaches end of life', () => {
342+
// A month before the date when the oldest Node LTS maintenance ends according to https://github.com/nodejs/release#release-schedule.
343+
// Once this test fails, update endDate to a month before the end date of the next Node LTS version.
344+
// After updating the date, next would be updating the default function runtime in factory.ts.
345+
const endDate = new Date('2025-03-30');
346+
const currentDate = new Date();
347+
348+
assert.ok(endDate > currentDate);
349+
});
340350
});
341351
});

0 commit comments

Comments
 (0)