Skip to content

Commit 93c47e3

Browse files
authored
Update node versions used in GitHub actions (#1479)
Also bump/enable test timeouts to successfully run in node 18/20 environments.
1 parent 3e7a4b7 commit 93c47e3

File tree

4 files changed

+49
-42
lines changed

4 files changed

+49
-42
lines changed

.github/workflows/postmerge.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
- uses: actions/checkout@v3
3535
- uses: actions/setup-node@v3
3636
with:
37-
node-version: 16
37+
node-version: 18
3838

3939
- uses: google-github-actions/auth@v0
4040
with:

.github/workflows/test.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@ jobs:
3030
strategy:
3131
matrix:
3232
node-version:
33-
- 14.x
34-
- 16.x
3533
- 18.x
34+
- 20.x
3635
steps:
3736
- uses: actions/checkout@v1
3837
- uses: actions/setup-node@v1
@@ -51,9 +50,8 @@ jobs:
5150
strategy:
5251
matrix:
5352
node-version:
54-
- 14.x
55-
- 16.x
5653
- 18.x
54+
- 20.x
5755
steps:
5856
- uses: actions/checkout@v1
5957
- uses: actions/setup-node@v1

scripts/bin-test/run.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ for f in scripts/bin-test/sources/*; do
1212
fi
1313
done
1414

15-
## DEBUG
16-
ls -la scripts/bin-test/sources/commonjs/node_modules
15+
# Make sure firebase-functions binary is executable
16+
chmod +x ./lib/bin/firebase-functions.js
1717

1818
mocha \
1919
--file ./scripts/bin-test/mocha-setup.ts \

scripts/bin-test/test.ts

Lines changed: 44 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { expect } from "chai";
66
import * as yaml from "js-yaml";
77
import fetch from "node-fetch";
88
import * as portfinder from "portfinder";
9-
import * as semver from "semver";
109

1110
const TIMEOUT_XL = 20_000;
1211
const TIMEOUT_L = 10_000;
@@ -124,7 +123,7 @@ async function startBin(
124123
throw e;
125124
}
126125
return true;
127-
}, TIMEOUT_M);
126+
}, TIMEOUT_L);
128127

129128
if (debug) {
130129
proc.stdout?.on("data", (data: unknown) => {
@@ -139,7 +138,7 @@ async function startBin(
139138
return {
140139
port,
141140
cleanup: async () => {
142-
process.kill(proc.pid);
141+
process.kill(proc.pid, 9);
143142
await retryUntil(async () => {
144143
try {
145144
process.kill(proc.pid, 0);
@@ -148,12 +147,15 @@ async function startBin(
148147
return Promise.resolve(true);
149148
}
150149
return Promise.resolve(false);
151-
}, TIMEOUT_M);
150+
}, TIMEOUT_L);
152151
},
153152
};
154153
}
155154

156-
describe("functions.yaml", () => {
155+
describe("functions.yaml", function () {
156+
// eslint-disable-next-line @typescript-eslint/no-invalid-this
157+
this.timeout(TIMEOUT_XL);
158+
157159
function runTests(tc: Testcase) {
158160
let port: number;
159161
let cleanup: () => Promise<void>;
@@ -168,7 +170,10 @@ describe("functions.yaml", () => {
168170
await cleanup?.();
169171
});
170172

171-
it("functions.yaml returns expected Manifest", async () => {
173+
it("functions.yaml returns expected Manifest", async function () {
174+
// eslint-disable-next-line @typescript-eslint/no-invalid-this
175+
this.timeout(TIMEOUT_M);
176+
172177
const res = await fetch(`http://localhost:${port}/__/functions.yaml`);
173178
const text = await res.text();
174179
let parsed: any;
@@ -181,7 +186,10 @@ describe("functions.yaml", () => {
181186
});
182187
}
183188

184-
describe("commonjs", () => {
189+
describe("commonjs", function () {
190+
// eslint-disable-next-line @typescript-eslint/no-invalid-this
191+
this.timeout(TIMEOUT_L);
192+
185193
const testcases: Testcase[] = [
186194
{
187195
name: "basic",
@@ -250,34 +258,35 @@ describe("functions.yaml", () => {
250258
runTests(tc);
251259
});
252260
}
253-
}).timeout(TIMEOUT_L);
261+
});
254262

255-
if (semver.gt(process.versions.node, "13.2.0")) {
256-
describe("esm", () => {
257-
const testcases: Testcase[] = [
258-
{
259-
name: "basic",
260-
modulePath: "./scripts/bin-test/sources/esm",
261-
expected: BASE_STACK,
262-
},
263-
{
264-
name: "with main",
263+
describe("esm", function () {
264+
// eslint-disable-next-line @typescript-eslint/no-invalid-this
265+
this.timeout(TIMEOUT_L);
265266

266-
modulePath: "./scripts/bin-test/sources/esm-main",
267-
expected: BASE_STACK,
268-
},
269-
{
270-
name: "with .m extension",
271-
modulePath: "./scripts/bin-test/sources/esm-ext",
272-
expected: BASE_STACK,
273-
},
274-
];
267+
const testcases: Testcase[] = [
268+
{
269+
name: "basic",
270+
modulePath: "./scripts/bin-test/sources/esm",
271+
expected: BASE_STACK,
272+
},
273+
{
274+
name: "with main",
275275

276-
for (const tc of testcases) {
277-
describe(tc.name, () => {
278-
runTests(tc);
279-
});
280-
}
281-
}).timeout(TIMEOUT_L);
282-
}
283-
}).timeout(TIMEOUT_XL);
276+
modulePath: "./scripts/bin-test/sources/esm-main",
277+
expected: BASE_STACK,
278+
},
279+
{
280+
name: "with .m extension",
281+
modulePath: "./scripts/bin-test/sources/esm-ext",
282+
expected: BASE_STACK,
283+
},
284+
];
285+
286+
for (const tc of testcases) {
287+
describe(tc.name, () => {
288+
runTests(tc);
289+
});
290+
}
291+
});
292+
});

0 commit comments

Comments
 (0)