diff --git a/.github/workflows/websocket-tests.yml b/.github/workflows/websocket-tests.yml index 5893fc32..0c141b38 100644 --- a/.github/workflows/websocket-tests.yml +++ b/.github/workflows/websocket-tests.yml @@ -27,8 +27,19 @@ 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 == '22.x' + run: pnpm run test:coverage + + - name: Upload coverage to Codecov + if: matrix.node-version == '22.x' + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} + - name: Pull Autobahn Test Suite Docker image run: docker pull crossbario/autobahn-testsuite diff --git a/README.md b/README.md index 263647f9..4887af60 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) +[![code coverage](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..bf4abf10 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,40 @@ +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: yes + require_base: no + require_head: yes + +ignore: + - "test/**" + - "examples/**" + - "bench/**" + - "docs/**" + - "scripts/**" + - "lib/version.js" + - "**/*.test.mjs" + - "**/*.test.js" + - "**/*.bench.mjs"