From 2def0a6d6df2c532e47c8b5a571b6641044723b0 Mon Sep 17 00:00:00 2001 From: danusha2345 Date: Fri, 23 Oct 2026 11:41:08 -0500 Subject: [PATCH] test(kernel): skip the kernel-only suites when CODEGRAPH_KERNEL=0 CODEGRAPH_KERNEL=0 sends every language through wasm, and running the suite with it is how the wasm path is exercised on a machine that has the kernel built. Three kernel-only blocks failed in that run instead of skipping, because they skipped only when the .node file was missing: kernel-deep-nesting asserts in beforeAll that some language is routed to the kernel, kernel-retry-materialize asks for a raw kernel result and gets null, and the C++ brace-scope kernel parity block in cpp-brace-scopes gets no kernel result either. Each of the three describe.skipIf conditions now also skips when CODEGRAPH_KERNEL is '0', the same outcome as a checkout without a kernel. The kernel-independent self-heal block in kernel-retry-materialize still runs. Validation, the three files: on main with CODEGRAPH_KERNEL=0, 5 tests fail and kernel-deep-nesting fails at beforeAll; here, 13 pass and 13 skip. With the kernel (CODEGRAPH_KERNEL_EXPECT=1), 26 of 26 pass, nothing newly skipped. All 75 test files that reference the kernel pass with CODEGRAPH_KERNEL=0 on this commit (1,832 passed, 0 failed), so these were the only kernel-only blocks that failed that way. Test-only, so no CHANGELOG entry. Original PR #2372 by @danusha2345. Co-Authored-By: Claude Opus 5.5 --- __tests__/cpp-brace-scopes.test.ts | 2 +- __tests__/kernel-deep-nesting.test.ts | 3 ++- __tests__/kernel-retry-materialize.test.ts | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/__tests__/cpp-brace-scopes.test.ts b/__tests__/cpp-brace-scopes.test.ts index f29c76b0..45211375 100644 --- a/__tests__/cpp-brace-scopes.test.ts +++ b/__tests__/cpp-brace-scopes.test.ts @@ -350,7 +350,7 @@ describe('scanCppBraceScopes', () => { }); }); -describe.skipIf(!kernelAvailable)('C++ brace scopes: native kernel parity (error-extract hatch)', () => { +describe.skipIf(!kernelAvailable || process.env.CODEGRAPH_KERNEL === '0')('C++ brace scopes: native kernel parity (error-extract hatch)', () => { beforeAll(async () => { await initGrammars(); await loadGrammarsForLanguages(['cpp']); diff --git a/__tests__/kernel-deep-nesting.test.ts b/__tests__/kernel-deep-nesting.test.ts index 7529ff3b..e6e7db72 100644 --- a/__tests__/kernel-deep-nesting.test.ts +++ b/__tests__/kernel-deep-nesting.test.ts @@ -113,7 +113,8 @@ function deepBraces(depth: number): string { const ENV_KEYS = ['CODEGRAPH_KERNEL', 'CODEGRAPH_KERNEL_LANGS', 'CODEGRAPH_KERNEL_PATH'] as const; let savedEnv: Record; -describe.skipIf(!kernelBuilt)('kernel deep-nesting guard (#1581)', () => { +// CODEGRAPH_KERNEL=0 turns the kernel off: these assert what it does. +describe.skipIf(!kernelBuilt || process.env.CODEGRAPH_KERNEL === '0')('kernel deep-nesting guard (#1581)', () => { let routed: Language[] = []; beforeAll(async () => { diff --git a/__tests__/kernel-retry-materialize.test.ts b/__tests__/kernel-retry-materialize.test.ts index 23965bd2..5de86ffc 100644 --- a/__tests__/kernel-retry-materialize.test.ts +++ b/__tests__/kernel-retry-materialize.test.ts @@ -37,7 +37,8 @@ const KERNEL_PATH = path.join( ); const kernelBuilt = fs.existsSync(KERNEL_PATH); -describe.skipIf(!kernelBuilt)('kernel buffer-transport storage (#1541)', () => { +// CODEGRAPH_KERNEL=0 turns the kernel off: these assert what it does. +describe.skipIf(!kernelBuilt || process.env.CODEGRAPH_KERNEL === '0')('kernel buffer-transport storage (#1541)', () => { let dir: string; let cg: CodeGraph;