@@ -867,46 +867,43 @@ impl Step for RustdocJSStd {
867
867
const ONLY_HOSTS : bool = true ;
868
868
869
869
fn should_run ( run : ShouldRun < ' _ > ) -> ShouldRun < ' _ > {
870
- run. suite_path ( "tests/rustdoc-js-std" )
870
+ let default = run. builder . config . nodejs . is_some ( ) ;
871
+ run. suite_path ( "tests/rustdoc-js-std" ) . default_condition ( default)
871
872
}
872
873
873
874
fn make_run ( run : RunConfig < ' _ > ) {
874
875
run. builder . ensure ( RustdocJSStd { target : run. target } ) ;
875
876
}
876
877
877
878
fn run ( self , builder : & Builder < ' _ > ) {
878
- if let Some ( ref nodejs) = builder. config . nodejs {
879
- let mut command = Command :: new ( nodejs) ;
880
- command
881
- . arg ( builder. src . join ( "src/tools/rustdoc-js/tester.js" ) )
882
- . arg ( "--crate-name" )
883
- . arg ( "std" )
884
- . arg ( "--resource-suffix" )
885
- . arg ( & builder. version )
886
- . arg ( "--doc-folder" )
887
- . arg ( builder. doc_out ( self . target ) )
888
- . arg ( "--test-folder" )
889
- . arg ( builder. src . join ( "tests/rustdoc-js-std" ) ) ;
890
- for path in & builder. paths {
891
- if let Some ( p) =
892
- util:: is_valid_test_suite_arg ( path, "tests/rustdoc-js-std" , builder)
893
- {
894
- if !p. ends_with ( ".js" ) {
895
- eprintln ! ( "A non-js file was given: `{}`" , path. display( ) ) ;
896
- panic ! ( "Cannot run rustdoc-js-std tests" ) ;
897
- }
898
- command. arg ( "--test-file" ) . arg ( path) ;
879
+ let nodejs =
880
+ builder. config . nodejs . as_ref ( ) . expect ( "need nodejs to run rustdoc-js-std tests" ) ;
881
+ let mut command = Command :: new ( nodejs) ;
882
+ command
883
+ . arg ( builder. src . join ( "src/tools/rustdoc-js/tester.js" ) )
884
+ . arg ( "--crate-name" )
885
+ . arg ( "std" )
886
+ . arg ( "--resource-suffix" )
887
+ . arg ( & builder. version )
888
+ . arg ( "--doc-folder" )
889
+ . arg ( builder. doc_out ( self . target ) )
890
+ . arg ( "--test-folder" )
891
+ . arg ( builder. src . join ( "tests/rustdoc-js-std" ) ) ;
892
+ for path in & builder. paths {
893
+ if let Some ( p) = util:: is_valid_test_suite_arg ( path, "tests/rustdoc-js-std" , builder) {
894
+ if !p. ends_with ( ".js" ) {
895
+ eprintln ! ( "A non-js file was given: `{}`" , path. display( ) ) ;
896
+ panic ! ( "Cannot run rustdoc-js-std tests" ) ;
899
897
}
898
+ command. arg ( "--test-file" ) . arg ( path) ;
900
899
}
901
- builder. ensure ( crate :: doc:: Std :: new (
902
- builder. top_stage ,
903
- self . target ,
904
- DocumentationFormat :: HTML ,
905
- ) ) ;
906
- builder. run ( & mut command) ;
907
- } else {
908
- builder. info ( "No nodejs found, skipping \" tests/rustdoc-js-std\" tests" ) ;
909
900
}
901
+ builder. ensure ( crate :: doc:: Std :: new (
902
+ builder. top_stage ,
903
+ self . target ,
904
+ DocumentationFormat :: HTML ,
905
+ ) ) ;
906
+ builder. run ( & mut command) ;
910
907
}
911
908
}
912
909
@@ -922,7 +919,8 @@ impl Step for RustdocJSNotStd {
922
919
const ONLY_HOSTS : bool = true ;
923
920
924
921
fn should_run ( run : ShouldRun < ' _ > ) -> ShouldRun < ' _ > {
925
- run. suite_path ( "tests/rustdoc-js" )
922
+ let default = run. builder . config . nodejs . is_some ( ) ;
923
+ run. suite_path ( "tests/rustdoc-js" ) . default_condition ( default)
926
924
}
927
925
928
926
fn make_run ( run : RunConfig < ' _ > ) {
@@ -931,18 +929,14 @@ impl Step for RustdocJSNotStd {
931
929
}
932
930
933
931
fn run ( self , builder : & Builder < ' _ > ) {
934
- if builder. config . nodejs . is_some ( ) {
935
- builder. ensure ( Compiletest {
936
- compiler : self . compiler ,
937
- target : self . target ,
938
- mode : "js-doc-test" ,
939
- suite : "rustdoc-js" ,
940
- path : "tests/rustdoc-js" ,
941
- compare_mode : None ,
942
- } ) ;
943
- } else {
944
- builder. info ( "No nodejs found, skipping \" tests/rustdoc-js\" tests" ) ;
945
- }
932
+ builder. ensure ( Compiletest {
933
+ compiler : self . compiler ,
934
+ target : self . target ,
935
+ mode : "js-doc-test" ,
936
+ suite : "rustdoc-js" ,
937
+ path : "tests/rustdoc-js" ,
938
+ compare_mode : None ,
939
+ } ) ;
946
940
}
947
941
}
948
942
@@ -1568,6 +1562,8 @@ note: if you're sure you want to do this, please open an issue as to why. In the
1568
1562
1569
1563
if let Some ( ref nodejs) = builder. config . nodejs {
1570
1564
cmd. arg ( "--nodejs" ) . arg ( nodejs) ;
1565
+ } else if mode == "js-doc-test" {
1566
+ panic ! ( "need nodejs to run js-doc-test suite" ) ;
1571
1567
}
1572
1568
if let Some ( ref npm) = builder. config . npm {
1573
1569
cmd. arg ( "--npm" ) . arg ( npm) ;
0 commit comments