Skip to content

Commit a2d9269

Browse files
authored
Upgrade WebdriverIO e2e stack from v8 to v9 (#1930)
## Why Dependabot raised four separate, interdependent bumps for the WebdriverIO v8→v9 migration that **cannot merge individually**: - #1787 `@wdio/cli` 8→9 - #1788 `@wdio/mocha-framework` 8→9 - #1789 `@wdio/types` 8→9 - #1785 `wdio-video-reporter` 5→6 The `@wdio/*` packages must move in lockstep, and the v9 line additionally requires `wdio-vscode-service` v8 (its v8 peer-depends on `webdriverio@^9`) — which Dependabot never proposed. This PR performs the coordinated upgrade so the e2e tooling can advance, and supersedes the four PRs above. ## What - Bump `@wdio/cli`, `@wdio/local-runner`, `@wdio/mocha-framework`, `@wdio/spec-reporter`, `@wdio/types` → `^9.29.0`; `wdio-video-reporter` → `^6.2.0`; `wdio-vscode-service` → `^8.0.0`. - `wdio.conf.ts`: type the config as `WebdriverIO.Config` (v9 moved `capabilities` out of `Options.Testrunner`) and drop the removed `autoCompileOpts`/ts-node block. v9 transpiles TS via the bundled `tsx`; the tsconfig is now passed with `--tsConfigPath` in the `test:integ:extension` script. - e2e `tsconfig.json`: add the `DOM` lib and `skipLibCheck`, now required by v9's `webdriverio` types. - `commonUtils.ts`: `expect(string).not.toHaveText()` is element-only in v9's `expect-webdriverio`; switched the string assertion to `.not.toBe("-")`. ## Verification - `tsc --noEmit -p src/test/e2e/tsconfig.json` passes (0 errors) - `eslint` + `prettier -c` clean on changed files - `yarn install` resolves cleanly to `webdriverio` 9.29.0 with no peer conflicts - `yarn run build` succeeds - The e2e suite itself runs in CI (needs a VS Code download, VSIX build and a live Databricks workspace). **Backward compatibility:** dev/test-tooling only — no runtime, API, persisted-state or config-format changes; the shipped extension is unaffected. This pull request and its description were written by Isaac.
1 parent 8b847cc commit a2d9269

5 files changed

Lines changed: 2539 additions & 2462 deletions

File tree

packages/databricks-vscode/package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,7 +1531,7 @@
15311531
"test:unit": "yarn run build && node ./out/test/runTest.js",
15321532
"test:python": "DATABRICKS_EXTENSION_UNIT_TESTS=1 python -B -m unittest discover -s ./src/test/python -p '*_test.py'",
15331533
"test:integ:prepare": "./scripts/package-vsix-tests.sh",
1534-
"test:integ:extension": "yarn run test:integ:prepare && wdio run src/test/e2e/wdio.conf.ts",
1534+
"test:integ:extension": "yarn run test:integ:prepare && wdio run src/test/e2e/wdio.conf.ts --tsConfigPath src/test/e2e/tsconfig.json",
15351535
"test:integ:sdk": "ts-mocha --type-check 'src/sdk-extensions/**/*.integ.ts'",
15361536
"test:integ": "yarn run test:integ:extension && yarn run test:integ:sdk",
15371537
"test:cov": "nyc yarn run test:unit",
@@ -1580,11 +1580,11 @@
15801580
"@typescript-eslint/parser": "^6.14.0",
15811581
"@typescript-eslint/utils": "^6.14.0",
15821582
"@vscode/test-electron": "^2.3.8",
1583-
"@wdio/cli": "^8.35.1",
1584-
"@wdio/local-runner": "^8.35.1",
1585-
"@wdio/mocha-framework": "^8.35.0",
1586-
"@wdio/spec-reporter": "^8.32.4",
1587-
"@wdio/types": "^8.32.4",
1583+
"@wdio/cli": "^9.29.0",
1584+
"@wdio/local-runner": "^9.29.0",
1585+
"@wdio/mocha-framework": "^9.29.0",
1586+
"@wdio/spec-reporter": "^9.29.0",
1587+
"@wdio/types": "^9.29.0",
15881588
"chai": "^4.3.10",
15891589
"esbuild": "^0.25.0",
15901590
"eslint": "^8.55.0",
@@ -1603,8 +1603,8 @@
16031603
"ts-node": "^10.9.2",
16041604
"typescript": "^5.3.3",
16051605
"vsce": "^2.15.0",
1606-
"wdio-video-reporter": "^5.1.4",
1607-
"wdio-vscode-service": "^6.0.2",
1606+
"wdio-video-reporter": "^6.2.0",
1607+
"wdio-vscode-service": "^8.0.0",
16081608
"yargs": "^17.7.2"
16091609
},
16101610
"nyc": {

packages/databricks-vscode/src/test/e2e/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"resolveJsonModule": true,
1414
"module": "ESNext",
1515
"target": "ES2022",
16-
"lib": ["ES2022"],
16+
"lib": ["ES2022", "DOM"],
17+
"skipLibCheck": true,
1718
"isolatedModules": true,
1819
"sourceMap": true,
1920
"noImplicitAny": false,

packages/databricks-vscode/src/test/e2e/utils/commonUtils.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,23 @@ export async function waitForWorkflowWebview(
254254
}
255255
);
256256

257-
const startTime = await browser.getTextByLabel("run-start-time");
258-
console.log("Run start time:", startTime);
259-
expect(startTime).not.toHaveText("-");
257+
// The run start time renders as a "-" placeholder until the run details
258+
// arrive, so poll until it is populated rather than asserting once.
259+
// (The previous `expect(startTime).not.toHaveText("-")` was a no-op:
260+
// toHaveText is an element matcher and startTime is a plain string, so it
261+
// never actually asserted, which is why "-" slipped through on slower runs.)
262+
await browser.waitUntil(
263+
async () => {
264+
const startTime = await browser.getTextByLabel("run-start-time");
265+
console.log("Run start time:", startTime);
266+
return startTime !== "-" && startTime.trim().length > 0;
267+
},
268+
{
269+
timeout: 60_000,
270+
interval: 1_000,
271+
timeoutMsg: "Run start time did not populate (still '-')",
272+
}
273+
);
260274

261275
await browser.waitUntil(
262276
async () => {

packages/databricks-vscode/src/test/e2e/wdio.conf.ts

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
/* eslint-disable @typescript-eslint/naming-convention */
22
/* eslint-disable no-console */
3-
import type {Options} from "@wdio/types";
4-
53
// eslint-disable-next-line @typescript-eslint/no-var-requires
64
import video from "wdio-video-reporter";
75
import path from "node:path";
@@ -19,6 +17,27 @@ import {glob} from "glob";
1917
import {getUniqueResourceName} from "./utils/commonUtils.ts";
2018
import {promisify} from "node:util";
2119

20+
// WebdriverIO v9 loads TypeScript by injecting `--import <tsx loader>` into
21+
// NODE_OPTIONS for every worker process. wdio-vscode-service installs the
22+
// Databricks extension by spawning the VS Code (Electron) `code` CLI, which
23+
// inherits that NODE_OPTIONS — and Electron hard-rejects `--import` in
24+
// NODE_OPTIONS ("Code.exe: --import is not allowed in NODE_OPTIONS"). The
25+
// extension install then fails and every spec dies with `Can't find view
26+
// control "CONFIGURATION"`. By the time this config module loads, tsx has
27+
// already registered its loader in-process, so we can strip `--import` from
28+
// the environment that child processes inherit without breaking transpilation.
29+
// Only do this in workers (WDIO_WORKER_ID is set): the launcher must keep
30+
// `--import` in NODE_OPTIONS so the workers it spawns still get tsx.
31+
if (
32+
process.env.WDIO_WORKER_ID &&
33+
process.env.NODE_OPTIONS?.includes("--import")
34+
) {
35+
process.env.NODE_OPTIONS = process.env.NODE_OPTIONS.replace(
36+
/\s*--import(?:=|\s+)\S+/g,
37+
""
38+
).trim();
39+
}
40+
2241
const WORKSPACE_PATH = path.resolve(tmpdir(), "test-root");
2342

2443
const __filename = fileURLToPath(import.meta.url);
@@ -92,35 +111,23 @@ const execFile = async (
92111
return {stdout: res.stdout.toString(), stderr: res.stderr.toString()};
93112
};
94113

95-
export const config: Options.Testrunner = {
114+
export const config: WebdriverIO.Config = {
96115
//
97116
// ====================
98117
// Runner Configuration
99118
// ====================
100119
//
101120
//
102121
// =====================
103-
// ts-node Configurations
122+
// TypeScript Configuration
104123
// =====================
105124
//
106-
// You can write tests using TypeScript to get autocompletion and type safety.
107-
// You will need typescript and ts-node installed as devDependencies.
108-
// WebdriverIO will automatically detect if these dependencies are installed
109-
// and will compile your config and tests for you.
110-
// If you need to configure how ts-node runs please use the
111-
// environment variables for ts-node or use wdio config's autoCompileOpts section.
125+
// WebdriverIO v9 transpiles TypeScript config and spec files via `tsx`
126+
// (bundled with @wdio/cli). The tsconfig to use is passed on the CLI with
127+
// `--tsConfigPath src/test/e2e/tsconfig.json` (see the `test:integ:extension`
128+
// npm script), which replaces the v8 `autoCompileOpts`/ts-node mechanism.
112129
//
113130

114-
autoCompileOpts: {
115-
autoCompile: true,
116-
// see https://github.com/TypeStrong/ts-node#cli-and-programmatic-options
117-
// for all available options
118-
tsNodeOpts: {
119-
transpileOnly: true,
120-
project: path.join(__dirname, "tsconfig.json"),
121-
},
122-
},
123-
124131
//
125132
// ==================
126133
// Specify Test Files

0 commit comments

Comments
 (0)