Skip to content

Commit f3122e8

Browse files
authored
feat: add testing capabilities for Firebase functions (#454)
* feat: add testing capabilities for Firebase functions - Updated package.json to include vitest and supertest for testing. - Created a GitHub Actions workflow for running tests on push and pull request events. - Added a sample test for the helloWorld function to verify it returns a 200 status code and the expected response. * feat: add Firebase Functions testing workflow with Node.js support
1 parent 37ac08b commit f3122e8

File tree

5 files changed

+8688
-6690
lines changed

5 files changed

+8688
-6690
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Firebase Functions Tests
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
paths:
7+
- "openci-runner/firebase/functions/**"
8+
- ".github/workflows/firebase-functions-tests.yml"
9+
pull_request:
10+
branches: [main, develop]
11+
paths:
12+
- "openci-runner/firebase/functions/**"
13+
- ".github/workflows/firebase-functions-tests.yml"
14+
15+
jobs:
16+
test:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
strategy:
21+
matrix:
22+
node-version: [20, 22]
23+
defaults:
24+
run:
25+
working-directory: openci-runner/firebase/functions
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v4
29+
30+
- name: Set up Node.js
31+
uses: actions/setup-node@v4
32+
with:
33+
node-version: ${{ matrix.node-version }}
34+
35+
- name: Install dependencies
36+
run: npm ci
37+
38+
- name: Run tests
39+
run: npm test

.github/workflows/github-apps-tests.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,23 @@ name: GitHub Apps Tests
33
on:
44
push:
55
branches: [main, develop]
6+
paths:
7+
- "openci-runner/github-apps/**"
8+
- ".github/workflows/github-apps-tests.yml"
69
pull_request:
710
branches: [main, develop]
11+
paths:
12+
- "openci-runner/github-apps/**"
13+
- ".github/workflows/github-apps-tests.yml"
814

915
jobs:
1016
test:
1117
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
strategy:
21+
matrix:
22+
node-version: [20, 22]
1223
defaults:
1324
run:
1425
working-directory: openci-runner/github-apps
@@ -19,7 +30,7 @@ jobs:
1930
- name: Set up Node.js
2031
uses: actions/setup-node@v4
2132
with:
22-
node-version: "22"
33+
node-version: ${{ matrix.node-version }}
2334

2435
- name: Install dependencies
2536
run: npm ci

0 commit comments

Comments
 (0)