Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Run Tests with Coverage

on:
pull_request:
push:
branches: [ main ]

jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write

steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm

- run: npm ci

- name: Run tests with coverage
run: npx vitest run --coverage

- name: Report coverage on PR
uses: davelosert/vitest-coverage-report-action@v2
if: github.event_name == 'pull_request'
with:
json-summary-path: coverage/coverage-summary.json
json-final-path: coverage/coverage-final.json

- name: Upload coverage artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage/
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Prime Factorization App
[![Prime Factorization (Built, Lint and Test)](https://github.com/DoctorLai/prime-factorization/actions/workflows/ci.yaml/badge.svg?branch=main)](https://github.com/DoctorLai/prime-factorization/actions/workflows/ci.yaml)
[![Prime Factorization (Built, Lint and Test)](https://github.com/DoctorLai/prime-factorization/actions/workflows/ci.yaml/badge.svg?branch=main)](https://github.com/DoctorLai/prime-factorization/actions/workflows/ci.yaml) [![Run Tests with Coverage](https://github.com/DoctorLai/prime-factorization/actions/workflows/coverage.yaml/badge.svg)](https://github.com/DoctorLai/prime-factorization/actions/workflows/coverage.yaml)

A simple React web app that computes the prime factorization of any positive integer and displays it in a clean, styled format. It also lists all prime numbers up to 2000 for quick reference. The project supports dark mode, is fully tested with Vitest, and can be easily deployed to GitHub Pages.

Expand Down Expand Up @@ -42,10 +42,16 @@ npm run dev

4. Run tests:
```bash
## or simply: npm test
npm run test
```

5. Format code:
5. Test coverage:
```bash
npx vitest run --coverage
```

6. Format code:
Run: <code>npm run format</code> to check code formatting and;
Run: <code>npm run format:fix</code> to fix formatting automatically.

Expand Down
Loading