@@ -23,19 +23,17 @@ function readGypTargetNames(gypFilePath: string): string[] {
2323 } ) ;
2424}
2525
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" ) ;
3132 const targetNames = readGypTargetNames ( gypFilePath ) ;
3233 return testFiles . map ( ( testFile ) => ( {
33- input : path . join ( testDirectory , testFile ) ,
34+ input : path . join ( suitePath , testFile ) ,
3435 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" ) ,
3937 } ,
4038 resolve : {
4139 conditionNames : [ "react-native" ] ,
@@ -79,6 +77,17 @@ function testBundle(
7977 } ) ) ;
8078}
8179
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