@@ -10,6 +10,7 @@ const {Options, runTest} = require('browser-ui-test');
1010function showHelp ( ) {
1111 console . log ( "rustdoc-js options:" ) ;
1212 console . log ( " --doc-folder [PATH] : location of the generated doc folder" ) ;
13+ console . log ( " --file [PATH] : file to run (can be repeated)" ) ;
1314 console . log ( " --help : show this message then quit" ) ;
1415 console . log ( " --tests-folder [PATH] : location of the .GOML tests folder" ) ;
1516}
@@ -18,6 +19,7 @@ function parseOptions(args) {
1819 var opts = {
1920 "doc_folder" : "" ,
2021 "tests_folder" : "" ,
22+ "files" : [ ] ,
2123 } ;
2224 var correspondances = {
2325 "--doc-folder" : "doc_folder" ,
@@ -26,13 +28,18 @@ function parseOptions(args) {
2628
2729 for ( var i = 0 ; i < args . length ; ++ i ) {
2830 if ( args [ i ] === "--doc-folder"
29- || args [ i ] === "--tests-folder" ) {
31+ || args [ i ] === "--tests-folder"
32+ || args [ i ] === "--file" ) {
3033 i += 1 ;
3134 if ( i >= args . length ) {
3235 console . log ( "Missing argument after `" + args [ i - 1 ] + "` option." ) ;
3336 return null ;
3437 }
35- opts [ correspondances [ args [ i - 1 ] ] ] = args [ i ] ;
38+ if ( args [ i - 1 ] !== "--file" ) {
39+ opts [ correspondances [ args [ i - 1 ] ] ] = args [ i ] ;
40+ } else {
41+ opts [ "files" ] . push ( args [ i ] ) ;
42+ }
3643 } else if ( args [ i ] === "--help" ) {
3744 showHelp ( ) ;
3845 process . exit ( 0 ) ;
@@ -78,7 +85,12 @@ async function main(argv) {
7885 }
7986
8087 let failed = false ;
81- let files = fs . readdirSync ( opts [ "tests_folder" ] ) . filter ( file => path . extname ( file ) == ".goml" ) ;
88+ let files ;
89+ if ( opts [ "files" ] . length === 0 ) {
90+ files = fs . readdirSync ( opts [ "tests_folder" ] ) . filter ( file => path . extname ( file ) == ".goml" ) ;
91+ } else {
92+ files = opts [ "files" ] . filter ( file => path . extname ( file ) == ".goml" ) ;
93+ }
8294
8395 files . sort ( ) ;
8496 for ( var i = 0 ; i < files . length ; ++ i ) {
0 commit comments