mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-10-04 02:31:36 +00:00
test(ingestion): probe the Dart parser before enabling its providers suite (#3354)
isLanguageAvailable only proves the module loaded; tree-sitter-dart can still fail on setLanguage. Probe loadParser/loadLanguage and skip on failure, the same guard dart.test.ts uses. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
24104749ea
commit
09933f3a38
1 changed files with 16 additions and 2 deletions
|
|
@ -19,14 +19,28 @@ import {
|
|||
runPipelineFromRepo,
|
||||
type PipelineResult,
|
||||
} from './helpers.js';
|
||||
import { isLanguageAvailable } from '../../../src/core/tree-sitter/parser-loader.js';
|
||||
import {
|
||||
isLanguageAvailable,
|
||||
loadParser,
|
||||
loadLanguage,
|
||||
} from '../../../src/core/tree-sitter/parser-loader.js';
|
||||
import { SupportedLanguages } from '../../../src/config/supported-languages.js';
|
||||
|
||||
// Kotlin, Swift and Dart grammars are optional installs; skip their suites
|
||||
// when the grammar did not load, as the per-language resolver suites do.
|
||||
const kotlinAvailable = isLanguageAvailable(SupportedLanguages.Kotlin);
|
||||
const swiftAvailable = isLanguageAvailable(SupportedLanguages.Swift);
|
||||
const dartAvailable = isLanguageAvailable(SupportedLanguages.Dart);
|
||||
// A loaded tree-sitter-dart module can still fail on setLanguage, so probe the
|
||||
// parser too (same guard as dart.test.ts).
|
||||
let dartAvailable = isLanguageAvailable(SupportedLanguages.Dart);
|
||||
if (dartAvailable) {
|
||||
try {
|
||||
await loadParser();
|
||||
await loadLanguage(SupportedLanguages.Dart);
|
||||
} catch {
|
||||
dartAvailable = false;
|
||||
}
|
||||
}
|
||||
|
||||
const runFixture = (name: string): Promise<PipelineResult> =>
|
||||
runPipelineFromRepo(path.join(FIXTURES, name), () => {});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue