1.23 beta7 - #904
Conversation
…re dist into CI (#899) ## Summary Adds a `TEST_TARGET` env var (`src` | `dist`), **orthogonal to `TEST_MODE`**, that selects which build of the client the `@clickhouse/*` specifiers resolve to: - **`src`** (default): the workspace TypeScript sources — a fast, build-free inner loop for local dev and coding agents. - **`dist`**: the compiled packages, exactly as a published consumer sees them (run `npm run build` first). This generalizes the previously hard-wired `oss-dependents` dist alias into a reusable axis, so any collection can run against either build. New convenience scripts: `test:node:integration:dist` and `test:web:integration:dist` (both build first). To make `dist` runs faithful, the integration specs and shared test utilities now import client code **only through the published package names** (`@clickhouse/client`, `@clickhouse/client-web`, `@clickhouse/client-common`) instead of reaching into `../../src`: - `getAsText` → test-local stream helpers (kept off the public API surface; comments note they're simplified stand-ins). - `drainStreamInternal` → the public `drainStream`. - The stub-based, white-box `node_client` header spec (no server; depends on connection internals via `http_stubs`) moved to `unit/` as `node_client_headers.test.ts` — a stubbed-transport test is a unit test. ### Single-bundle resolution in `dist` Running against `dist` surfaced a real topology issue: the clients **bundle the (deprecated) common sources**, so importing from a separate `@clickhouse/client-common` yields a *second* `ClickHouseError` / `SettingsMap` / `TupleParam` class, breaking the client's internal `instanceof` checks on test-provided values. In `dist` mode all client specifiers now resolve to the single client bundle — which is what a real consumer gets. The web config additionally pre-bundles the CJS web dist via `optimizeDeps`. ### CI integration - **`tests-dist.yml`** — a lean standalone workflow (mirroring `tests-oss-dependents.yml`) that builds and runs the node + web integration suites with `TEST_TARGET=dist` on stable ClickHouse + Node 24. Guards the built/bundle surface; behavioural coverage across Node/ClickHouse versions stays in the `node`/`web` workflows, so this stays minimal. - **`publish.yml` `e2e` job** — now starts a single-node ClickHouse and runs a new `tests/e2e/install/src/integration.ts` that exercises the freshly *published* `@clickhouse/client` end-to-end (create/insert/select, stream, bad-query → `ClickHouseError`). Previously this job only checked the version + a bare `createClient()` with no server. ## Verification | Suite | `src` | `dist` | |---|---|---| | node integration | 52 files / 309 ✅ | 52 files / 309 ✅ | | web integration | 31 files / 193 ✅ | 31 files / 193 ✅ | | node unit (incl. moved spec) | 180 ✅ | — | | oss-dependents | — | 21 files / 24 ✅ | Plus typecheck, build, prettier green; the post-publish `integration.ts` was run against the real published `@clickhouse/client` + a local ClickHouse. ## Checklist - [x] Unit and integration tests covering the common scenarios were added - [ ] A human-readable description of the changes was provided to include in CHANGELOG - [ ] For significant changes, documentation in https://github.com/ClickHouse/clickhouse-docs was updated with further explanations or tutorials 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
## Summary Patch-bumps the `@clickhouse/rowbinary` skill/package version from `0.1.1` to `0.1.2`. - **`skills/clickhouse-js-node-rowbinary-parser/package.json`** — `version` → `0.1.2` - **`skills/clickhouse-js-node-rowbinary-parser/package-lock.json`** — top-level and root package `version` → `0.1.2` ## Checklist - [ ] A human-readable description of the changes was provided to include in CHANGELOG Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
|
|
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
This PR extends the test/CI matrix to exercise the built (dist) artifacts (to better match what npm consumers actually load), and adds a post-publish live ClickHouse smoke to the publish workflow. It also bumps the @clickhouse/rowbinary skill package version.
Changes:
- Add
TEST_TARGET={src|dist}to Vitest configs and introduce*:integration:distnpm scripts to run integration tests against built packages. - Update Node/Web tests to import from the published package specifiers (and add small stream helpers) so the same specs can run against
dist. - Add a new
tests-dist.ymlworkflow and a new post-publish integration smoke (tests/e2e/install/src/integration.ts) executed against a live ClickHouse instance.
Reviewed changes
Copilot reviewed 37 out of 38 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| vitest.web.config.ts | Adds TEST_TARGET switching and dist-oriented dependency prebundling for browser tests. |
| vitest.node.config.ts | Adds TEST_TARGET switching; updates aliasing strategy for dist vs src testing. |
| tests/e2e/install/src/integration.ts | New post-publish, live ClickHouse end-to-end smoke for the installed npm artifact. |
| skills/clickhouse-js-node-rowbinary-parser/package.json | Bumps @clickhouse/rowbinary version to 0.1.2. |
| skills/clickhouse-js-node-rowbinary-parser/package-lock.json | Lockfile update for the 0.1.2 version bump. |
| packages/client-web/tests/utils/web_client.ts | Switches test typing imports to the published @clickhouse/client-web surface. |
| packages/client-web/tests/utils/stream.ts | Adds test-local ReadableStream → text helper to avoid importing internal src utils. |
| packages/client-web/tests/utils/simple_web_client.ts | Switches test typing imports to the published @clickhouse/client-web surface. |
| packages/client-web/tests/integration/web_stream_error_handling.test.ts | Updates types to come from @clickhouse/client-web. |
| packages/client-web/tests/integration/web_exec.test.ts | Stops importing internal src utils; uses published ResultSet + local stream helper. |
| packages/client-web/tests/integration/web_error_parsing.test.ts | Uses published createClient import. |
| packages/client-web/tests/integration/web_client.test.ts | Uses published createClient import. |
| packages/client-web/tests/integration/web_abort_request.test.ts | Updates test client typing to use published ClickHouseClient. |
| packages/client-node/tests/utils/stream.ts | Adds test-local stream → text helper to avoid importing internal src utils. |
| packages/client-node/tests/utils/simple_node_client.ts | Switches test typing imports to the published @clickhouse/client surface. |
| packages/client-node/tests/utils/node_client.ts | Switches test typing imports to the published @clickhouse/client surface. |
| packages/client-node/tests/utils/assert.ts | Stops importing internal src utils; uses the new test-local stream helper. |
| packages/client-node/tests/unit/node_client_headers.test.ts | Uses published createClient + ClickHouseClient imports. |
| packages/client-node/tests/integration/node_stream_row_binary.test.ts | Uses public drainStream import instead of internal stream helper. |
| packages/client-node/tests/integration/node_stream_error_handling.test.ts | Updates types to come from @clickhouse/client. |
| packages/client-node/tests/integration/node_socket_handling.test.ts | Switches config typing import to published ClickHouseClientConfigOptions. |
| packages/client-node/tests/integration/node_response_headers_cap_client.test.ts | Uses published createClient import. |
| packages/client-node/tests/integration/node_query_format_types.test.ts | Uses published ClickHouseClient/ResultSet types. |
| packages/client-node/tests/integration/node_max_open_connections.test.ts | Uses published ClickHouseClient type. |
| packages/client-node/tests/integration/node_keep_alive.test.ts | Uses published client/config types. |
| packages/client-node/tests/integration/node_keep_alive_header.test.ts | Uses published config typing import. |
| packages/client-node/tests/integration/node_jwt_auth.test.ts | Uses published createClient + ClickHouseClient type. |
| packages/client-node/tests/integration/node_exec.test.ts | Uses public ResultSet/drainStream imports; avoids internal src imports. |
| packages/client-node/tests/integration/node_errors_parsing.test.ts | Uses published createClient import. |
| packages/client-node/tests/integration/node_eager_socket_destroy.test.ts | Uses published config typing import. |
| packages/client-node/tests/integration/node_custom_http_agent.test.ts | Uses published createClient import. |
| package.json | Adds test:node:web:integration:dist scripts that build then run integration against dist. |
| .github/workflows/tests-web.yml | Removes the redundant “success” aggregator job. |
| .github/workflows/tests-oss-dependents.yml | Removes the redundant “success” aggregator job. |
| .github/workflows/tests-node.yml | Removes the redundant “success” aggregator job. |
| .github/workflows/tests-dist.yml | New workflow to run Node/Web integration suites against built dist artifacts. |
| .github/workflows/publish.yml | Starts ClickHouse and runs the new post-publish integration smoke. |
| .github/workflows/examples.yml | Removes the redundant “success” aggregator job. |
Files not reviewed (1)
- skills/clickhouse-js-node-rowbinary-parser/package-lock.json: Generated file
| "@clickhouse/client": "packages/client-node/dist", | ||
| "@clickhouse/client-common": "packages/client-node/dist", | ||
| "@clickhouse/client-node": "packages/client-node/dist", | ||
| "@test": "packages/client-common/__tests__", | ||
| } |
|
|
||
| // The e2e job starts ClickHouse via docker-compose just before this runs; poll | ||
| // ping briefly so we don't race the container coming up. | ||
| async function waitForClickHouse(client: any) { |
|
|
||
| // A bad query must surface as a ClickHouseError instance from the SAME | ||
| // installed package (a single bundle => one class identity). | ||
| let caught: unknown; |
No description provided.