Skip to content

Commit 8f8ea2d

Browse files
committed
fix(workspace): wire plugin tests into CI + drop excess property (#199)
- HIGH: add test/test:ci scripts to packages/plugin/package.json and matching task entries in turbo.json so turbo picks up regression tests in CI (closes a falsifiability gap where plugin tests were never executed) - MEDIUM: drop excess 'extensions: []' field from LspServerSpec test stub - TODO: ToolContext.directory plumbing in defaultSpawnCwd is documented as a follow-up issue (#198); architectural change kept out of this PR's scope Refs PR-B re-review round 3 (code-reviewer N3-H1, N3-M1) Refs #199
1 parent e6d603d commit 8f8ea2d

4 files changed

Lines changed: 17 additions & 2 deletions

File tree

‎packages/plugin/package.json‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
"license": "MIT",
77
"scripts": {
88
"typecheck": "tsgo --noEmit",
9-
"build": "tsc"
9+
"build": "tsc",
10+
"test": "bun test --timeout 30000",
11+
"test:ci": "mkdir -p .artifacts/unit && bun test --timeout 30000 --reporter=junit --reporter-outfile=.artifacts/unit/junit.xml"
1012
},
1113
"exports": {
1214
".": "./src/index.ts",

‎packages/plugin/src/tools/workspace/astgrep/cli.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,11 @@ export class AstGrepCli {
171171
}
172172
}
173173

174+
// FIXME(follow-up): plumb context.directory from ToolContext for correct workspace cwd.
175+
// `process.cwd()` happens to equal the session project directory in the common
176+
// `opencode` CLI launch path, but we should not rely on it — `ToolContext`
177+
// already carries an authoritative `directory`. Tracked separately to keep this
178+
// PR focused on the LSP/ast-grep surface.
174179
function defaultSpawnCwd(): string | undefined {
175180
return typeof process !== "undefined" ? process.cwd() : undefined
176181
}

‎packages/plugin/test/workspace/lsp-client.test.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,6 @@ describe("LSP connection factory (Bun-spawn regression)", () => {
300300
const stubSpec: LspServerSpec = {
301301
language: "stub",
302302
languageId: "stub",
303-
extensions: [],
304303
rootPatterns: [],
305304
command: process.execPath,
306305
args: [stub],

‎turbo.json‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@
2626
"dependsOn": ["^build"],
2727
"outputs": [".artifacts/unit/junit.xml"],
2828
"passThroughEnv": ["*"]
29+
},
30+
"@opencode-ai/plugin#test": {
31+
"dependsOn": ["^build"],
32+
"outputs": []
33+
},
34+
"@opencode-ai/plugin#test:ci": {
35+
"dependsOn": ["^build"],
36+
"outputs": [".artifacts/unit/junit.xml"],
37+
"passThroughEnv": ["*"]
2938
}
3039
}
3140
}

0 commit comments

Comments
 (0)