hst337
MixTester
This is a tiny tool I’ve developed during implementation of incremental compilation for my optimizing compiler. MixTester’s primary goal was to provide very simple and handy helpers for mix project initialization and project management in test environment.
Features
- 100% documented
- Real mix project management experience with
newflags and other stuff - Application env configuration
- Dependency list and other mix.exs configuration
- Handy and simple helpers for common commands
- ExUnit’s async friendly
Example:
defmodule AwesomeTask do
use ExUnit.Case, async: true
setup do
deps = [ {:awesome_task, path: File.cwd!()} ]
configuration = %{{:awesome_task, :year} => 2007}
# Creates project with `mix new my_project --sup`
# Which has `awesome_task` as a dependency
# And configuration where `config.exs` has
project =
MixTester.setup(
name: "my_project",
new: "--sup",
application_env: %{
"config" => configuration
},
project: [
deps: deps
]
)
# Creates the test file
MixTester.write_ast(project, "test/my_project_test.exs", quote do
defmodule MyProjectTest do
use ExUnit.Case, async: true
test "Just works" do
assert 2007 == AwesomeModule.what_year_is_today()
end
end
end)
# Cleanup the tmp dir
on_exit(fn -> MixTester.cleanup(project) end)
{:ok, project: project}
end
test "My awesome task", %{project: project} do
# Run the task we are testing
assert {_, 0} = MixTester.mix_cmd(project, "awesome")
# Run the test written above and check if it's run successfully
assert {_, 0} = MixTester.mix_cmd(project, "test")
end
end
Trending in Announcing
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries.
offset-based pagination with...
New
I needed to reuse React components from my Chrome extension in my Phoenix/LiveView backend. I noticed that for Svelte/Vue, there are live...
New
I released Doggo, a collection of unstyled Phoenix components.
https://github.com/woylie/doggo
Features
Unstyled Phoenix components....
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Hello
Published a new library - ProcessHub!
ProcessHub is a library designed to manage process distribution within the Elixir cluster. ...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
It’s not that it’s vocabulary is too advanced. It’s something worse.
I get lost trying to follow even a paragraph written by Claude. It’...
New
This showed up on my feed.. anyone heard of it? Just hype?
Ox Alpha is a reasoning model designed for coding, sustained ag...
New
Hey folks,
I just published a post about Hologram’s funding and where the project goes next - the short version:
Curiosum as Main Spons...
New
Today we’re releasing Oban for Python. Not an Oban client in Python. Not a pythonx wrapper embedded in Elixir. Nope, it’s a fully operati...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming









