   |> Path.wildcard()
   |> Enum.each(&Code.require_file/1)
 
+  setup do
+    on_exit(fn -> Agent.update(Serum.Plugin, fn _ -> %{} end) end)
+
+    :ok
+  end
+
   test "load_plugins/1" do
     {:ok, loaded_plugins} =
       load_plugins([Serum.DummyPlugin1, Serum.DummyPlugin2, Serum.DummyPlugin3])

  test "failing plugin 1" do
    {:ok, _} = load_plugins([Serum.DummyPlugin1, Serum.FailingPlugin1])

    assert {:error, "RuntimeError" <> _} = build_started("", "")
    assert {:error, "RuntimeError" <> _} = reading_posts([])
    assert {:error, "test: processing_page"} == processing_page(%File{})
    assert {:error, "test: finalizing"} == finalizing("", "")

    {:error, msg1} = processing_template(%File{})
    {:error, msg2} = build_succeeded("", "")

    assert String.contains?(msg1, "unexpected")
    assert String.contains?(msg2, "unexpected")

    Agent.update(Serum.Plugin, fn _ -> %{} end)
  end

  test "failing plugin 2" do

      end)

    assert count == 27
  end

  test "callback test" do
    {:ok, _} = load_plugins([Serum.DummyPlugin1, Serum.DummyPlugin2, Serum.DummyPlugin3])

    capture_io(fn ->
      assert :ok = build_started("/path/to/src", "/path/to/dest")
      assert {:ok, _} = reading_pages(["a", "b", "c"])
      assert {:ok, _} = reading_posts(["a", "b", "c"])
      assert {:ok, _} = reading_templates(["a", "b", "c"])
      assert {:ok, _} = processing_page(%File{src: "page.md"})
      assert {:ok, _} = processing_post(%File{src: "post.md"})
      assert {:ok, _} = processing_template(%File{src: "template.html.eex"})
      assert {:ok, _} = processed_page(%Page{title: "Test Page"})
      assert {:ok, _} = processed_post(%Post{title: "Test Post"})
      assert {:ok, _} = processed_template(%Template{file: "template.html.eex"})
      assert {:ok, _} = processed_list(%PostList{title: "Test Post List"})
      assert {:ok, _} = rendered_fragment(%Fragment{output: "test.html"})
      assert {:ok, _} = rendered_page(%File{dest: "test.html"})
      assert :ok = wrote_file(%File{dest: "test.html"})
      assert :ok = build_succeeded("/src", "/dest")
      assert :ok = build_failed("/src", "/dest", {:error, "sample error"})
      assert :ok = finalizing("/src", "/dest")
    end)
  end

  test "env filter" do
