MCPcopy Create free account
hub / github.com/PatrickSys/codebase-context / fakeTree

Function fakeTree

tests/tree-sitter-cleanup.test.ts:42–58  ·  view source on GitHub ↗
(options?: { hasError?: boolean; throwOnDescendants?: boolean })

Source from the content-addressed store, hash-verified

40});
41
42function fakeTree(options?: { hasError?: boolean; throwOnDescendants?: boolean }) {
43 const deleteSpy = vi.fn();
44 const shouldThrow = Boolean(options?.throwOnDescendants);
45
46 return {
47 rootNode: {
48 hasError: Boolean(options?.hasError),
49 descendantsOfType: vi.fn(() => {
50 if (shouldThrow) {
51 throw new Error('forced descendants failure');
52 }
53 return [];
54 })
55 },
56 delete: deleteSpy
57 };
58}
59
60describe('Tree-sitter cleanup and parser reset regressions', () => {
61 beforeEach(() => {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected