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

add nodejs16 as runtime #610

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,6 @@ Run unit tests using `npm test` or `npm run test:coverage` to get coverage resul

We run our integration tests twice per day from our GitHub workflow. These tests install the beta version of the plugin, deploy a function app (with APIM), re-deploy (to make sure ARM template deployment is skipped), invoke the function directly, invoke the APIM endpoint and then remove the resource group, making assertions on the output at each step. While the number of configurations one could use in the Serverless Framework is virtually infinite, we tried to capture the main runtimes and platforms that are supported by the tool:

- Node 10 on Linux using remote build
- Node 10 on Linux using external package
- Node 10 on Windows
- Node 10 on Windows using webpack
- Node 12 on Linux using remote build
- Node 12 on Linux using external package
- Node 12 on Linux using remote build and premium functions
Expand All @@ -323,6 +319,9 @@ We run our integration tests twice per day from our GitHub workflow. These tests
- Node 14 on Windows
- Node 14 on Windows using premium functions
- Node 14 on Windows using webpack
- Node 16 on Windows
- Node 16 on Windows using premium functions
- Node 16 on Windows using webpack
- Python 3.6 (Linux only)
- Python 3.6 (Linux only) using premium functions
- Python 3.7 (Linux only)
Expand Down
20 changes: 10 additions & 10 deletions src/config/runtime.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,46 @@ import { Runtime, isNodeRuntime, isPythonRuntime, getRuntimeVersion, getRuntimeL


describe("Runtime", () => {
it("identifies node runtimes correctly", () => {
expect(isNodeRuntime(Runtime.NODE10)).toBe(true);
it("identifies node runtimes correctly", () => {
expect(isNodeRuntime(Runtime.NODE12)).toBe(true);
expect(isNodeRuntime(Runtime.NODE14)).toBe(true);
expect(isNodeRuntime(Runtime.NODE16)).toBe(true);
expect(isNodeRuntime(Runtime.PYTHON36)).toBe(false);
expect(isNodeRuntime(Runtime.PYTHON37)).toBe(false);
expect(isNodeRuntime(Runtime.PYTHON38)).toBe(false);
});

it("identifies python runtimes correctly", () => {
expect(isPythonRuntime(Runtime.NODE10)).toBe(false);
it("identifies python runtimes correctly", () => {
expect(isPythonRuntime(Runtime.NODE12)).toBe(false);
expect(isPythonRuntime(Runtime.NODE14)).toBe(false);
expect(isPythonRuntime(Runtime.NODE16)).toBe(false);
expect(isPythonRuntime(Runtime.PYTHON36)).toBe(true);
expect(isPythonRuntime(Runtime.PYTHON37)).toBe(true);
expect(isPythonRuntime(Runtime.PYTHON38)).toBe(true);
});

it("gets runtime version", () => {
expect(getRuntimeVersion(Runtime.NODE10)).toBe("10");
it("gets runtime version", () => {
expect(getRuntimeVersion(Runtime.NODE12)).toBe("12");
expect(getRuntimeVersion(Runtime.NODE14)).toBe("14");
expect(getRuntimeVersion(Runtime.NODE16)).toBe("16");
expect(getRuntimeVersion(Runtime.PYTHON36)).toBe("3.6");
expect(getRuntimeVersion(Runtime.PYTHON37)).toBe("3.7");
expect(getRuntimeVersion(Runtime.PYTHON38)).toBe("3.8");
});

it("gets runtime language", () => {
expect(getRuntimeLanguage(Runtime.NODE10)).toBe("nodejs");
it("gets runtime language", () => {
expect(getRuntimeLanguage(Runtime.NODE12)).toBe("nodejs");
expect(getRuntimeLanguage(Runtime.NODE14)).toBe("nodejs");
expect(getRuntimeLanguage(Runtime.NODE16)).toBe("nodejs");
expect(getRuntimeLanguage(Runtime.PYTHON36)).toBe("python");
expect(getRuntimeLanguage(Runtime.PYTHON37)).toBe("python");
expect(getRuntimeLanguage(Runtime.PYTHON38)).toBe("python");
});

it("gets function worker runtime", () => {
expect(getFunctionWorkerRuntime(Runtime.NODE10)).toBe("node");
it("gets function worker runtime", () => {
expect(getFunctionWorkerRuntime(Runtime.NODE12)).toBe("node");
expect(getFunctionWorkerRuntime(Runtime.NODE14)).toBe("node");
expect(getFunctionWorkerRuntime(Runtime.NODE16)).toBe("node");
expect(getFunctionWorkerRuntime(Runtime.PYTHON36)).toBe("python");
expect(getFunctionWorkerRuntime(Runtime.PYTHON37)).toBe("python");
expect(getFunctionWorkerRuntime(Runtime.PYTHON38)).toBe("python");
Expand Down
12 changes: 6 additions & 6 deletions src/config/runtime.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@

export enum Runtime {
NODE10 = "nodejs10",
export enum Runtime {
NODE12 = "nodejs12",
NODE14 = "nodejs14",
NODE16 = "nodejs16",
PYTHON36 = "python3.6",
PYTHON37 = "python3.7",
PYTHON38 = "python3.8",
DOTNET22 = "dotnet2.2",
DOTNET31 = "dotnet3.1",
}

export const supportedRuntimes = [
Runtime.NODE10,
export const supportedRuntimes = [
Runtime.NODE12,
Runtime.NODE14,
Runtime.NODE16,
Runtime.PYTHON36,
Runtime.PYTHON37,
Runtime.PYTHON38,
Expand Down Expand Up @@ -88,10 +88,10 @@ export enum FunctionAppOS {
LINUX = "linux"
}

export const dockerImages = {
nodejs10: "NODE|10",
export const dockerImages = {
nodejs12: "NODE|12",
nodejs14: "NODE|14",
nodejs14: "NODE|16",
"python3.6": "PYTHON|3.6",
"python3.7": "PYTHON|3.7",
"python3.8": "PYTHON|3.8",
Expand Down
10 changes: 5 additions & 5 deletions src/services/configService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,28 +225,28 @@ describe("Config Service", () => {
sls.service.provider.runtime = "python2.7" as any;
expect(() => new ConfigService(sls, {} as any))
.toThrowError("Runtime python2.7 is not supported. " +
"Runtimes supported: nodejs10,nodejs12,nodejs14,python3.6,python3.7,python3.8");
"Runtimes supported: nodejs12,nodejs14,nodejs16,python3.6,python3.7,python3.8");
});

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

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

it("Does not throw an error when valid nodejs version is defined", () => {
const sls = MockFactory.createTestServerless();
sls.service.provider.runtime = Runtime.NODE10
sls.service.provider.runtime = Runtime.NODE12
let configService: ConfigService;
expect(() => configService = new ConfigService(sls, {} as any)).not.toThrow();
expect(configService.isLinuxTarget()).toBe(false);
Expand All @@ -258,7 +258,7 @@ describe("Config Service", () => {
sls.service.provider.runtime = undefined;
expect(() => new ConfigService(sls, {} as any))
.toThrowError("Runtime undefined. " +
"Runtimes supported: nodejs10,nodejs12,nodejs14,python3.6,python3.7,python3.8");
"Runtimes supported: nodejs12,nodejs14,nodejs16,python3.6,python3.7,python3.8");
});

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