Skip to content

Commit bca3c8a

Browse files
pokeypre-commit-ci[bot]AndreasArvidsson
authored
Fixes for vscode 1.75.0 (#1249)
## Checklist - [ ] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [ ] 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) - [ ] I have not broken the cheatsheet --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Andreas Arvidsson <[email protected]>
1 parent bac6592 commit bca3c8a

File tree

7 files changed

+57
-14
lines changed

7 files changed

+57
-14
lines changed

.github/workflows/test.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,30 @@ jobs:
2121
runs-on: ${{ matrix.os }}
2222
env:
2323
VSCODE_VERSION: ${{ matrix.vscode_version }}
24+
VSCODE_CRASH_DIR: ${{ github.workspace }}/artifacts/dumps
25+
VSCODE_LOGS_DIR: ${{ github.workspace }}/artifacts/logs
2426
steps:
2527
- uses: actions/checkout@v3
2628
- uses: actions/setup-node@v3
2729
with:
2830
node-version: 16
2931
cache: yarn
32+
- run: mkdir -p "${{ env.VSCODE_CRASH_DIR }}" "${{ env.VSCODE_LOGS_DIR }}"
33+
shell: bash
3034
- run: yarn install --frozen-lockfile
3135
- run: xvfb-run -a yarn test
3236
if: runner.os == 'Linux'
3337
- run: yarn test
3438
if: runner.os != 'Linux'
39+
- name: Archive logs
40+
uses: actions/upload-artifact@v3
41+
with:
42+
name: logs
43+
path: ${{ env.VSCODE_LOGS_DIR }}
44+
if: failure()
45+
- name: Archive dumps
46+
uses: actions/upload-artifact@v3
47+
with:
48+
name: dumps
49+
path: ${{ env.VSCODE_CRASH_DIR }}
50+
if: failure()

docs/contributing/CONTRIBUTING.md

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,7 @@ extension](#running--testing-extension-locally), you may want to check out the
1818

1919
1. Clone [`cursorless`](https://github.com/cursorless-dev/cursorless)
2020
2. Open the newly created `cursorless` directory in VSCode. If you're on Windows, don't use WSL (see [#919](https://github.com/cursorless-dev/cursorless/issues/919) for discussion / workaround).
21-
3. Add the following to your [VSCode `settings.json`](https://code.visualstudio.com/docs/getstarted/settings#_settingsjson) (can be opened by saying `"show settings json"` with a recent install of knausj)
22-
23-
```json
24-
"workbench.experimental.settingsProfiles.enabled": true
25-
```
26-
27-
This setting allows you to debug the Cursorless extension in a clean, sandboxed version of VSCode, with its own extensions and settings, using the experimental [VSCode settings profile feature](https://code.visualstudio.com/updates/v1_72#_settings-profiles).
28-
29-
4. Run the following in the terminal:
21+
3. Run the following in the terminal:
3022

3123
```bash
3224
yarn
@@ -42,7 +34,7 @@ extension](#running--testing-extension-locally), you may want to check out the
4234

4335
where `some.extension` is the id of the extension you'd like to install into the sandbox
4436

45-
5. Copy / symlink `cursorless-talon-dev` into your Talon user directory for some useful voice commands for developing Cursorless.
37+
4. Copy / symlink `cursorless-talon-dev` into your Talon user directory for some useful voice commands for developing Cursorless.
4638

4739
## Running / testing extension locally
4840

src/apps/cursorless-vscode-e2e/suite/crossCellsSetSelection.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@ import * as assert from "assert";
66
import { window } from "vscode";
77
import { endToEndTestSetup, sleepWithBackoff } from "../endToEndTestSetup";
88
import { runCursorlessCommand } from "../runCommand";
9+
import { skipIfWindowsCi } from "./skipIfWindowsCi";
910

1011
// Check that setSelection is able to focus the correct cell
1112
suite("Cross-cell set selection", async function () {
13+
// Skipped for now; see #1260
14+
skipIfWindowsCi();
1215
endToEndTestSetup(this);
1316

1417
test("Cross-cell set selection", runTest);

src/apps/cursorless-vscode-e2e/suite/editNewCell.test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ import { window } from "vscode";
88
import { endToEndTestSetup, sleepWithBackoff } from "../endToEndTestSetup";
99
import { getPlainNotebookContents } from "../notebook";
1010
import { runCursorlessCommand } from "../runCommand";
11+
import { skipIfWindowsCi } from "./skipIfWindowsCi";
1112

1213
// Check that setSelection is able to focus the correct cell
1314
suite("Edit new cell", async function () {
15+
// Skipped for now; see #1260
16+
skipIfWindowsCi();
1417
endToEndTestSetup(this);
1518

1619
test("drink cell", () =>
@@ -30,7 +33,7 @@ async function runTest(
3033

3134
// FIXME: There seems to be some timing issue when you create a notebook
3235
// editor
33-
await sleepWithBackoff(1000);
36+
await sleepWithBackoff(100);
3437

3538
await graph.hatTokenMap.addDecorations();
3639

@@ -50,6 +53,8 @@ async function runTest(
5053
],
5154
});
5255

56+
await sleepWithBackoff(100);
57+
5358
assert.equal(notebook.cellCount, 2);
5459

5560
const activeCelIndex = getCellIndex(

src/apps/cursorless-vscode-e2e/suite/intraCellSetSelection.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@ import * as assert from "assert";
66
import { window } from "vscode";
77
import { endToEndTestSetup, sleepWithBackoff } from "../endToEndTestSetup";
88
import { runCursorlessCommand } from "../runCommand";
9+
import { skipIfWindowsCi } from "./skipIfWindowsCi";
910

1011
// Check that setSelection is able to focus the correct cell
1112
suite("Within cell set selection", async function () {
13+
// Skipped for now; see #1260
14+
skipIfWindowsCi();
1215
endToEndTestSetup(this);
1316

1417
test("Within cell set selection", runTest);
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export function skipIfWindowsCi() {
2+
suiteSetup(function () {
3+
if (process.env.RUNNER_OS === "Windows" && process.env.CI === "true") {
4+
this.skip();
5+
}
6+
});
7+
}

src/test/launchVscodeAndRunTests.ts

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
resolveCliArgsFromVSCodeExecutablePath,
66
runTests,
77
} from "@vscode/test-electron";
8-
import { env } from "process";
98
import { extensionDependencies } from "./extensionDependencies";
109

1110
/**
@@ -20,10 +19,15 @@ export async function launchVscodeAndRunTests(extensionTestsPath: string) {
2019
// Passed to `--extensionDevelopmentPath`
2120
const extensionDevelopmentPath = path.resolve(__dirname, "../../");
2221

22+
const crashDir = getEnvironmentVariableStrict("VSCODE_CRASH_DIR");
23+
const logsDir = getEnvironmentVariableStrict("VSCODE_LOGS_DIR");
24+
const useLegacyVscode =
25+
getEnvironmentVariableStrict("VSCODE_VERSION") === "legacy";
26+
2327
// NB: We include the exact version here instead of in `test.yml` so that
2428
// we don't have to update the branch protection rules every time we bump
2529
// the legacy VSCode version.
26-
const vscodeVersion = env.VSCODE_VERSION === "legacy" ? "1.66.0" : "stable";
30+
const vscodeVersion = useLegacyVscode ? "1.66.0" : "stable";
2731
const vscodeExecutablePath = await downloadAndUnzipVSCode(vscodeVersion);
2832
const [cli, ...args] =
2933
resolveCliArgsFromVSCodeExecutablePath(vscodeExecutablePath);
@@ -49,9 +53,22 @@ export async function launchVscodeAndRunTests(extensionTestsPath: string) {
4953
vscodeExecutablePath,
5054
extensionDevelopmentPath,
5155
extensionTestsPath,
56+
// Note: Crash dump causes legacy VSCode to hang, so we just don't bother
57+
launchArgs: useLegacyVscode
58+
? undefined
59+
: [`--crash-reporter-directory=${crashDir}`, `--logsPath=${logsDir}`],
5260
});
5361
} catch (err) {
54-
console.error("Failed to run tests");
62+
console.error("Test run threw exception:");
63+
console.error(err);
5564
process.exit(1);
5665
}
5766
}
67+
68+
function getEnvironmentVariableStrict(name: string): string {
69+
const value = process.env[name];
70+
if (value == null) {
71+
throw new Error(`Missing environment variable ${name}`);
72+
}
73+
return value;
74+
}

0 commit comments

Comments
 (0)