test: Stage 2 unit coverage — split convertors/csvConverter + AzureResourceMetadata tests#3151
test: Stage 2 unit coverage — split convertors/csvConverter + AzureResourceMetadata tests#3151bk201- wants to merge 12 commits into
Conversation
🎭 E2E Tests (Playwright + VS Code)Commit: d95f5bd 🧪 Result
📥 Artifacts (run)
|
Code Coverage OverviewLanguages: TypeScript TypeScript / code-coverage/vitestThe overall coverage in the branch is 82%. The coverage in the branch is 73%. Show a code coverage summary of the most impacted files.
Updated |
🔨 Build, Lint & Test🔗 Source
📦 Package Information
🧪 Test Results
📥 Artifacts (run)✅ Build StatusBuild and local tests passed. See sibling comments below for E2E and NoSQL integration results. |
…deUtils, convertors, CosmosDbOperationsService
🔬 NoSQL language-service integrationCommit: 525bf60 🧪 Result
📥 Artifacts (run)
|
… justified disables
…iQueryDecorator (vscode + monaco)
…uageService Move the active-query-block resolution (non-empty region filter + active region lookup + leading/trailing whitespace trim) out of the vscode and monaco decorators into a single editor-agnostic SqlLanguageService.getActiveBlockOffsets() method. Both decorators now just convert the returned offsets to native positions, removing duplicated string logic. Adds 7 unit tests for the new method.
tsc requires the StreamParser.startState(indentUnit) argument; vitest's esbuild transform skips type-checking so it only surfaced in the CI build. Pass 4 to satisfy the signature.
Summary
Stage 2 of the unit test coverage plan: split large utility files into focused modules (barrel pattern keeps public import paths unchanged) and add per-module unit tests.
Changes
src/utils/convertors(wasconvertors.ts, 663 lines)Split into focused modules behind a barrel (
index.ts), so all existing import sites resolve unchanged:types.ts— shared types and constantsjson.ts—queryResultToJSONtable.ts—queryResultToTable+ table-building helperstree.ts—queryResultToTree+ tree-building helpersmetrics.ts—queryMetricsToTable,indexMetricsToTableItem,queryMetricsToJSONTests split per module with shared
testFixtures.ts:json.test.ts,table.test.ts,tree.test.ts,metrics.test.ts(23 tests).src/utils/csvConverter(wascsvConverter.ts)Split into:
escape.ts—getCsvSeparator,escapeCsvValuemetrics.ts—queryMetricsToCsvtable.ts—queryResultToCsvTests:
escape.test.ts,metrics.test.ts,table.test.ts(10 tests).src/cosmosdb/AzureResourceMetadata.tsAdded
AzureResourceMetadata.test.tscovering thedocumentEndpointandisServerlessgetters (6 tests). No production changes — uses a test subclass to access the protected constructor.Out of scope
src/webviews/theme/utils/) — verbatim vendored code from CSSWG CSS Color 4 / ThreeJS / Fluent Blocks; testing third-party reference implementations has low value.Validation
npm run l10n— cleannpm run prettier-fix— cleannpm run lint— 0 errorsvitest— 39 tests passing