https://github.com/caiquemitsuoka/yokai
A test runner and watcher designed for fast interactive development
https://github.com/caiquemitsuoka/yokai
elixir elixir-lang hexpm runner tdd test
Last synced: 9 months ago
JSON representation
A test runner and watcher designed for fast interactive development
- Host: GitHub
- URL: https://github.com/caiquemitsuoka/yokai
- Owner: CaiqueMitsuoka
- License: mit
- Created: 2024-09-23T12:45:37.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-08-23T04:12:31.000Z (10 months ago)
- Last Synced: 2025-08-24T07:53:25.486Z (10 months ago)
- Topics: elixir, elixir-lang, hexpm, runner, tdd, test
- Language: Elixir
- Homepage:
- Size: 47.9 KB
- Stars: 9
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Yokai
[](https://hex.pm/packages/yokai)
[](https://hex.pm/packages/yokai)
[](https://hexdocs.pm/yokai)
Yokai is an alternative test runner for ExUnit base on file watcher. Watchs for code changes and changes in the selected test files to auto trigger a new testa run hot reloading the code avoiding a cold start of the app/vm. The BEAM way.
## Installation
```elixir
# You need this to mix watch apply MIX_ENV=test for you.
def cli do
[
preferred_envs: [{:watch, :test}]
]
end
def deps do
[
{:yokai, "~> 0.3.1"}
]
end
```
## Usage
```shell
# Run all tests and watch for changes
mix watch
# Run only this test file and watch for changes
mix watch test/module_name.exs
# Run all tests following a wildcard pattern
mix watch test/domain/*
# Increate the compile timeout for big projects.
mix watch --compile-timeout 60
```
While running, all changes to any file at `lib/` or `test/` will trigger a run.
But while it waits for a file change, you can enter commands yourself.
### Menu
| Command | Description |
| ------- | ----------------------------- |
| a | Run all tests once |
| q | Quit |
| r | Rerun tests |
| w | Update the test files pattern |
## Reason
The point is to have a faster iteration for then developing test/changes or applying TDD.
When talking about this idea it always come up that you need to reload the environment when you change a config. And
to this there is 2 points against.
- Most of the time you are not changing configuration between runs, but when you do: mix test still there, exactly the same.
- The hot reload from Phoenix is good enough for most apps and workflows. This applies the same rules but for tests.
## Goals
Have a fast code reloader and a nice CLI to quick iterate on development.
- [x] Hot reload project code before each run
- [x] Hot reload test file before each run
- [x] Accept test file patterns to select test e.g accept `test/*/sample*`
- [x] Option to clear console between run
- [ ] Keypress to trigger a run(Partially implemented, requires enter)
- [ ] Keypress to run all tests(Partially implemented, requires enter)
- [ ] Keypress to redefine the pattern(Partially implemented, requires enter)
- [ ] MCP server/tool for client to collect latest test run results.
- [ ] MCP tool to redefine runned configuration