From 677b2aa733e9d9359413805940da23301158e4ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Chalifour?= Date: Tue, 30 Jun 2026 17:13:38 +0200 Subject: [PATCH 1/5] chore(ci): align test workflow and knip config --- .github/workflows/test.yml | 16 ++++++++-------- DEVELOPMENT.md | 1 + cli/knip.json | 4 ++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6970d6b..dde219e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,7 +8,7 @@ on: jobs: test: - name: Test TypeScript CLI + name: Test CLI runs-on: ubuntu-latest services: altertable: @@ -77,25 +77,25 @@ jobs: bin/altertable --version bin/altertable --help - - name: Run Configure Tests + - name: Run configure tests run: ./tests/configure_test.sh - - name: Run Management Tests + - name: Run management tests run: ./tests/management_test.sh - - name: Run Context Tests + - name: Run context tests run: ./tests/context_test.sh - - name: Run Catalogs Tests + - name: Run catalogs tests run: ./tests/catalogs_test.sh - - name: Run Scripting Tests + - name: Run scripting tests run: ./tests/scripting_test.sh - - name: Run Profile Tests + - name: Run profile tests run: ./tests/profile_test.sh - - name: Run Integration Tests + - name: Run integration tests run: ./tests/integration_test.sh compile: diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 8b85740..eaff53d 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -12,6 +12,7 @@ bun run lint # oxlint with type-aware rules (typescript-go) bun run lint:fix # oxlint --fix bun run format # oxfmt bun run format:check # CI formatting check +bun run knip # required dead-code/unused-export check bun run generate # regenerate OpenAPI types bun run build # bundle to cli/dist/cli.js bun run pack:check # build + dry-run pack (verify publish contents) diff --git a/cli/knip.json b/cli/knip.json index 66dc2c0..69679f1 100644 --- a/cli/knip.json +++ b/cli/knip.json @@ -1,9 +1,9 @@ { "$schema": "https://unpkg.com/knip@6/schema.json", - "entry": ["src/cli.ts", "tests/**/*.test.ts", "scripts/**/*.ts"], + "entry": ["tests/**/*.test.ts", "scripts/**/*.ts"], "project": ["src/**/*.ts", "tests/**/*.test.ts", "scripts/**/*.ts"], "ignore": ["src/generated/**"], "ignoreExportsUsedInFile": true, "ignoreDependencies": ["undici"], - "ignoreBinaries": ["less", "security"] + "ignoreBinaries": ["less"] } From a8bb3bced8a66005c018f283a1abf1f3c80d3772 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Chalifour?= Date: Wed, 1 Jul 2026 10:45:29 +0200 Subject: [PATCH 2/5] ci: run unit tests with coverage --- .github/workflows/test.yml | 11 +++++++++-- AGENTS.md | 2 +- DEVELOPMENT.md | 4 +++- cli/AGENTS.md | 3 ++- cli/bunfig.toml | 6 ++++++ cli/package.json | 1 + scripts/verify.sh | 2 +- 7 files changed, 23 insertions(+), 6 deletions(-) create mode 100644 cli/bunfig.toml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dde219e..2ac7f88 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -59,10 +59,17 @@ jobs: git diff --exit-code src/generated/openapi-types.ts working-directory: cli - - name: Unit tests - run: bun test + - name: Unit tests with coverage + run: bun run test:coverage working-directory: cli + - name: Upload coverage report + uses: actions/upload-artifact@v4 + with: + name: cli-coverage-lcov + path: cli/coverage/lcov.info + if-no-files-found: error + - name: Build JS bundle run: bun run build working-directory: cli diff --git a/AGENTS.md b/AGENTS.md index da0eaf0..3b05172 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -20,7 +20,7 @@ Altertable CLI — a TypeScript/Bun command-line tool for querying and managing ```bash git submodule update --init --recursive # first checkout only -./scripts/verify.sh --quick # focused CLI changes +./scripts/verify.sh --quick # focused CLI changes, including coverage ./scripts/verify.sh # full gate before PR (mirrors CI minus native compile) ./scripts/verify.sh --integration # lakehouse HTTP paths (mock at :15000) ``` diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index eaff53d..21d04b5 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -7,6 +7,7 @@ cd cli bun install bun run dev -- --help # same as bin/altertable bun test +bun run test:coverage # coverage report + 80% threshold bun run typecheck bun run lint # oxlint with type-aware rules (typescript-go) bun run lint:fix # oxlint --fix @@ -103,7 +104,7 @@ Localhost HTTP works without `--allow-insecure-http`. For LAN or other non-local From repo root, one script mirrors CI (minus native binary compile): ```bash -./scripts/verify.sh --quick # typecheck, lint, format, knip, unit tests, openapi drift +./scripts/verify.sh --quick # typecheck, lint, format, knip, coverage, openapi drift ./scripts/verify.sh # + build, pack:check, shell offline tests ./scripts/verify.sh --integration # + integration_test.sh (requires mock at :15000) ``` @@ -141,6 +142,7 @@ Unit tests: ```bash cd cli && bun test +cd cli && bun run test:coverage ``` ## CLI spec conformance (lakehouse) diff --git a/cli/AGENTS.md b/cli/AGENTS.md index 926cd1e..ea2c53e 100644 --- a/cli/AGENTS.md +++ b/cli/AGENTS.md @@ -15,7 +15,7 @@ Executor-oriented notes for working in the TypeScript CLI subtree. Preferred — from repo root: ```bash -./scripts/verify.sh --quick # CLI checks only (typecheck, lint, format, knip, unit tests, openapi drift) +./scripts/verify.sh --quick # CLI checks only (typecheck, lint, format, knip, coverage, openapi drift) ./scripts/verify.sh # full gate (mirrors CI minus native compile) ./scripts/verify.sh --integration # + integration_test.sh (mock at :15000) ``` @@ -27,6 +27,7 @@ bun run typecheck bun run lint bun run format:check bun test +bun run test:coverage bun run knip ``` diff --git a/cli/bunfig.toml b/cli/bunfig.toml new file mode 100644 index 0000000..899e33c --- /dev/null +++ b/cli/bunfig.toml @@ -0,0 +1,6 @@ +[test] +coverageReporter = ["text", "lcov"] +coverageDir = "coverage" +coverageSkipTestFiles = true +coverageThreshold = { line = 0.8, function = 0.8 } +coveragePathIgnorePatterns = ["src/generated/**", "tests/**"] diff --git a/cli/package.json b/cli/package.json index cef0f97..39fbb7e 100644 --- a/cli/package.json +++ b/cli/package.json @@ -27,6 +27,7 @@ "format": "oxfmt", "format:check": "oxfmt --check", "test": "bun test", + "test:coverage": "bun test --coverage", "generate": "bun run scripts/generate-openapi-types.ts && bun run scripts/generate-openapi-index.ts", "build": "bun build src/cli.ts --outdir dist --target bun", "pack:check": "bun run build && bun pm pack --dry-run", diff --git a/scripts/verify.sh b/scripts/verify.sh index 969d362..7fa8ade 100755 --- a/scripts/verify.sh +++ b/scripts/verify.sh @@ -51,7 +51,7 @@ run_step "lint" bun run lint run_step "format:check" bun run format:check run_step "generate (openapi)" bun run generate run_step "openapi drift check" git diff --exit-code src/generated/openapi-types.ts src/generated/openapi-operations.ts -run_step "unit tests" bun test +run_step "unit tests with coverage" bun run test:coverage run_step "knip" bun run knip if [[ "${QUICK}" == true ]]; then From c6aaa4ef5332a34201b6ffaa26c384fef52a2b72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Chalifour?= Date: Wed, 1 Jul 2026 10:52:43 +0200 Subject: [PATCH 3/5] chore(cli): add HTML coverage report script --- cli/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/cli/package.json b/cli/package.json index 39fbb7e..2d4ef12 100644 --- a/cli/package.json +++ b/cli/package.json @@ -28,6 +28,7 @@ "format:check": "oxfmt --check", "test": "bun test", "test:coverage": "bun test --coverage", + "coverage:html": "bun run test:coverage && genhtml coverage/lcov.info --output-directory coverage/html", "generate": "bun run scripts/generate-openapi-types.ts && bun run scripts/generate-openapi-index.ts", "build": "bun build src/cli.ts --outdir dist --target bun", "pack:check": "bun run build && bun pm pack --dry-run", From cb47a615caac8576db62d3805d3c1be0218faa38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Chalifour?= Date: Wed, 1 Jul 2026 10:54:59 +0200 Subject: [PATCH 4/5] chore: rename coverage HTML script --- DEVELOPMENT.md | 2 +- cli/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 21d04b5..5d40f7d 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -7,7 +7,7 @@ cd cli bun install bun run dev -- --help # same as bin/altertable bun test -bun run test:coverage # coverage report + 80% threshold +bun run test:coverage # coverage report bun run typecheck bun run lint # oxlint with type-aware rules (typescript-go) bun run lint:fix # oxlint --fix diff --git a/cli/package.json b/cli/package.json index 2d4ef12..6e9c2f2 100644 --- a/cli/package.json +++ b/cli/package.json @@ -28,7 +28,7 @@ "format:check": "oxfmt --check", "test": "bun test", "test:coverage": "bun test --coverage", - "coverage:html": "bun run test:coverage && genhtml coverage/lcov.info --output-directory coverage/html", + "test:coverage:html": "bun run test:coverage && genhtml coverage/lcov.info --output-directory coverage/html", "generate": "bun run scripts/generate-openapi-types.ts && bun run scripts/generate-openapi-index.ts", "build": "bun build src/cli.ts --outdir dist --target bun", "pack:check": "bun run build && bun pm pack --dry-run", From abf035caae88e30e7ae430420d83215ec1386502 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Chalifour?= Date: Wed, 1 Jul 2026 11:03:19 +0200 Subject: [PATCH 5/5] chore: remove coverage HTML report script --- cli/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/cli/package.json b/cli/package.json index 6e9c2f2..39fbb7e 100644 --- a/cli/package.json +++ b/cli/package.json @@ -28,7 +28,6 @@ "format:check": "oxfmt --check", "test": "bun test", "test:coverage": "bun test --coverage", - "test:coverage:html": "bun run test:coverage && genhtml coverage/lcov.info --output-directory coverage/html", "generate": "bun run scripts/generate-openapi-types.ts && bun run scripts/generate-openapi-index.ts", "build": "bun build src/cli.ts --outdir dist --target bun", "pack:check": "bun run build && bun pm pack --dry-run",