From 5de9fd0aa5fd46b04fcc48fc3db29895bcc60507 Mon Sep 17 00:00:00 2001 From: Meik Hellmund Date: Sun, 5 May 2024 16:08:02 +0200 Subject: [PATCH 1/3] make '--color=yes' the default --- src/server.jl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/server.jl b/src/server.jl index 942713a..80e628e 100644 --- a/src/server.jl +++ b/src/server.jl @@ -70,6 +70,8 @@ function _exeflags_and_env(options) if !any(startswith("JULIA_PROJECT="), env) && !any(startswith("--project="), exeflags) push!(exeflags, "--project=@.") end + # if exeflags already contains '--color=no', the 'no' will prevail + pushfirst!(exeflags,"--color=yes") return exeflags, env end From 9cf6c198e0adfc1071c8d7b6bf53004d76d6e47e Mon Sep 17 00:00:00 2001 From: Meik Hellmund Date: Mon, 6 May 2024 18:51:39 +0200 Subject: [PATCH 2/3] cleanup with JuliaFormatter --- src/server.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server.jl b/src/server.jl index 80e628e..6ebda7a 100644 --- a/src/server.jl +++ b/src/server.jl @@ -71,7 +71,7 @@ function _exeflags_and_env(options) push!(exeflags, "--project=@.") end # if exeflags already contains '--color=no', the 'no' will prevail - pushfirst!(exeflags,"--color=yes") + pushfirst!(exeflags, "--color=yes") return exeflags, env end From 1e76092e50786b4973b7e379b33db4e199be0a86 Mon Sep 17 00:00:00 2001 From: Meik Hellmund Date: Mon, 6 May 2024 23:46:48 +0200 Subject: [PATCH 3/3] Tests: added '--color=no' to some qmd files, changed logic of env_and_execflag test --- test/examples/project.qmd | 4 +++- test/examples/project/dir/project_default.qmd | 4 +++- test/examples/project/project_default.qmd | 4 +++- test/examples/project_env.qmd | 3 ++- test/examples/project_exeflags.qmd | 4 ++-- test/testsets/env_and_exeflags.jl | 6 +++--- 6 files changed, 16 insertions(+), 9 deletions(-) diff --git a/test/examples/project.qmd b/test/examples/project.qmd index 1473608..ceb7705 100644 --- a/test/examples/project.qmd +++ b/test/examples/project.qmd @@ -1,5 +1,7 @@ --- title: Project +julia: + exeflags: ["--color=no"] --- Non-global project environment. @@ -27,4 +29,4 @@ using Example ```{julia} isa(Example, Module) -``` \ No newline at end of file +``` diff --git a/test/examples/project/dir/project_default.qmd b/test/examples/project/dir/project_default.qmd index acb2b6a..09d9458 100644 --- a/test/examples/project/dir/project_default.qmd +++ b/test/examples/project/dir/project_default.qmd @@ -1,5 +1,7 @@ --- title: Project +julia: + exeflags: ["--color=no"] --- Non-global project environment. @@ -22,4 +24,4 @@ using Example ```{julia} isa(Example, Module) -``` \ No newline at end of file +``` diff --git a/test/examples/project/project_default.qmd b/test/examples/project/project_default.qmd index acb2b6a..09d9458 100644 --- a/test/examples/project/project_default.qmd +++ b/test/examples/project/project_default.qmd @@ -1,5 +1,7 @@ --- title: Project +julia: + exeflags: ["--color=no"] --- Non-global project environment. @@ -22,4 +24,4 @@ using Example ```{julia} isa(Example, Module) -``` \ No newline at end of file +``` diff --git a/test/examples/project_env.qmd b/test/examples/project_env.qmd index 213cb6e..95b0352 100644 --- a/test/examples/project_env.qmd +++ b/test/examples/project_env.qmd @@ -2,6 +2,7 @@ title: Project julia: env: ["JULIA_PROJECT=project"] + exeflags: ["--color=no"] --- Non-global project environment. @@ -24,4 +25,4 @@ using Example ```{julia} isa(Example, Module) -``` \ No newline at end of file +``` diff --git a/test/examples/project_exeflags.qmd b/test/examples/project_exeflags.qmd index b7d2b30..38316f8 100644 --- a/test/examples/project_exeflags.qmd +++ b/test/examples/project_exeflags.qmd @@ -1,7 +1,7 @@ --- title: Project julia: - exeflags: ["--project=project"] + exeflags: ["--project=project", "--color=no"] --- Non-global project environment. @@ -24,4 +24,4 @@ using Example ```{julia} isa(Example, Module) -``` \ No newline at end of file +``` diff --git a/test/testsets/env_and_exeflags.jl b/test/testsets/env_and_exeflags.jl index 8a133fe..df147f8 100644 --- a/test/testsets/env_and_exeflags.jl +++ b/test/testsets/env_and_exeflags.jl @@ -8,10 +8,10 @@ test_example(joinpath(@__DIR__, "../examples/env_and_exeflags.qmd")) do json @test cell["outputs"][1]["data"]["text/plain"] == "\"BAR\"" cell = cells[4] - @test cell["outputs"][1]["text"] == "red" + @test cell["outputs"][1]["text"] == "\e[31mred\e[39m" end -withenv("QUARTONOTEBOOKRUNNER_EXEFLAGS" => """["--color=yes"]""") do +withenv("QUARTONOTEBOOKRUNNER_EXEFLAGS" => """["--color=no"]""") do test_example(joinpath(@__DIR__, "../examples/env_and_exeflags.qmd")) do json cells = json["cells"] @test length(cells) == 4 @@ -20,6 +20,6 @@ withenv("QUARTONOTEBOOKRUNNER_EXEFLAGS" => """["--color=yes"]""") do @test cell["outputs"][1]["data"]["text/plain"] == "\"BAR\"" cell = cells[4] - @test cell["outputs"][1]["text"] == "\e[31mred\e[39m" + @test cell["outputs"][1]["text"] == "red" end end