From 85a50bb4c4415870cea43940b65cceb0076e463c Mon Sep 17 00:00:00 2001 From: Pokey Rule <755842+pokey@users.noreply.github.com> Date: Thu, 15 Jun 2023 15:33:32 -0400 Subject: [PATCH] Hack to work around microsoft/vscode#178241 (#1515) - Fixes #1363 ## Checklist - [x] Fails when test case legitimately fails - [x] Retries when test case fails with "codewindow unresponsive" - [x] Succeeds when test case succeeds - [x] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [x] I have updated the [docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and [cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet) - [x] I have not broken the cheatsheet --- .../test-harness/src/scripts/runTestsCI.ts | 6 ++--- .../src/util/launchVscodeAndRunTests.ts | 24 +++++++++++-------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/packages/test-harness/src/scripts/runTestsCI.ts b/packages/test-harness/src/scripts/runTestsCI.ts index 013894aef4..b15c634263 100644 --- a/packages/test-harness/src/scripts/runTestsCI.ts +++ b/packages/test-harness/src/scripts/runTestsCI.ts @@ -6,7 +6,7 @@ import { getCursorlessRepoRoot } from "@cursorless/common"; import * as path from "path"; import { launchVscodeAndRunTests } from "../util/launchVscodeAndRunTests"; -async function main() { +(async function main() { // Note that we run all tests, including unit tests, in VSCode, even though // unit tests could be run separately. If we wanted to run unit tests // separately, we could instead use `../runners/endToEndOnly` instead of @@ -18,6 +18,4 @@ async function main() { ); await launchVscodeAndRunTests(extensionTestsPath); -} - -main(); +})(); diff --git a/packages/test-harness/src/util/launchVscodeAndRunTests.ts b/packages/test-harness/src/util/launchVscodeAndRunTests.ts index 32c8a37249..3ae784de2b 100644 --- a/packages/test-harness/src/util/launchVscodeAndRunTests.ts +++ b/packages/test-harness/src/util/launchVscodeAndRunTests.ts @@ -1,5 +1,6 @@ import * as cp from "child_process"; import * as path from "path"; +import * as os from "os"; import { downloadAndUnzipVSCode, resolveCliArgsFromVSCodeExecutablePath, @@ -55,21 +56,24 @@ export async function launchVscodeAndRunTests(extensionTestsPath: string) { }, ); + console.log("finished installing dependency extensions"); + // Run the integration test - await runTests({ + const code = await runTests({ vscodeExecutablePath, extensionDevelopmentPath, extensionTestsPath, - // Note: Crash dump causes legacy VSCode to hang, so we just don't bother - launchArgs: useLegacyVscode - ? undefined - : [ - `--crash-reporter-directory=${crashDir}`, - `--logsPath=${logsDir}`, - "--disable-gpu", - "--disable-software-rasterizer", - ], + // Note: Crash dump causes legacy VSCode and Windows to hang, so we just + // don't bother. Can be re-enabled if we ever need it; on windows it only + // hangs some of the time, so might be enough to get a crash dump when you + // need it. + launchArgs: + useLegacyVscode || os.platform() === "win32" + ? undefined + : [`--crash-reporter-directory=${crashDir}`, `--logsPath=${logsDir}`], }); + + console.log(`Returned from "runTests" with value: ${code}`); } catch (err) { console.error("Test run threw exception:"); console.error(err);