@@ -1450,19 +1450,20 @@ function free(ctx::Context, pkgs::Vector{PackageSpec}; err_if_free=true)
14501450 end
14511451end
14521452
1453- function gen_test_code (testfile :: String ;
1453+ function gen_test_code (source_path :: String ;
14541454 coverage= false ,
14551455 julia_args:: Cmd = ` ` ,
14561456 test_args:: Cmd = ` ` )
1457+ test_file = testfile (source_path)
14571458 code = """
14581459 $(Base. load_path_setup_code (false ))
1459- cd($(repr (dirname (testfile ))) )
1460+ cd($(repr (dirname (test_file ))) )
14601461 append!(empty!(ARGS), $(repr (test_args. exec)) )
1461- include($(repr (testfile )) )
1462+ include($(repr (test_file )) )
14621463 """
14631464 return ```
14641465 $(Base. julia_cmd ())
1465- --code-coverage=$(coverage ? " user " : " none" )
1466+ --code-coverage=$(coverage ? string ( " @ " , source_path) : " none" )
14661467 --color=$(Base. have_color === nothing ? " auto" : Base. have_color ? " yes" : " no" )
14671468 --compiled-modules=$(Bool (Base. JLOptions (). use_compiled_modules) ? " yes" : " no" )
14681469 --check-bounds=yes
@@ -1742,7 +1743,7 @@ function test(ctx::Context, pkgs::Vector{PackageSpec};
17421743 Pkg. _auto_precompile (sandbox_ctx, warn_loaded = false )
17431744 printpkgstyle (ctx. io, :Testing , " Running tests..." )
17441745 flush (ctx. io)
1745- cmd = gen_test_code (testfile ( source_path) ; coverage= coverage, julia_args= julia_args, test_args= test_args)
1746+ cmd = gen_test_code (source_path; coverage= coverage, julia_args= julia_args, test_args= test_args)
17461747 p = run (pipeline (ignorestatus (cmd), stdin = stdin , stdout = sandbox_ctx. io, stderr = stderr_f ()), wait = false )
17471748 interrupted = false
17481749 try
0 commit comments