hst337
MixTester - tiny tool for testing mix tasks and any other project management tools
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
Popular in Libraries
Hey guyz
We at @aviabird are working on a payment library in elixir/phoenix. We are targeting March 2018 to add 56 Gateways to it.
Have...
New
Raxx is an alternative to Plug and is inspired by projects such as Rack(Ruby) and Ring(Clojure).
1.0-rc.1 is now available. To use it re...
New
I’ve just released stable versions of my Prometheus Elixir libs:
Elixir client [docs];
Ecto collector [docs];
Plugs instrumenter/Export...
New
Dune is a sandbox for Elixir and aims to safely evaluate user-provided code.
You can try it out using this basic Elixir playground made ...
New
FastRSS
Parse RSS feeds very quickly:
This is rust NIF built using rustler
Uses the RSS rust crate to do the actual RSS parsing
Speed...
New
What is ContEx?
A pure Elixir server-side data plotting/charting library outputting SVG.
It has nice barcharts in particular and works g...
New
I have been updating a library that allows you to pipe between functions that use the erlang result tuple convention.
Assuming you have...
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
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch.
This project took far...
New
Yes, yet another parser combinator library!
Most of the parser combinators in the ecosystem are either compile-time, often using AST tra...
New
Other popular topics
Hi! May someone helps me, please!
I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
Manning 2016 Halloween weekend sale via Deal of the Day
Friday, October 28 - Half off all MEAPs - code WM102816LT
Saturday, October 29 ...
New
In Ruby, I can go:
User.find_by(email: "foobar@email.com").update(email: "hello@email.com")
How can I do something similar in Elixir? ...
New
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!)
This post collects co...
New
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service.
Currently when I de...
New
i’m a new one to elixir
which editor can i use
vs code? or atom?
Thanks! :smiley:
New
I will often find my self writing things similar to:
case some_value do
nil -> something()
"" -> something()
_ -> someth...
New
I am trying to run a deploy with docker and I successfully runned with this command:
docker build -t romenigld/blog-prod .
but when I t...
New







