Native surfaces migration — evolve the extension onto VS Code's native review surfaces (9-task plan, spec v0.2.1) (#72)
This commit was merged in pull request #72.
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
#!/usr/bin/env node
|
||||
// Task 9 / spec §7.1 rung 3: the manual, real-@cline/sdk smoke for the native
|
||||
// comment loop -- mirrors scripts/smoke-live-turn.mjs's role for F3 (a live
|
||||
// login-backed check, deliberately NOT in CI), but this one drives the whole
|
||||
// EDH (comment -> reply -> offer -> proposal needs vscode's own comment/doc
|
||||
// APIs, unlike smoke-live-turn.mjs's bare module call) via
|
||||
// test/e2e/smoke/nativeLoop.ts, launched exactly like test/e2e/runTest.ts
|
||||
// launches the regular host-E2E suites -- just against a single smoke entry
|
||||
// point that is NOT swept into `npm run test:e2e` (it lives outside
|
||||
// test/e2e/suite, which is the only directory suite/index.ts's mocha glob
|
||||
// searches).
|
||||
//
|
||||
// Prereqs: `npm run pretest:e2e` (builds the extension + compiles
|
||||
// test/e2e/**). `npm run smoke:native` does this for you.
|
||||
//
|
||||
// Opens the real sandbox/ folder (the repo's EDH workspace root), writes a
|
||||
// throwaway doc, posts a real comment via ThreadController.createThreadOnSelection,
|
||||
// waits for the real @cline/sdk reply + offer, makes + accepts the edit, then
|
||||
// prints the created proposal ids and deletes the throwaway doc.
|
||||
import * as fs from "node:fs";
|
||||
import * as os from "node:os";
|
||||
import * as path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { runTests } from "@vscode/test-electron";
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
async function main() {
|
||||
const projectRoot = path.resolve(__dirname, "..");
|
||||
const extensionDevelopmentPath = projectRoot;
|
||||
const extensionTestsPath = path.resolve(projectRoot, "out/test/e2e/smoke/nativeLoop");
|
||||
const sandbox = path.resolve(projectRoot, "sandbox");
|
||||
|
||||
if (!fs.existsSync(`${extensionTestsPath}.js`)) {
|
||||
console.error(
|
||||
`smoke-native-loop: ${extensionTestsPath}.js is missing -- run "npm run pretest:e2e" first (or "npm run smoke:native", which does this for you).`,
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Same macOS UNIX-socket-length workaround as test/e2e/runTest.ts (a long
|
||||
// worktree path + the default .vscode-test/user-data dir can blow past the
|
||||
// ~103-char limit).
|
||||
const userDataRoot = process.platform === "win32" ? os.tmpdir() : "/tmp";
|
||||
const userDataDir = fs.mkdtempSync(path.join(userDataRoot, "cwud-smoke-"));
|
||||
|
||||
try {
|
||||
await runTests({
|
||||
extensionDevelopmentPath,
|
||||
extensionTestsPath,
|
||||
launchArgs: [sandbox, "--disable-extensions", "--user-data-dir", userDataDir],
|
||||
});
|
||||
console.log("smoke-native-loop: PASS");
|
||||
process.exit(0);
|
||||
} catch (err) {
|
||||
console.error(
|
||||
`smoke-native-loop: FAILED (expected when Claude Code is absent/signed out, or the sandbox/ folder is missing): ${
|
||||
err instanceof Error ? err.message : String(err)
|
||||
}`,
|
||||
);
|
||||
process.exit(1);
|
||||
} finally {
|
||||
fs.rmSync(userDataDir, { recursive: true, force: true });
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
||||
Reference in New Issue
Block a user