-
-
Notifications
You must be signed in to change notification settings - Fork 797
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for nodejs22.x runtime (#1837)
Co-authored-by: MazurDorian <mazur.dorian15@gmail.com>
- Loading branch information
1 parent
d3519c2
commit 1b21934
Showing
5 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
tests/integration/docker/nodejs/nodejs22.x/dockerNodejs22.x.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import assert from "node:assert" | ||
import { env } from "node:process" | ||
import { join } from "desm" | ||
import { setup, teardown } from "../../../../_testHelpers/index.js" | ||
import { BASE_URL } from "../../../../config.js" | ||
|
||
describe("Node.js 22.x with Docker tests", function desc() { | ||
beforeEach(() => | ||
setup({ | ||
servicePath: join(import.meta.url), | ||
}), | ||
) | ||
|
||
afterEach(() => teardown()) | ||
;[ | ||
{ | ||
description: "should work with nodejs22.x in docker container", | ||
expected: { | ||
message: "Hello Node.js 22.x!", | ||
}, | ||
path: "/dev/hello", | ||
}, | ||
].forEach(({ description, expected, path }) => { | ||
it(description, async function it() { | ||
// "Could not find 'Docker', skipping tests." | ||
if (!env.DOCKER_DETECTED) { | ||
this.skip() | ||
} | ||
|
||
const url = new URL(path, BASE_URL) | ||
const response = await fetch(url) | ||
const json = await response.json() | ||
|
||
assert.equal(json.message, expected.message) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
"use strict" | ||
|
||
// eslint-disable-next-line unicorn/prefer-node-protocol | ||
const { versions } = require("process") | ||
|
||
const { stringify } = JSON | ||
|
||
module.exports.hello = async () => { | ||
return { | ||
body: stringify({ | ||
message: "Hello Node.js 22.x!", | ||
version: versions.node, | ||
}), | ||
statusCode: 200, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
service: docker-nodejs22-x-test | ||
|
||
configValidationMode: error | ||
deprecationNotificationMode: error | ||
|
||
plugins: | ||
- ../../../../../src/index.js | ||
|
||
provider: | ||
architecture: x86_64 | ||
deploymentMethod: direct | ||
memorySize: 1024 | ||
name: aws | ||
region: us-east-1 | ||
runtime: nodejs22.x | ||
stage: dev | ||
versionFunctions: false | ||
|
||
custom: | ||
serverless-offline: | ||
noTimeout: true | ||
useDocker: true | ||
|
||
functions: | ||
hello: | ||
events: | ||
- http: | ||
method: get | ||
path: hello | ||
handler: handler.hello |