1515// specific language governing permissions and limitations
1616// under the License.
1717
18+ const fs = require ( 'fs' ) ;
19+ const glob = require ( 'glob' ) ;
20+ const path = require ( 'path' ) ;
21+
1822const argv = require ( `command-line-args` ) ( [
1923 { name : `all` , type : Boolean } ,
2024 { name : 'update' , alias : 'u' , type : Boolean } ,
@@ -36,4 +40,25 @@ argv.module && !modules.length && modules.push(argv.module);
3640( argv . all || ! targets . length ) && targets . push ( `all` ) ;
3741( argv . all || ! modules . length ) && modules . push ( `all` ) ;
3842
43+ if ( argv . coverage && ( ! argv . json_files || ! argv . json_files . length ) ) {
44+
45+ let [ jsonPaths , arrowPaths ] = glob
46+ . sync ( path . resolve ( __dirname , `../test/data/json/` , `*.json` ) )
47+ . reduce ( ( paths , jsonPath ) => {
48+ const { name } = path . parse ( jsonPath ) ;
49+ const [ jsonPaths , arrowPaths ] = paths ;
50+ [ 'cpp' , 'java' ] . forEach ( ( source ) => [ 'file' , 'stream' ] . forEach ( ( format ) => {
51+ const arrowPath = path . resolve ( __dirname , `../test/data/${ source } /${ format } /${ name } .arrow` ) ;
52+ if ( fs . existsSync ( arrowPath ) ) {
53+ jsonPaths . push ( jsonPath ) ;
54+ arrowPaths . push ( arrowPath ) ;
55+ }
56+ } ) ) ;
57+ return paths ;
58+ } , [ [ ] , [ ] ] ) ;
59+
60+ argv . json_files = jsonPaths ;
61+ argv . arrow_files = arrowPaths ;
62+ }
63+
3964module . exports = { argv, targets, modules } ;
0 commit comments