-
Notifications
You must be signed in to change notification settings - Fork 1
45 lines (37 loc) · 1.2 KB
/
run-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
name: Run Jest Tests
# Run this action when a pull request is opened or updated
on:
pull_request:
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest # The environment to run the action
strategy:
matrix:
node-version: [18.x] # Run the tests on Node.js version 18
steps:
# Checkout the repository
- name: Checkout repository
uses: actions/checkout@v3
# Set up Node.js
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
# Install dependencies
- name: Install dependencies
run: yarn install
# Run Jest tests
- name: Run Jest tests
run: yarn test --ci --coverage
# Upload Jest test results
- name: Upload Jest test results
if: always()
uses: actions/upload-artifact@v3
with:
name: jest-results
path: coverage # Adjust based on where your test results are stored
# Report the status of the test results
- name: Display Test Results in PR
if: failure() # This step runs if the tests fail
run: echo "Jest tests failed! Check the details in the Actions tab."