Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions packages/databricks-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1531,7 +1531,7 @@
"test:unit": "yarn run build && node ./out/test/runTest.js",
"test:python": "DATABRICKS_EXTENSION_UNIT_TESTS=1 python -B -m unittest discover -s ./src/test/python -p '*_test.py'",
"test:integ:prepare": "./scripts/package-vsix-tests.sh",
"test:integ:extension": "yarn run test:integ:prepare && wdio run src/test/e2e/wdio.conf.ts",
"test:integ:extension": "yarn run test:integ:prepare && wdio run src/test/e2e/wdio.conf.ts --tsConfigPath src/test/e2e/tsconfig.json",
"test:integ:sdk": "ts-mocha --type-check 'src/sdk-extensions/**/*.integ.ts'",
"test:integ": "yarn run test:integ:extension && yarn run test:integ:sdk",
"test:cov": "nyc yarn run test:unit",
Expand Down Expand Up @@ -1580,11 +1580,11 @@
"@typescript-eslint/parser": "^6.14.0",
"@typescript-eslint/utils": "^6.14.0",
"@vscode/test-electron": "^2.3.8",
"@wdio/cli": "^8.35.1",
"@wdio/local-runner": "^8.35.1",
"@wdio/mocha-framework": "^8.35.0",
"@wdio/spec-reporter": "^8.32.4",
"@wdio/types": "^8.32.4",
"@wdio/cli": "^9.29.0",
"@wdio/local-runner": "^9.29.0",
"@wdio/mocha-framework": "^9.29.0",
"@wdio/spec-reporter": "^9.29.0",
"@wdio/types": "^9.29.0",
"chai": "^4.3.10",
"esbuild": "^0.25.0",
"eslint": "^8.55.0",
Expand All @@ -1603,8 +1603,8 @@
"ts-node": "^10.9.2",
"typescript": "^5.3.3",
"vsce": "^2.15.0",
"wdio-video-reporter": "^5.1.4",
"wdio-vscode-service": "^6.0.2",
"wdio-video-reporter": "^6.2.0",
"wdio-vscode-service": "^8.0.0",
"yargs": "^17.7.2"
},
"nyc": {
Expand Down
3 changes: 2 additions & 1 deletion packages/databricks-vscode/src/test/e2e/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"resolveJsonModule": true,
"module": "ESNext",
"target": "ES2022",
"lib": ["ES2022"],
"lib": ["ES2022", "DOM"],
"skipLibCheck": true,
"isolatedModules": true,
"sourceMap": true,
"noImplicitAny": false,
Expand Down
20 changes: 17 additions & 3 deletions packages/databricks-vscode/src/test/e2e/utils/commonUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,23 @@ export async function waitForWorkflowWebview(
}
);

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

await browser.waitUntil(
async () => {
Expand Down
47 changes: 27 additions & 20 deletions packages/databricks-vscode/src/test/e2e/wdio.conf.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/* eslint-disable @typescript-eslint/naming-convention */
/* eslint-disable no-console */
import type {Options} from "@wdio/types";

// eslint-disable-next-line @typescript-eslint/no-var-requires
import video from "wdio-video-reporter";
import path from "node:path";
Expand All @@ -19,6 +17,27 @@ import {glob} from "glob";
import {getUniqueResourceName} from "./utils/commonUtils.ts";
import {promisify} from "node:util";

// WebdriverIO v9 loads TypeScript by injecting `--import <tsx loader>` into
// NODE_OPTIONS for every worker process. wdio-vscode-service installs the
// Databricks extension by spawning the VS Code (Electron) `code` CLI, which
// inherits that NODE_OPTIONS — and Electron hard-rejects `--import` in
// NODE_OPTIONS ("Code.exe: --import is not allowed in NODE_OPTIONS"). The
// extension install then fails and every spec dies with `Can't find view
// control "CONFIGURATION"`. By the time this config module loads, tsx has
// already registered its loader in-process, so we can strip `--import` from
// the environment that child processes inherit without breaking transpilation.
// Only do this in workers (WDIO_WORKER_ID is set): the launcher must keep
// `--import` in NODE_OPTIONS so the workers it spawns still get tsx.
if (
process.env.WDIO_WORKER_ID &&
process.env.NODE_OPTIONS?.includes("--import")
) {
process.env.NODE_OPTIONS = process.env.NODE_OPTIONS.replace(
/\s*--import(?:=|\s+)\S+/g,
""
).trim();
}

const WORKSPACE_PATH = path.resolve(tmpdir(), "test-root");

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

export const config: Options.Testrunner = {
export const config: WebdriverIO.Config = {
//
// ====================
// Runner Configuration
// ====================
//
//
// =====================
// ts-node Configurations
// TypeScript Configuration
// =====================
//
// You can write tests using TypeScript to get autocompletion and type safety.
// You will need typescript and ts-node installed as devDependencies.
// WebdriverIO will automatically detect if these dependencies are installed
// and will compile your config and tests for you.
// If you need to configure how ts-node runs please use the
// environment variables for ts-node or use wdio config's autoCompileOpts section.
// WebdriverIO v9 transpiles TypeScript config and spec files via `tsx`
// (bundled with @wdio/cli). The tsconfig to use is passed on the CLI with
// `--tsConfigPath src/test/e2e/tsconfig.json` (see the `test:integ:extension`
// npm script), which replaces the v8 `autoCompileOpts`/ts-node mechanism.
//

autoCompileOpts: {
autoCompile: true,
// see https://github.com/TypeStrong/ts-node#cli-and-programmatic-options
// for all available options
tsNodeOpts: {
transpileOnly: true,
project: path.join(__dirname, "tsconfig.json"),
},
},

//
// ==================
// Specify Test Files
Expand Down
Loading
Loading