Skip to content
This repository was archived by the owner on Dec 9, 2024. It is now read-only.

Commit b48513b

Browse files
authored
feat: Support for nodejs18 (#642)
1 parent 33f82d2 commit b48513b

File tree

4 files changed

+29
-4
lines changed

4 files changed

+29
-4
lines changed

src/armTemplates/resources/functionApp.test.ts

+17
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,23 @@ describe("Function App Resource", () => {
231231
expect(functionAppNodeVersion.value).toEqual("~16");
232232
});
233233

234+
it("gets correct parameters - node 18", () => {
235+
const config = getConfig(FunctionAppOS.LINUX, Runtime.NODE18);
236+
237+
const resource = new FunctionAppResource();
238+
239+
const params = resource.getParameters(config);
240+
const {
241+
linuxFxVersion,
242+
functionAppNodeVersion,
243+
} = params;
244+
245+
assertLinuxParams(params);
246+
247+
expect(linuxFxVersion.value).toEqual("NODE|18");
248+
expect(functionAppNodeVersion.value).toEqual("~18");
249+
});
250+
234251
it("gets correct parameters - python 3.6", () => {
235252
const config = getConfig(FunctionAppOS.LINUX, Runtime.PYTHON36);
236253

src/config/runtime.test.ts

+5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ describe("Runtime", () => {
77
expect(isNodeRuntime(Runtime.NODE12)).toBe(true);
88
expect(isNodeRuntime(Runtime.NODE14)).toBe(true);
99
expect(isNodeRuntime(Runtime.NODE16)).toBe(true);
10+
expect(isNodeRuntime(Runtime.NODE18)).toBe(true);
1011
expect(isNodeRuntime(Runtime.PYTHON36)).toBe(false);
1112
expect(isNodeRuntime(Runtime.PYTHON37)).toBe(false);
1213
expect(isNodeRuntime(Runtime.PYTHON38)).toBe(false);
@@ -17,6 +18,7 @@ describe("Runtime", () => {
1718
expect(isPythonRuntime(Runtime.NODE12)).toBe(false);
1819
expect(isPythonRuntime(Runtime.NODE14)).toBe(false);
1920
expect(isPythonRuntime(Runtime.NODE16)).toBe(false);
21+
expect(isPythonRuntime(Runtime.NODE18)).toBe(false);
2022
expect(isPythonRuntime(Runtime.PYTHON36)).toBe(true);
2123
expect(isPythonRuntime(Runtime.PYTHON37)).toBe(true);
2224
expect(isPythonRuntime(Runtime.PYTHON38)).toBe(true);
@@ -27,6 +29,7 @@ describe("Runtime", () => {
2729
expect(getRuntimeVersion(Runtime.NODE12)).toBe("12");
2830
expect(getRuntimeVersion(Runtime.NODE14)).toBe("14");
2931
expect(getRuntimeVersion(Runtime.NODE16)).toBe("16");
32+
expect(getRuntimeVersion(Runtime.NODE18)).toBe("18");
3033
expect(getRuntimeVersion(Runtime.PYTHON36)).toBe("3.6");
3134
expect(getRuntimeVersion(Runtime.PYTHON37)).toBe("3.7");
3235
expect(getRuntimeVersion(Runtime.PYTHON38)).toBe("3.8");
@@ -43,6 +46,7 @@ describe("Runtime", () => {
4346
expect(getRuntimeLanguage(Runtime.NODE12)).toBe("nodejs");
4447
expect(getRuntimeLanguage(Runtime.NODE14)).toBe("nodejs");
4548
expect(getRuntimeLanguage(Runtime.NODE16)).toBe("nodejs");
49+
expect(getRuntimeLanguage(Runtime.NODE18)).toBe("nodejs");
4650
expect(getRuntimeLanguage(Runtime.PYTHON36)).toBe("python");
4751
expect(getRuntimeLanguage(Runtime.PYTHON37)).toBe("python");
4852
expect(getRuntimeLanguage(Runtime.PYTHON38)).toBe("python");
@@ -59,6 +63,7 @@ describe("Runtime", () => {
5963
expect(getFunctionWorkerRuntime(Runtime.NODE12)).toBe("node");
6064
expect(getFunctionWorkerRuntime(Runtime.NODE14)).toBe("node");
6165
expect(getFunctionWorkerRuntime(Runtime.NODE16)).toBe("node");
66+
expect(getFunctionWorkerRuntime(Runtime.NODE18)).toBe("node");
6267
expect(getFunctionWorkerRuntime(Runtime.PYTHON36)).toBe("python");
6368
expect(getFunctionWorkerRuntime(Runtime.PYTHON37)).toBe("python");
6469
expect(getFunctionWorkerRuntime(Runtime.PYTHON38)).toBe("python");

src/config/runtime.ts

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export enum Runtime {
44
NODE12 = "nodejs12",
55
NODE14 = "nodejs14",
66
NODE16 = "nodejs16",
7+
NODE18 = "nodejs18",
78
PYTHON36 = "python3.6",
89
PYTHON37 = "python3.7",
910
PYTHON38 = "python3.8",
@@ -16,6 +17,7 @@ export const supportedRuntimes = [
1617
Runtime.NODE12,
1718
Runtime.NODE14,
1819
Runtime.NODE16,
20+
Runtime.NODE18,
1921
Runtime.PYTHON36,
2022
Runtime.PYTHON37,
2123
Runtime.PYTHON38,
@@ -95,6 +97,7 @@ export const dockerImages = {
9597
nodejs12: "NODE|12",
9698
nodejs14: "NODE|14",
9799
nodejs16: "NODE|16",
100+
nodejs18: "NODE|18",
98101
"python3.6": "PYTHON|3.6",
99102
"python3.7": "PYTHON|3.7",
100103
"python3.8": "PYTHON|3.8",

src/services/configService.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -225,23 +225,23 @@ describe("Config Service", () => {
225225
sls.service.provider.runtime = "python2.7" as any;
226226
expect(() => new ConfigService(sls, {} as any))
227227
.toThrowError("Runtime python2.7 is not supported. " +
228-
"Runtimes supported: nodejs10,nodejs12,nodejs14,nodejs16,python3.6,python3.7,python3.8");
228+
"Runtimes supported: nodejs10,nodejs12,nodejs14,nodejs16,nodejs18,python3.6,python3.7,python3.8");
229229
});
230230

231231
it("throws error when incomplete nodejs version in defined", () => {
232232
const sls = MockFactory.createTestServerless();
233233
sls.service.provider.runtime = "nodejs" as any;
234234
expect(() => new ConfigService(sls, {} as any))
235235
.toThrowError("Runtime nodejs is not supported. " +
236-
"Runtimes supported: nodejs10,nodejs12,nodejs14,nodejs16,python3.6,python3.7,python3.8");
236+
"Runtimes supported: nodejs10,nodejs12,nodejs14,nodejs16,nodejs18,python3.6,python3.7,python3.8");
237237
});
238238

239239
it("throws error when unsupported nodejs version in defined", () => {
240240
const sls = MockFactory.createTestServerless();
241241
sls.service.provider.runtime = "nodejs5.x" as any;
242242
expect(() => new ConfigService(sls, {} as any))
243243
.toThrowError("Runtime nodejs5.x is not supported. " +
244-
"Runtimes supported: nodejs10,nodejs12,nodejs14,nodejs16,python3.6,python3.7,python3.8");
244+
"Runtimes supported: nodejs10,nodejs12,nodejs14,nodejs16,nodejs18,python3.6,python3.7,python3.8");
245245
});
246246

247247
it("Does not throw an error when valid nodejs version is defined", () => {
@@ -258,7 +258,7 @@ describe("Config Service", () => {
258258
sls.service.provider.runtime = undefined;
259259
expect(() => new ConfigService(sls, {} as any))
260260
.toThrowError("Runtime undefined. " +
261-
"Runtimes supported: nodejs10,nodejs12,nodejs14,nodejs16,python3.6,python3.7,python3.8");
261+
"Runtimes supported: nodejs10,nodejs12,nodejs14,nodejs16,nodejs18,python3.6,python3.7,python3.8");
262262
});
263263

264264
it("does not throw an error with python3.6", () => {

0 commit comments

Comments
 (0)