@@ -23,19 +23,17 @@ function readGypTargetNames(gypFilePath: string): string[] {
23
23
} ) ;
24
24
}
25
25
26
- function testBundle (
27
- testDirectory : string ,
28
- testFiles : string [ ]
29
- ) : RolldownOptions [ ] {
30
- const gypFilePath = path . join ( testDirectory , "binding.gyp" ) ;
26
+ function testSuiteConfig ( suitePath : string ) : RolldownOptions [ ] {
27
+ const testFiles = fs . globSync ( "*.js" , {
28
+ cwd : suitePath ,
29
+ exclude : [ "*.bundle.js" ] ,
30
+ } ) ;
31
+ const gypFilePath = path . join ( suitePath , "binding.gyp" ) ;
31
32
const targetNames = readGypTargetNames ( gypFilePath ) ;
32
33
return testFiles . map ( ( testFile ) => ( {
33
- input : path . join ( testDirectory , testFile ) ,
34
+ input : path . join ( suitePath , testFile ) ,
34
35
output : {
35
- file : path . join (
36
- testDirectory ,
37
- path . basename ( testFile , ".js" ) + ".bundle.js"
38
- ) ,
36
+ file : path . join ( suitePath , path . basename ( testFile , ".js" ) + ".bundle.js" ) ,
39
37
} ,
40
38
resolve : {
41
39
conditionNames : [ "react-native" ] ,
@@ -79,6 +77,17 @@ function testBundle(
79
77
} ) ) ;
80
78
}
81
79
82
- export default defineConfig ( [
83
- ...testBundle ( "tests/js-native-api/2_function_arguments" , [ "test.js" ] ) ,
84
- ] ) ;
80
+ const suitePaths = fs
81
+ . globSync ( "tests/*/*" , {
82
+ cwd : import . meta. dirname ,
83
+ withFileTypes : true ,
84
+ } )
85
+ . filter ( ( dirent ) => dirent . isDirectory ( ) )
86
+ . map ( ( dirent ) =>
87
+ path . join (
88
+ path . relative ( import . meta. dirname , dirent . parentPath ) ,
89
+ dirent . name
90
+ )
91
+ ) ;
92
+
93
+ export default defineConfig ( suitePaths . flatMap ( testSuiteConfig ) ) ;
0 commit comments