Skip to content

Commit f66aba8

Browse files
hyperpolymathclaude
andcommitted
test(codegen-embed): match require() wiring not bare specifier (fix false positives)
The two E2E tests `--vscode-extension-adapter overrides the require specifier` and `--vscode-extension-no-lc skips the language client` were checking for the *absence* of bare substrings `@hyperpolymath/affine-vscode` and `vscode-languageclient/node`. Codegen-embed now inlines the adapter source (packages/affine-vscode/mod.js), which carries documentation comments showing example usage of the default specifier and a `vscode-languageclient/node` section delimiter. Those bare substrings legitimately appear inside the embedded source — but they are not require() wiring. The off-by-default test at line 2994 already uses the precise pattern `require("@hyperpolymath/affine-vscode")` for exactly this reason. Bringing the override + no-lc tests to the same precision restores their semantic intent: assert which require() fires, not which strings appear anywhere. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent b1190a3 commit f66aba8

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

test/test_e2e.ml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3014,14 +3014,24 @@ let test_vscode_extension_adapter_override () =
30143014
~vscode_extension_adapter:"../local/adapter.cjs" activate_src in
30153015
Alcotest.(check bool) "uses the overridden adapter specifier"
30163016
true (contains cjs {|require("../local/adapter.cjs")|});
3017-
Alcotest.(check bool) "does not fall back to the default adapter"
3018-
false (contains cjs "@hyperpolymath/affine-vscode")
3017+
(* Match the require wiring, not the bare specifier — the embedded
3018+
adapter source (packages/affine-vscode/mod.js) carries documentation
3019+
comments that legitimately mention the default specifier as an
3020+
example usage; the override semantics is about which require()
3021+
fires, not which strings appear anywhere in the file. *)
3022+
Alcotest.(check bool) "does not fall back to the default adapter require"
3023+
false (contains cjs {|require("@hyperpolymath/affine-vscode")|})
30193024

30203025
let test_vscode_extension_no_lc () =
30213026
let cjs = cjs_of ~vscode_extension:true ~vscode_extension_no_lc:true
30223027
activate_src in
3028+
(* Match the require wiring, not the bare specifier — the embedded
3029+
adapter source includes a `vscode-languageclient/node` section
3030+
delimiter comment that is harmless because no actual require fires
3031+
unless the language-client argument is wired in (which `no_lc` skips
3032+
by passing `null`). *)
30233033
Alcotest.(check bool) "skips the language-client require"
3024-
false (contains cjs "vscode-languageclient/node");
3034+
false (contains cjs {|require("vscode-languageclient/node")|});
30253035
Alcotest.(check bool) "passes null in its place"
30263036
true (contains cjs " null,\n");
30273037
Alcotest.(check bool) "still requires vscode + adapter"

0 commit comments

Comments
 (0)