1
- import * as Installer from "../../Installer" ;
2
- import * as fs from "fs/promises" ;
3
1
import * as path from "path" ;
4
2
5
3
import Mocha from "mocha" ;
6
4
import glob from "glob" ;
7
- import Parser from "tree-sitter" ;
8
5
9
6
export async function run ( ) : Promise < void > {
10
7
// Create the mocha test
@@ -16,54 +13,6 @@ export async function run(): Promise<void> {
16
13
17
14
const testsRoot = path . resolve ( __dirname , ".." ) ;
18
15
19
- const parsersDir = path . resolve ( testsRoot , ".." , ".." , "test-parsers" ) ;
20
-
21
- // remove parsers dir
22
- let exists = false ;
23
- try {
24
- await fs . access ( parsersDir ) ;
25
- exists = true ;
26
- } catch {
27
- // do nothing
28
- }
29
-
30
- if ( exists ) {
31
- await fs . rm ( parsersDir , { recursive : true } ) ;
32
- }
33
-
34
- // create parsers dir
35
- await fs . mkdir ( parsersDir ) ;
36
-
37
- const testParser = new Parser ( ) ;
38
-
39
- // install tree-sitter-rust
40
- let result = await Installer . getLanguage ( "test-parsers" , "rust" , true ) ;
41
- if ( result . status === "err" ) {
42
- throw new Error ( `Failed to install language: ${ result . result } ` ) ;
43
- }
44
-
45
- try {
46
- testParser . setLanguage ( result . result ) ;
47
- } catch ( error ) {
48
- throw new Error ( `Failed to install language: ${ result . result } ` ) ;
49
- }
50
-
51
- console . log ( `Installed language: ${ JSON . stringify ( result . result ) } ` ) ;
52
-
53
- // install tree-sitter-typescript
54
- result = await Installer . getLanguage ( "test-parsers" , "typescript" , true ) ;
55
- if ( result . status === "err" ) {
56
- throw new Error ( `Failed to install language: ${ result . result } ` ) ;
57
- }
58
-
59
- try {
60
- testParser . setLanguage ( result . result ) ;
61
- } catch ( error ) {
62
- throw new Error ( `Failed to install language: ${ result . result } ` ) ;
63
- }
64
-
65
- console . log ( `Installed language: ${ JSON . stringify ( result . result ) } ` ) ;
66
-
67
16
return new Promise ( ( c , e ) => {
68
17
glob ( "**/**.test.js" , { cwd : testsRoot } , ( err , files ) => {
69
18
if ( err ) {
0 commit comments