From b1b6581b29d475645afc084c160c96374797c042 Mon Sep 17 00:00:00 2001 From: Sylvain Lesage Date: Mon, 9 Feb 2026 16:02:12 +0100 Subject: [PATCH 1/5] report coverage + update badges --- .github/workflows/ci.yml | 12 ++++++++++++ README.md | 6 +++--- vitest.config.ts | 7 +++++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5d8f940..c6268a8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,3 +55,15 @@ jobs: run: npx playwright install --with-deps - name: Run tests run: npm run test:browser + + test-coverage: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: npm ci + - run: npm run test:coverage + - name: "Report Coverage" + # Set if: always() to also generate the report if tests are failing + # Only works if you set `reportOnFailure: true` in your vite config as specified above + if: always() + uses: davelosert/vitest-coverage-report-action@v2 diff --git a/README.md b/README.md index 16773b1..3b6c687 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,9 @@ [![npm](https://img.shields.io/npm/v/cosovo)](https://www.npmjs.com/package/cosovo) [![size](https://img.shields.io/bundlejs/size/cosovo)](https://www.npmjs.com/package/cosovo) [![workflow status](https://github.com/severo/cosovo/actions/workflows/ci.yml/badge.svg)](https://github.com/severo/cosovo/actions) -[![mit license](https://img.shields.io/badge/License-MIT-orange.svg)](https://opensource.org/licenses/MIT) -![coverage](https://img.shields.io/badge/Coverage-100-darkred) -[![dependencies](https://img.shields.io/badge/Dependencies-0-blueviolet)](https://www.npmjs.com/package/cosovo?activeTab=dependencies) +[![mit license](https://img.shields.io/badge/license-MIT-orange.svg)](https://opensource.org/licenses/MIT) +![coverage](https://img.shields.io/badge/coverage-100%25-brightgreen) +[![dependencies](https://img.shields.io/badge/dependencies-0-blue)](https://www.npmjs.com/package/cosovo?activeTab=dependencies) Fetch and parse ranges of CSV file. diff --git a/vitest.config.ts b/vitest.config.ts index c54701f..ae9ed97 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -9,6 +9,13 @@ declare module 'vitest' { export default defineConfig({ test: { + coverage: { + // See https://github.com/marketplace/actions/vitest-coverage-report + // you can include other reporters, but 'json-summary' is required, json is recommended + reporter: ['text', 'json-summary', 'json'], + // If you want a coverage reports even if your tests are failing, include the reportOnFailure option + reportOnFailure: true, + }, projects: [ { test: { From ffc92e18c3c658c70f2507c972b3b3be35789a93 Mon Sep 17 00:00:00 2001 From: Sylvain Lesage Date: Mon, 9 Feb 2026 16:03:55 +0100 Subject: [PATCH 2/5] update actions --- .github/workflows/ci.yml | 16 ++++++++-------- .github/workflows/docs.yml | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c6268a8..d17e7ac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,35 +9,35 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - run: npm ci - run: npm run build eslint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - run: npm ci - run: npm run lint:eslint lint-types: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - run: npm ci - run: npm run lint:types lint-docs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - run: npm ci - run: npm run lint:docs test-node: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - run: npm ci - run: npm run test:node @@ -45,8 +45,8 @@ jobs: timeout-minutes: 60 runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 + - uses: actions/checkout@v5 + - uses: actions/setup-node@v6 with: node-version: lts/* - name: Install dependencies @@ -59,7 +59,7 @@ jobs: test-coverage: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - run: npm ci - run: npm run test:coverage - name: "Report Coverage" diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index da3b648..86f7d49 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -29,10 +29,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Setup Node - uses: actions/setup-node@v3 + uses: actions/setup-node@v6 with: node-version: 25 cache: "npm" From 22f48b558c87c2697bbb2a0d97bd22aca28b2dc9 Mon Sep 17 00:00:00 2001 From: Sylvain Lesage Date: Mon, 9 Feb 2026 16:05:18 +0100 Subject: [PATCH 3/5] fix script name --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d17e7ac..8868b44 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,7 +61,7 @@ jobs: steps: - uses: actions/checkout@v5 - run: npm ci - - run: npm run test:coverage + - run: npm run coverage - name: "Report Coverage" # Set if: always() to also generate the report if tests are failing # Only works if you set `reportOnFailure: true` in your vite config as specified above From d24eb4ce9d45027dc5d2b04eff5d16348cc998d3 Mon Sep 17 00:00:00 2001 From: Sylvain Lesage Date: Mon, 9 Feb 2026 16:07:59 +0100 Subject: [PATCH 4/5] add permissions --- .github/workflows/ci.yml | 4 ++++ .github/workflows/docs.yml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8868b44..03d0f00 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,10 @@ on: branches: - main +permissions: + contents: read + pull-requests: write + jobs: build: runs-on: ubuntu-latest diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 86f7d49..84bf8f6 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -47,7 +47,7 @@ jobs: uses: actions/configure-pages@v5 - name: Upload artifact - uses: actions/upload-pages-artifact@v3 + uses: actions/upload-pages-artifact@v4 with: # Upload entire repository path: "./docs" From bfa542092371de026768d7ffc776f3bf08679853 Mon Sep 17 00:00:00 2001 From: Sylvain Lesage Date: Mon, 9 Feb 2026 16:09:39 +0100 Subject: [PATCH 5/5] add a lin to verify the coverage --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3b6c687..0b69ffd 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![size](https://img.shields.io/bundlejs/size/cosovo)](https://www.npmjs.com/package/cosovo) [![workflow status](https://github.com/severo/cosovo/actions/workflows/ci.yml/badge.svg)](https://github.com/severo/cosovo/actions) [![mit license](https://img.shields.io/badge/license-MIT-orange.svg)](https://opensource.org/licenses/MIT) -![coverage](https://img.shields.io/badge/coverage-100%25-brightgreen) +[![coverage](https://img.shields.io/badge/coverage-100%25-brightgreen)](https://github.com/severo/cosovo/actions/workflows/ci.yml) [![dependencies](https://img.shields.io/badge/dependencies-0-blue)](https://www.npmjs.com/package/cosovo?activeTab=dependencies) Fetch and parse ranges of CSV file.