Running FE jest tests on github.

This commit is contained in:
Roland 2025-12-06 07:53:01 -07:00
parent a3b16f8a47
commit e1a6adfde3
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
2 changed files with 41 additions and 22 deletions

View file

@ -146,27 +146,7 @@ jobs:
- run:
name: Stop React App
command: pkill -f npm
jest-tests:
docker:
- image: cimg/node:20.13
resource_class: medium
steps:
- checkout
- restore_cache:
key: app-{{ checksum "app/package-lock.json" }}
- run:
name: Install Dependencies
command: cd app && npm install --legacy-peer-deps
- save_cache:
key: app-{{ checksum "app/package-lock.json" }}
paths:
- ./app/node_modules
- run:
name: Run Jest Tests
command: cd app && CI=true npm test -- --watchAll=false --coverage --coverageReporters=text --coverageReporters=lcov
- store_artifacts:
path: app/coverage
destination: coverage-report
# Jest tests moved to GitHub Actions (.github/workflows/jest-tests.yml)
cypress-e2e-tests:
docker:
- image: cimg/node:20.18-browsers
@ -217,5 +197,5 @@ workflows:
wrolpi-app-test:
jobs:
- react-app-start
- jest-tests
# jest-tests moved to GitHub Actions
- cypress-e2e-tests

39
.github/workflows/jest-tests.yml vendored Normal file
View file

@ -0,0 +1,39 @@
name: Jest Tests
on:
push:
branches: [master, feature/*]
pull_request:
branches: [master]
jobs:
jest-tests:
runs-on: ubuntu-latest
defaults:
run:
working-directory: app
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: app/package-lock.json
- name: Install dependencies
run: npm install --legacy-peer-deps
- name: Run Jest tests
run: CI=true npm test -- --watchAll=false --coverage --coverageReporters=text --coverageReporters=lcov
- name: Upload coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: app/coverage
retention-days: 30