@@ -208,97 +208,10 @@ async function testTreeSitterFunctionality() {
208208 }
209209}
210210
211- function testQueryFilesExist ( ) {
212- console . log ( '🧪 Testing tree-sitter query files exist...' )
213-
214- // Test for both CJS and ESM builds
215- const testPaths = [
216- // CJS build location
217- path . join ( __dirname , '../../dist/tree-sitter-queries' ) ,
218- // Alternative path for different build configurations
219- path . join ( __dirname , '../../tree-sitter-queries' ) ,
220- ]
221-
222- const expectedFiles = [
223- 'tree-sitter-c-tags.scm' ,
224- 'tree-sitter-c_sharp-tags.scm' ,
225- 'tree-sitter-cpp-tags.scm' ,
226- 'tree-sitter-go-tags.scm' ,
227- 'tree-sitter-java-tags.scm' ,
228- 'tree-sitter-javascript-tags.scm' ,
229- 'tree-sitter-php-tags.scm' ,
230- 'tree-sitter-python-tags.scm' ,
231- 'tree-sitter-ruby-tags.scm' ,
232- 'tree-sitter-rust-tags.scm' ,
233- 'tree-sitter-typescript-tags.scm' ,
234- 'readme.md'
235- ]
236-
237- let foundPath = null
238-
239- // Find the correct path where query files exist
240- for ( const testPath of testPaths ) {
241- if ( fs . existsSync ( testPath ) ) {
242- foundPath = testPath
243- break
244- }
245- }
246-
247- if ( ! foundPath ) {
248- throw new Error ( `Tree-sitter query directory not found in any of: ${ testPaths . join ( ', ' ) } ` )
249- }
250-
251- console . log ( `✅ Found tree-sitter queries directory at: ${ foundPath } ` )
252-
253- // Check that all expected files exist
254- const actualFiles = fs . readdirSync ( foundPath )
255- const missingFiles = expectedFiles . filter ( file => ! actualFiles . includes ( file ) )
256-
257- if ( missingFiles . length > 0 ) {
258- throw new Error ( `Missing tree-sitter query files: ${ missingFiles . join ( ', ' ) } ` )
259- }
260-
261- console . log ( `✅ All ${ expectedFiles . length } expected query files found` )
262-
263- // Test that files have content and are readable
264- for ( const file of expectedFiles ) {
265- if ( file . endsWith ( '.scm' ) ) {
266- const filePath = path . join ( foundPath , file )
267- const content = fs . readFileSync ( filePath , 'utf8' )
268-
269- if ( content . length === 0 ) {
270- throw new Error ( `Query file ${ file } is empty` )
271- }
272-
273- // Basic validation that it looks like a tree-sitter query
274- if ( ! content . includes ( '(' ) || ! content . includes ( ')' ) ) {
275- throw new Error ( `Query file ${ file } doesn't appear to be a valid tree-sitter query` )
276- }
277-
278- console . log ( `✅ Query file ${ file } is valid (${ content . length } bytes)` )
279- }
280- }
281-
282- // Test that readme.md exists and has content
283- const readmePath = path . join ( foundPath , 'readme.md' )
284- const readmeContent = fs . readFileSync ( readmePath , 'utf8' )
285- if ( readmeContent . length === 0 ) {
286- throw new Error ( 'readme.md is empty' )
287- }
288-
289- console . log ( '✅ readme.md exists and has content' )
290-
291- return true
292- }
293-
294211// Run the tests
295212async function runAllTests ( ) {
296213 try {
297- // Test 1: Verify query files exist and are readable
298- testQueryFilesExist ( )
299- console . log ( '\n' )
300-
301- // Test 2: Test actual tree-sitter functionality
214+ // Test actual tree-sitter functionality
302215 await testTreeSitterFunctionality ( )
303216
304217 console . log ( '\n🎉 All tree-sitter query file tests passed!' )
0 commit comments