Skip to content

Commit 13676c9

Browse files
authored
Merge pull request #255 from ClickHouse/coverage-reports
Coverage reports for Node.js + Common packages
2 parents b416895 + 41a5889 commit 13676c9

File tree

8 files changed

+88
-1
lines changed

8 files changed

+88
-1
lines changed

.github/workflows/tests.yml

+49
Original file line numberDiff line numberDiff line change
@@ -291,3 +291,52 @@ jobs:
291291
CLICKHOUSE_CLOUD_PASSWORD: ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_PASSWORD_SMT }}
292292
run: |
293293
npm run test:web:integration:cloud_smt
294+
295+
# With unit + integration + TLS tests + coverage + SonarCloud report, after the rest of the tests.
296+
# Needs all integration tests on all environments to pass.
297+
# Should use only the current LTS version of Node.js.
298+
node-all-tests-with-coverage-and-sonar:
299+
needs:
300+
[
301+
'node-integration-tests-local-single-node',
302+
'node-integration-tests-local-cluster',
303+
'node-integration-tests-cloud',
304+
'node-integration-tests-cloud-smt',
305+
'web-all-tests-local-single-node',
306+
'web-integration-tests-local-cluster',
307+
'web-integration-tests-cloud',
308+
'web-integration-tests-cloud-smt',
309+
]
310+
runs-on: ubuntu-latest
311+
312+
steps:
313+
- uses: actions/checkout@main
314+
315+
- name: Start ClickHouse (version - ${{ matrix.clickhouse }}) in Docker
316+
uses: isbang/[email protected]
317+
with:
318+
compose-file: 'docker-compose.yml'
319+
down-flags: '--volumes'
320+
321+
- name: Setup NodeJS 20
322+
uses: actions/setup-node@v4
323+
with:
324+
node-version: 20
325+
326+
- name: Install dependencies
327+
run: |
328+
npm install
329+
330+
- name: Add ClickHouse TLS instance to /etc/hosts
331+
run: |
332+
sudo echo "127.0.0.1 server.clickhouseconnect.test" | sudo tee -a /etc/hosts
333+
334+
- name: Run unit + integration + TLS tests with coverage
335+
run: |
336+
npm run test:node:coverage
337+
338+
- name: SonarCloud Scan
339+
uses: SonarSource/sonarcloud-github-action@master
340+
env:
341+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
342+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ benchmarks/leaks/input
77
.npmrc
88
webpack
99
out
10+
coverage
11+
coverage-web
12+
.nyc_output

.nycrc.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"extends": "@istanbuljs/nyc-config-typescript",
3+
"all": true,
4+
"reporter": ["lcov", "text"],
5+
"include": [
6+
"packages/client-common/src/**/*.ts",
7+
"packages/client-node/src/**/*.ts"
8+
],
9+
"exclude": [
10+
"packages/**/version.ts",
11+
"packages/client-common/src/clickhouse_types.ts",
12+
"packages/client-common/src/connection.ts",
13+
"packages/client-common/src/result.ts",
14+
"packages/client-common/src/ts_utils.ts"
15+
]
16+
}

.scripts/jasmine.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#!/bin/bash
2-
ts-node -r tsconfig-paths/register --transpileOnly --project=tsconfig.dev.json node_modules/jasmine/bin/jasmine --config=$1
2+
ts-node -r tsconfig-paths/register -r source-map-support/register --transpileOnly --project=tsconfig.dev.json node_modules/jasmine/bin/jasmine --config=$1

README.md

+12
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,21 @@
44
</p>
55
<br/>
66
<p align="center">
7+
<a href="https://www.npmjs.com/package/@clickhouse/client">
8+
<img alt="NPM Version" src="https://img.shields.io/npm/v/%40clickhouse%2Fclient?color=%233178C6&logo=npm">
9+
</a>
10+
11+
<a href="https://www.npmjs.com/package/@clickhouse/client">
12+
<img alt="NPM Downloads" src="https://img.shields.io/npm/dw/%40clickhouse%2Fclient?color=%233178C6&logo=npm">
13+
</a>
14+
15+
<img alt="NPM Type Definitions" src="https://img.shields.io/npm/types/%40clickhouse%2Fclient?color=%233178C6&logo=typescript">
16+
717
<a href="https://github.com/ClickHouse/clickhouse-js/actions/workflows/tests.yml">
818
<img src="https://github.com/ClickHouse/clickhouse-js/actions/workflows/tests.yml/badge.svg?branch=main">
919
</a>
20+
21+
<img src="https://sonarcloud.io/api/project_badges/measure?project=ClickHouse_clickhouse-js&metric=alert_status">
1022
</p>
1123

1224
## About

package.json

+4
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"test:node:integration:local_cluster": "CLICKHOUSE_TEST_ENVIRONMENT=local_cluster npm run test:node:integration",
3636
"test:node:integration:cloud": "CLICKHOUSE_TEST_ENVIRONMENT=cloud npm run test:node:integration",
3737
"test:node:integration:cloud_smt": "CLICKHOUSE_TEST_ENVIRONMENT=cloud_smt npm run test:node:integration",
38+
"test:node:coverage": "nyc npm run test",
3839
"test:web": "karma start karma.config.cjs",
3940
"test:web:integration:local_cluster": "CLICKHOUSE_TEST_ENVIRONMENT=local_cluster npm run test:web",
4041
"test:web:integration:cloud": "CLICKHOUSE_TEST_ENVIRONMENT=cloud npm run test:web",
@@ -43,6 +44,7 @@
4344
},
4445
"devDependencies": {
4546
"@faker-js/faker": "^8.4.1",
47+
"@istanbuljs/nyc-config-typescript": "^1.0.2",
4648
"@types/jasmine": "^5.1.4",
4749
"@types/node": "^20.11.30",
4850
"@types/sinon": "^17.0.3",
@@ -68,9 +70,11 @@
6870
"karma-typescript": "^5.5.4",
6971
"karma-webpack": "^5.0.1",
7072
"lint-staged": "^15.2.2",
73+
"nyc": "^15.1.0",
7174
"parquet-wasm": "0.6.0-beta.2",
7275
"prettier": "3.2.5",
7376
"sinon": "^17.0.1",
77+
"source-map-support": "^0.5.21",
7478
"split2": "^4.2.0",
7579
"terser-webpack-plugin": "^5.3.10",
7680
"ts-jest": "^29.1.2",

packages/client-common/src/utils/string.ts

Whitespace-only changes.

sonar-project.properties

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
sonar.organization=clickhouse-java
2+
sonar.projectKey=ClickHouse_clickhouse-js
3+
sonar.javascript.lcov.reportPaths=coverage/lcov.info

0 commit comments

Comments
 (0)