From 31430c92c797a855c726c70faebf7c2b6b6e7bca Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Wed, 1 Nov 2023 13:42:45 -0700 Subject: [PATCH 1/5] Update node versions on CI tests. --- .github/workflows/postmerge.yaml | 2 +- .github/workflows/test.yaml | 6 ++---- scripts/bin-test/run.sh | 4 ++-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/postmerge.yaml b/.github/workflows/postmerge.yaml index 15835d76a..543f77c2c 100644 --- a/.github/workflows/postmerge.yaml +++ b/.github/workflows/postmerge.yaml @@ -34,7 +34,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 - uses: google-github-actions/auth@v0 with: diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index a02370d1f..686953002 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -30,9 +30,8 @@ jobs: strategy: matrix: node-version: - - 14.x - - 16.x - 18.x + - 20.x steps: - uses: actions/checkout@v1 - uses: actions/setup-node@v1 @@ -51,9 +50,8 @@ jobs: strategy: matrix: node-version: - - 14.x - - 16.x - 18.x + - 20.x steps: - uses: actions/checkout@v1 - uses: actions/setup-node@v1 diff --git a/scripts/bin-test/run.sh b/scripts/bin-test/run.sh index c3e3da673..aa10b4286 100755 --- a/scripts/bin-test/run.sh +++ b/scripts/bin-test/run.sh @@ -12,8 +12,8 @@ for f in scripts/bin-test/sources/*; do fi done -## DEBUG -ls -la scripts/bin-test/sources/commonjs/node_modules +# Make sure firebase-functions binary is executable +chmod +x ./lib/bin/firebase-functions.js mocha \ --file ./scripts/bin-test/mocha-setup.ts \ From cc1c371cbc9a2d3468fcea2f1b42dbb65bb5ad08 Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Wed, 1 Nov 2023 13:50:46 -0700 Subject: [PATCH 2/5] Bump all timeouts. --- scripts/bin-test/test.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/bin-test/test.ts b/scripts/bin-test/test.ts index b15012d70..2af221281 100644 --- a/scripts/bin-test/test.ts +++ b/scripts/bin-test/test.ts @@ -10,7 +10,6 @@ import * as semver from "semver"; const TIMEOUT_XL = 20_000; const TIMEOUT_L = 10_000; -const TIMEOUT_M = 5_000; const TIMEOUT_S = 1_000; const DEFAULT_OPTIONS = { @@ -124,7 +123,7 @@ async function startBin( throw e; } return true; - }, TIMEOUT_M); + }, TIMEOUT_L); if (debug) { proc.stdout?.on("data", (data: unknown) => { @@ -148,7 +147,7 @@ async function startBin( return Promise.resolve(true); } return Promise.resolve(false); - }, TIMEOUT_M); + }, TIMEOUT_L); }, }; } From 4d4eba879ce2c226998377a39ba10e01fe58c32d Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Wed, 1 Nov 2023 13:55:51 -0700 Subject: [PATCH 3/5] Kill the process more sternly. --- scripts/bin-test/test.ts | 53 +++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/scripts/bin-test/test.ts b/scripts/bin-test/test.ts index 2af221281..9992ed28e 100644 --- a/scripts/bin-test/test.ts +++ b/scripts/bin-test/test.ts @@ -6,7 +6,6 @@ import { expect } from "chai"; import * as yaml from "js-yaml"; import fetch from "node-fetch"; import * as portfinder from "portfinder"; -import * as semver from "semver"; const TIMEOUT_XL = 20_000; const TIMEOUT_L = 10_000; @@ -138,7 +137,7 @@ async function startBin( return { port, cleanup: async () => { - process.kill(proc.pid); + process.kill(proc.pid, 9); await retryUntil(async () => { try { process.kill(proc.pid, 0); @@ -251,32 +250,30 @@ describe("functions.yaml", () => { } }).timeout(TIMEOUT_L); - if (semver.gt(process.versions.node, "13.2.0")) { - describe("esm", () => { - const testcases: Testcase[] = [ - { - name: "basic", - modulePath: "./scripts/bin-test/sources/esm", - expected: BASE_STACK, - }, - { - name: "with main", + describe("esm", () => { + const testcases: Testcase[] = [ + { + name: "basic", + modulePath: "./scripts/bin-test/sources/esm", + expected: BASE_STACK, + }, + { + name: "with main", - modulePath: "./scripts/bin-test/sources/esm-main", - expected: BASE_STACK, - }, - { - name: "with .m extension", - modulePath: "./scripts/bin-test/sources/esm-ext", - expected: BASE_STACK, - }, - ]; + modulePath: "./scripts/bin-test/sources/esm-main", + expected: BASE_STACK, + }, + { + name: "with .m extension", + modulePath: "./scripts/bin-test/sources/esm-ext", + expected: BASE_STACK, + }, + ]; - for (const tc of testcases) { - describe(tc.name, () => { - runTests(tc); - }); - } - }).timeout(TIMEOUT_L); - } + for (const tc of testcases) { + describe(tc.name, () => { + runTests(tc); + }); + } + }).timeout(TIMEOUT_L); }).timeout(TIMEOUT_XL); From 608744503247c027010ebef24e4aa236a0ee097a Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Wed, 1 Nov 2023 14:05:01 -0700 Subject: [PATCH 4/5] Try using different syntax to set timeout. --- scripts/bin-test/test.ts | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/scripts/bin-test/test.ts b/scripts/bin-test/test.ts index 9992ed28e..efeafab9e 100644 --- a/scripts/bin-test/test.ts +++ b/scripts/bin-test/test.ts @@ -9,6 +9,7 @@ import * as portfinder from "portfinder"; const TIMEOUT_XL = 20_000; const TIMEOUT_L = 10_000; +const TIMEOUT_M = 5_000; const TIMEOUT_S = 1_000; const DEFAULT_OPTIONS = { @@ -151,7 +152,9 @@ async function startBin( }; } -describe("functions.yaml", () => { +describe("functions.yaml", function () { + this.timeout(TIMEOUT_XL); + function runTests(tc: Testcase) { let port: number; let cleanup: () => Promise; @@ -166,7 +169,8 @@ describe("functions.yaml", () => { await cleanup?.(); }); - it("functions.yaml returns expected Manifest", async () => { + it("functions.yaml returns expected Manifest", async function () { + this.timeout(TIMEOUT_M); const res = await fetch(`http://localhost:${port}/__/functions.yaml`); const text = await res.text(); let parsed: any; @@ -179,7 +183,8 @@ describe("functions.yaml", () => { }); } - describe("commonjs", () => { + describe("commonjs", function () { + this.timeout(TIMEOUT_L); const testcases: Testcase[] = [ { name: "basic", @@ -248,9 +253,10 @@ describe("functions.yaml", () => { runTests(tc); }); } - }).timeout(TIMEOUT_L); + }); - describe("esm", () => { + describe("esm", function () { + this.timeout(TIMEOUT_L); const testcases: Testcase[] = [ { name: "basic", @@ -275,5 +281,5 @@ describe("functions.yaml", () => { runTests(tc); }); } - }).timeout(TIMEOUT_L); -}).timeout(TIMEOUT_XL); + }); +}); From ee634319b622208852f272649ec015ac9f95c034 Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Wed, 1 Nov 2023 14:13:43 -0700 Subject: [PATCH 5/5] Disable eslint. --- scripts/bin-test/test.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/bin-test/test.ts b/scripts/bin-test/test.ts index efeafab9e..efc5a5127 100644 --- a/scripts/bin-test/test.ts +++ b/scripts/bin-test/test.ts @@ -153,6 +153,7 @@ async function startBin( } describe("functions.yaml", function () { + // eslint-disable-next-line @typescript-eslint/no-invalid-this this.timeout(TIMEOUT_XL); function runTests(tc: Testcase) { @@ -170,7 +171,9 @@ describe("functions.yaml", function () { }); it("functions.yaml returns expected Manifest", async function () { + // eslint-disable-next-line @typescript-eslint/no-invalid-this this.timeout(TIMEOUT_M); + const res = await fetch(`http://localhost:${port}/__/functions.yaml`); const text = await res.text(); let parsed: any; @@ -184,7 +187,9 @@ describe("functions.yaml", function () { } describe("commonjs", function () { + // eslint-disable-next-line @typescript-eslint/no-invalid-this this.timeout(TIMEOUT_L); + const testcases: Testcase[] = [ { name: "basic", @@ -256,7 +261,9 @@ describe("functions.yaml", function () { }); describe("esm", function () { + // eslint-disable-next-line @typescript-eslint/no-invalid-this this.timeout(TIMEOUT_L); + const testcases: Testcase[] = [ { name: "basic",