@@ -480,6 +480,10 @@ static ENV_VARIABLES_HELP: &str = r#"ENVIRONMENT VARIABLES:
480480 DENO_NO_PROMPT Set to disable permission prompts on access
481481 (alternative to passing --no-prompt on invocation)
482482 DENO_WEBGPU_TRACE Directory to use for wgpu traces
483+ DENO_JOBS Number of parallel workers used for test subcommand.
484+ Defaults to number of available CPUs when used with
485+ --jobs flag and no value is provided.
486+ Defaults to 1 when --jobs flag is not used.
483487 HTTP_PROXY Proxy address for HTTP requests
484488 (module downloads, fetch)
485489 HTTPS_PROXY Proxy address for HTTPS requests
@@ -1548,9 +1552,10 @@ fn test_subcommand<'a>() -> Command<'a> {
15481552 Arg :: new ( "jobs" )
15491553 . short ( 'j' )
15501554 . long ( "jobs" )
1551- . help ( "Number of parallel workers, defaults to # of CPUs when no value is provided. Defaults to 1 when the option is not present." )
1555+ . help ( "Number of parallel workers, defaults to number of available CPUs when no value is provided. Defaults to 1 when the option is not present." )
15521556 . min_values ( 0 )
15531557 . max_values ( 1 )
1558+ . require_equals ( true )
15541559 . takes_value ( true )
15551560 . validator ( |val : & str | match val. parse :: < NonZeroUsize > ( ) {
15561561 Ok ( _) => Ok ( ( ) ) ,
@@ -2665,7 +2670,15 @@ fn test_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
26652670
26662671 let concurrent_jobs = if matches. is_present ( "jobs" ) {
26672672 if let Some ( value) = matches. value_of ( "jobs" ) {
2673+ println ! (
2674+ "{}" ,
2675+ crate :: colors:: yellow( "Warning: --jobs flag with numeric value is deprecated. Use 'DENO_JOBS' environment variable with --jobs flag instead." ) ,
2676+ ) ;
26682677 value. parse ( ) . unwrap ( )
2678+ } else if let Ok ( value) = env:: var ( "DENO_JOBS" ) {
2679+ value
2680+ . parse :: < NonZeroUsize > ( )
2681+ . unwrap_or ( NonZeroUsize :: new ( 1 ) . unwrap ( ) )
26692682 } else {
26702683 std:: thread:: available_parallelism ( )
26712684 . unwrap_or ( NonZeroUsize :: new ( 1 ) . unwrap ( ) )
0 commit comments