Skip to content

Commit 707899e

Browse files
authored
Fix TS6 compile regressions in e2e/SDK test tooling (#1991)
## Why The TypeScript 5.9.3 → 6.0.3 upgrade (#1981) left two test-tooling code paths broken that `yarn build` and unit tests don't exercise. They only run in the e2e workflow (`vscode-isolated-pr`), so the breakage surfaced when cutting the **v2.12.2** release (#1990): **all 34 e2e/SDK shards failed to compile** on both Linux and Windows. ## What broke 1. **`scripts/setArchInPackage.ts` + `scripts/setupCLIDependencies.ts`** still used the pre-TS6 `await yargs.option(...)` pattern. Under TS6, `import yargs from "yargs"` (which uses `export =`) resolves to the callable factory type, not the `Argv` interface, so chaining `.option()` fails with: ``` scripts/setArchInPackage.ts(6,10): error TS2339: Property 'option' does not exist on type '(processArgs?: ...) => Argv<{}>'. ``` `setArchInPackage.ts` runs in the e2e **test-setup** step, which is why every e2e shard died before any spec ran. #1981 already fixed this exact pattern in `writeIpynbWrapper.ts` but missed these two. 2. **`packages/databricks-vscode/tsconfig.json`** got `"types": ["node"]` in #1981, which dropped the mocha ambient globals the SDK integration tests (`src/sdk-extensions/**/*.integ.ts`) rely on: ``` src/sdk-extensions/Cluster.integ.ts: error TS2593: Cannot find name 'describe' / 'it' / 'before'. ``` ## Fix - Call `yargs(process.argv.slice(2))` first in both scripts (same fix #1981 applied to `writeIpynbWrapper.ts`). - Add `"mocha"` to the `types` array (mirrors how `src/test/e2e/tsconfig.json` declares its test-framework types). ## Verification - `yarn run build` — 0 errors - `tsc --noEmit --project tsconfig.json` — 0 errors - `ts-node ./scripts/setArchInPackage.ts …` — runs (was exit 1) - `Cluster.integ.ts` — `describe`/`it`/`before` resolve - `yarn fix` — clean ## Follow-up Once merged, the **v2.12.2** release PR (#1990, currently in draft) will be re-cut so its e2e run can actually execute. Tracked in DECO-27584.
1 parent 7ac1a6d commit 707899e

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

packages/databricks-vscode/scripts/setArchInPackage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import fs from "node:fs/promises";
22
import yargs from "yargs";
33

44
async function main() {
5-
const argv = await yargs
5+
const argv = await yargs(process.argv.slice(2))
66
.option("cliArch", {
77
description: "Architecture of databricks cli.",
88
type: "string",

packages/databricks-vscode/scripts/setupCLIDependencies.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import type {
1414
} from "../src/utils/terraformUtils";
1515

1616
async function main() {
17-
const argv = await yargs
17+
const argv = await yargs(process.argv.slice(2))
1818
.option("cli", {
1919
description: "Path to the Databricks CLI",
2020
type: "string",

packages/databricks-vscode/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"outDir": "out",
55
"lib": ["ES2022", "DOM"],
66
"rootDir": "src",
7-
"types": ["node"]
7+
"types": ["node", "mocha"]
88
},
99
"references": [{"path": "../databricks-vscode-types"}],
1010
"include": ["src"],

0 commit comments

Comments
 (0)