Files
vscode-cowriting-plugin/test/e2e/runTest.ts
T
Ben Stull c0bae8c774 Fix #8: register warning stubs when no workspace folder; F5 opens the repo. Add selection context menus (#9)
- extension.ts: with no folder open, every contributed coauthoring command now
  registers a warning stub ('open a folder first') instead of being absent —
  the palette no longer errors 'command not found'. Opening a folder reloads
  the window and re-activates with a real root.
- .vscode/launch.json: the EDH now opens the repo as its workspace, so plain
  F5 lands in a working state.
- package.json: editor/context menu entries for 'Ask Claude to Edit
  Selection' and 'Add Coauthoring Thread on Selection', shown only when text
  is highlighted in a file-scheme editor (editorHasSelection).
- E2E: second no-workspace pass (suite-no-workspace) pins the #8 regression.

Fixes #8. Fixes #9.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 14:26:59 -07:00

40 lines
1.3 KiB
TypeScript

import * as path from "path";
import * as os from "os";
import * as fs from "fs";
import { runTests } from "@vscode/test-electron";
async function main(): Promise<void> {
const projectRoot = path.resolve(__dirname, "../../../");
const extensionDevelopmentPath = projectRoot;
const extensionTestsPath = path.resolve(__dirname, "./suite/index");
// Copy the fixture workspace to a temp dir so test writes are throwaway.
const fixture = path.resolve(projectRoot, "test/e2e/fixtures/workspace");
const workspace = fs.mkdtempSync(path.join(os.tmpdir(), "cowriting-e2e-"));
fs.cpSync(fixture, workspace, { recursive: true });
try {
await runTests({
extensionDevelopmentPath,
extensionTestsPath,
launchArgs: [workspace, "--disable-extensions"],
extensionTestsEnv: { E2E_WORKSPACE: workspace },
});
// Second pass — NO workspace folder (regression for #8): commands must
// exist as warning stubs instead of erroring "command not found".
await runTests({
extensionDevelopmentPath,
extensionTestsPath: path.resolve(__dirname, "./suite-no-workspace/index"),
launchArgs: ["--disable-extensions"],
});
} finally {
fs.rmSync(workspace, { recursive: true, force: true });
}
}
main().catch((err) => {
console.error("E2E run failed:", err);
process.exit(1);
});