From 1a865f3f99b26ef584918612de135915650835e9 Mon Sep 17 00:00:00 2001 From: Claude Code Date: Mon, 6 Oct 2025 19:56:49 +0000 Subject: [PATCH 1/3] Add Codecov integration for coverage reporting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Configure GitHub Actions to generate and upload coverage reports - Add codecov.yml with 85% project target and 80% patch target - Add Codecov badge to README - Upload coverage only on Node.js 20.x to avoid duplicates - Configure coverage thresholds: 85% for project, 80% for patches - Add PR coverage diff comments via Codecov 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .github/workflows/websocket-tests.yml | 14 ++++++++++ README.md | 2 ++ codecov.yml | 39 +++++++++++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 codecov.yml diff --git a/.github/workflows/websocket-tests.yml b/.github/workflows/websocket-tests.yml index 5893fc32..8a619d6c 100644 --- a/.github/workflows/websocket-tests.yml +++ b/.github/workflows/websocket-tests.yml @@ -29,6 +29,20 @@ jobs: - name: Run unit tests run: pnpm run test + - name: Run unit tests with coverage + if: matrix.node-version == '20.x' + run: pnpm run test:coverage + + - name: Upload coverage to Codecov + if: matrix.node-version == '20.x' + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./coverage/coverage-final.json + flags: unittests + name: codecov-umbrella + fail_ci_if_error: false + - name: Pull Autobahn Test Suite Docker image run: docker pull crossbario/autobahn-testsuite diff --git a/README.md b/README.md index 263647f9..54006ea2 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,8 @@ WebSocket Client & Server Implementation for Node [ ![Codeship Status for theturtle32/WebSocket-Node](https://codeship.com/projects/70458270-8ee7-0132-7756-0a0cf4fe8e66/status?branch=master)](https://codeship.com/projects/61106) +[![codecov](https://codecov.io/gh/theturtle32/WebSocket-Node/branch/v2/graph/badge.svg)](https://codecov.io/gh/theturtle32/WebSocket-Node) + Overview -------- This is a (mostly) pure JavaScript implementation of the WebSocket protocol versions 8 and 13 for Node. There are some example client and server applications that implement various interoperability testing protocols in the "test/scripts" folder. diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 00000000..0e34a115 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,39 @@ +codecov: + require_ci_to_pass: yes + notify: + wait_for_ci: yes + +coverage: + precision: 2 + round: down + range: "70...100" + + status: + project: + default: + target: 85% + threshold: 1% + if_ci_failed: error + + patch: + default: + target: 80% + threshold: 2% + if_ci_failed: error + +comment: + layout: "reach,diff,flags,tree" + behavior: default + require_changes: no + require_base: no + require_head: yes + +ignore: + - "test/**" + - "examples/**" + - "bench/**" + - "docs/**" + - "scripts/**" + - "**/*.test.mjs" + - "**/*.test.js" + - "**/*.bench.mjs" From 9e61f4b74a133170b8aecdddfb58f72dff006554 Mon Sep 17 00:00:00 2001 From: Claude Code Date: Mon, 6 Oct 2025 19:59:59 +0000 Subject: [PATCH 2/3] Address Gemini review comments and update to codecov-action@v5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Updated Codecov badge alt text to "code coverage" for accessibility - Set require_changes: yes to reduce PR comment noise - Added lib/version.js to ignore list for consistency with vitest config - Updated codecov-action from v4 to v5 per Codecov documentation - Simplified codecov-action configuration (v5 auto-detects coverage files) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .github/workflows/websocket-tests.yml | 6 +----- README.md | 2 +- codecov.yml | 3 ++- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/websocket-tests.yml b/.github/workflows/websocket-tests.yml index 8a619d6c..8084508a 100644 --- a/.github/workflows/websocket-tests.yml +++ b/.github/workflows/websocket-tests.yml @@ -35,13 +35,9 @@ jobs: - name: Upload coverage to Codecov if: matrix.node-version == '20.x' - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }} - files: ./coverage/coverage-final.json - flags: unittests - name: codecov-umbrella - fail_ci_if_error: false - name: Pull Autobahn Test Suite Docker image run: docker pull crossbario/autobahn-testsuite diff --git a/README.md b/README.md index 54006ea2..4887af60 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ WebSocket Client & Server Implementation for Node [ ![Codeship Status for theturtle32/WebSocket-Node](https://codeship.com/projects/70458270-8ee7-0132-7756-0a0cf4fe8e66/status?branch=master)](https://codeship.com/projects/61106) -[![codecov](https://codecov.io/gh/theturtle32/WebSocket-Node/branch/v2/graph/badge.svg)](https://codecov.io/gh/theturtle32/WebSocket-Node) +[![code coverage](https://codecov.io/gh/theturtle32/WebSocket-Node/branch/v2/graph/badge.svg)](https://codecov.io/gh/theturtle32/WebSocket-Node) Overview -------- diff --git a/codecov.yml b/codecov.yml index 0e34a115..bf4abf10 100644 --- a/codecov.yml +++ b/codecov.yml @@ -24,7 +24,7 @@ coverage: comment: layout: "reach,diff,flags,tree" behavior: default - require_changes: no + require_changes: yes require_base: no require_head: yes @@ -34,6 +34,7 @@ ignore: - "bench/**" - "docs/**" - "scripts/**" + - "lib/version.js" - "**/*.test.mjs" - "**/*.test.js" - "**/*.bench.mjs" From 66bbafb2fc9f099be0af51349088de41aeba536f Mon Sep 17 00:00:00 2001 From: Claude Code Date: Mon, 6 Oct 2025 20:03:56 +0000 Subject: [PATCH 3/3] Run coverage only on Node.js 22.x to avoid duplication MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Node.js 18.x and 20.x: Run tests without coverage - Node.js 22.x: Run tests with coverage and upload to Codecov - Avoids running tests twice on the same version 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .github/workflows/websocket-tests.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/websocket-tests.yml b/.github/workflows/websocket-tests.yml index 8084508a..0c141b38 100644 --- a/.github/workflows/websocket-tests.yml +++ b/.github/workflows/websocket-tests.yml @@ -27,14 +27,15 @@ jobs: run: pnpm run lint - name: Run unit tests + if: matrix.node-version != '22.x' run: pnpm run test - name: Run unit tests with coverage - if: matrix.node-version == '20.x' + if: matrix.node-version == '22.x' run: pnpm run test:coverage - name: Upload coverage to Codecov - if: matrix.node-version == '20.x' + if: matrix.node-version == '22.x' uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }}