Skip to content

joaothallis/elixir-test-helper

elixir-test-helper

Bash scripts to help with Elixir testing workflows.

Installation

git clone https://github.com/joaothallis/elixir-test-helper.git

Symlink the scripts to a directory already in your PATH:

ln -s "$(pwd)/elixir-test-helper/test_modified_branch_files" /usr/local/bin/
ln -s "$(pwd)/elixir-test-helper/open_coverage" /usr/local/bin/

Scripts

test_modified_branch_files

Runs tests for Elixir files modified in the current branch compared to a base branch.

# Default: compare against main
test_modified_branch_files

# With mix test options
test_modified_branch_files --trace --seed 0

# With custom base branch
test_modified_branch_files --base develop

open_coverage

Opens the coverage HTML file for a given Elixir module.

# From implementation file
open_coverage lib/my_app/users.ex

# From implementation module
open_coverage MyApp.Users

# From test file
open_coverage test/my_app/users_test.exs

# From test module
open_coverage MyApp.UsersTest

Requires running mix test --cover first to generate coverage files.

Development

Running tests

Requires shUnit2.

bash test/test_modified_branch_files_test.sh
bash test/open_coverage_test.sh

Running coverage

Requires bashcov.

bashcov test/test_modified_branch_files_test.sh && bashcov test/open_coverage_test.sh

Using Nix

Alternatively, use Nix with flakes to get all dependencies:

nix develop

License

MIT

About

Bash scripts to help with Elixir testing workflows.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •