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 Announcing
Hey there!
I wrote a download elixir package which does exactly what its name about - an easy way to download files.
I saw solutions ab...
New
Hello everybody :wave:
Recently, some of my colleagues talked about database ids and uuids and their problems, and I remembered the pain...
New
Introducing assertions, the library that helps you write really great test assertions!
GitHub: GitHub - devonestes/assertions: Helpful a...
New
Hey everyone!
Well, we made this lib a while ago and now we decided to finally go out and public with it! It’s a tool for creating and m...
New
Earmark is a pure-Elixir Markdown converter.
It is intended to be used as a library (just call Earmark.as_html), but can also be used as...
New
Hi everyone,
I’ve been working on this protobuf library for 3 years. We use it in the company I work for, EasyMile, to communicate with ...
New
Hello all,
I’ve been working on Svonix - a library for quickly integrating Svelte components into Phoenix views. It’s a much-needed succ...
New
After just over two years in development, this latest version of Pigeon is what I finally consider done in regards to my original vision ...
New
LiveMotion enables high performance animations declared on the server and run on the client.
As a follow up to my previous thread A libr...
New
Hi! :waving_hand:
I would like to present LiveSelect, a little library that I wrote to easily add a dynamic selection input to your LV f...
New
Other popular topics
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
Hey all,
I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: )
Hello all, this is ...
New
Hi everyone,
One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
Hi guys, i’m new in the Elixir world, and i have to say, that i love it!
i’m having some problem to understand anonymous functions with ...
New
I tried installing
elixir 1.11.2
erlang 23.3.4
via asdf in my zsh shell. Enabled the versions locally and globally.
When I list them ...
New
Hi!
In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir?
Searched the docs for ip address and the web, no good results.
Thanks!
New
Lets say I have map like this fetching from my database
%{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









