diff --git a/Project.toml b/Project.toml index 8bfbfb9..25fa5f3 100644 --- a/Project.toml +++ b/Project.toml @@ -13,6 +13,7 @@ LiveServer = "16fef848-5104-11e9-1b77-fb7a48bbb589" Logging = "56ddb016-857b-54e1-b83d-db4d58db5568" Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a" MarkdownLiteral = "736d6165-7244-6769-4267-6b50796e6954" +Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" Pluto = "c3e4b0f8-55cb-11ea-2926-15256bba5781" PlutoHooks = "0ff47ea0-7a50-410d-8455-4348d5de0774" PlutoLinks = "0ff47ea0-7a50-410d-8455-4348d5de0420" @@ -35,6 +36,7 @@ LiveServer = "1.2" Logging = "1" Markdown = "1" MarkdownLiteral = "0.1" +Pkg = "1" Pluto = "0.19.38" PlutoHooks = "0.0.5" PlutoLinks = "0.1.6" diff --git a/src/PlutoPages.jl b/src/PlutoPages.jl index 483e0a7..9fde219 100644 --- a/src/PlutoPages.jl +++ b/src/PlutoPages.jl @@ -128,7 +128,19 @@ function generate(; cache_dir::String, ) app = run_plutopages_notebook(; input_dir, output_dir, cache_dir, run_server=false) - fetch(app.notebook_task) + notebook = fetch(app.notebook_task) + + bad = false + for c in notebook.cells + if c.errored + bad = true + @error("Cell errored", c.code, c.output.body) + end + end + if bad + error("Error in notebook") + end + @info "PlutoPages: cleaning up..." shutdown(app) diff --git a/test/runtests.jl b/test/runtests.jl index d18e572..a8454c7 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -2,5 +2,25 @@ using PlutoPages using Test @testset "PlutoPages.jl" begin - # Write your tests here. + + input_dir = PlutoPages.create_test_basic_site() + + dirs = PlutoPages.create_subdirs(input_dir) + + result = PlutoPages.generate(; dirs...) + @test result == dirs.output_dir + + @info "Done!" dirs readdir(dirs.input_dir) readdir(dirs.output_dir) + + @test isdir(dirs.output_dir) + @test isdir(joinpath(dirs.output_dir, "generated_assets")) + + @test isfile(joinpath(dirs.output_dir, "index.html")) + @test isfile(joinpath(dirs.output_dir, "htmlpage", "index.html")) + @test isfile(joinpath(dirs.output_dir, "en", "docs", "index.html")) + @test isfile(joinpath(dirs.output_dir, "en", "docs", "packages", "index.html")) + @test isfile(joinpath(dirs.output_dir, "en", "blog", "something", "index.html")) + @test isfile(joinpath(dirs.output_dir, "en", "blog", "yayy", "index.html")) + + end