All Projects → influxdata → mix_test_interactive

influxdata / mix_test_interactive

Licence: MIT license
Interactive watch mode for Elixir's mix test. https://hexdocs.pm/mix_test_interactive/

Programming Languages

elixir
2628 projects
shell
77523 projects

Projects that are alternatives of or similar to mix test interactive

autorsync
Node.js File Watch + rsync
Stars: ✭ 56 (+55.56%)
Mutual labels:  watch
mix gleam
⚗️ Build Gleam code with mix
Stars: ✭ 84 (+133.33%)
Mutual labels:  mix
svelte-gantt
📆 Interactive JavaScript Gantt chart/resource booking component
Stars: ✭ 226 (+527.78%)
Mutual labels:  interactive
jsfiddle-github
JSFiddle implementation for interactive JavaScript examples.
Stars: ✭ 16 (-55.56%)
Mutual labels:  interactive
must-watch
A list of cybai's must-watch videos
Stars: ✭ 19 (-47.22%)
Mutual labels:  watch
WWDChrome
Chrome extension which lets you watch WWDC Developer Videos in Google Chrome (thus not having to use Safari)
Stars: ✭ 18 (-50%)
Mutual labels:  watch
React-Native-Interactive-Card
Interactive Card Component for React Native
Stars: ✭ 29 (-19.44%)
Mutual labels:  interactive
recoded
Re-coded by the School for Poetic Computation—crowdsourced recreations of early digital works using new tools
Stars: ✭ 57 (+58.33%)
Mutual labels:  interactive
dataui
data-ui for R
Stars: ✭ 57 (+58.33%)
Mutual labels:  interactive
open-watch
An open-source handmade smartwatch. All of the codes, PCBs and schematics are available. ⌚
Stars: ✭ 35 (-2.78%)
Mutual labels:  watch
vector
A javascript library for creating interactive graphics.
Stars: ✭ 154 (+327.78%)
Mutual labels:  interactive
pyrocms-cheatsheet
Pyro CMS - Cheat Sheet
Stars: ✭ 17 (-52.78%)
Mutual labels:  mix
exocortex-halo
Various and sundry additional pieces of software I've written to incorporate into my exocortex.
Stars: ✭ 65 (+80.56%)
Mutual labels:  interactive
bulbo
🍹 Generate your static site with gulp plugins!
Stars: ✭ 14 (-61.11%)
Mutual labels:  watch
bookvis
Sources of the book "Displaying time series, spatial and space-time data with R" (2nd Edition)
Stars: ✭ 52 (+44.44%)
Mutual labels:  interactive
react-native-android-wear-demo
Showcase of a two-way communication between React Native and Android Wear apps.
Stars: ✭ 93 (+158.33%)
Mutual labels:  watch
mix script
A build tool which allows you to use mix packages in an elixir script
Stars: ✭ 16 (-55.56%)
Mutual labels:  mix
hwatch
A modern alternative to the watch command, records the differences in execution results and can check this differences at after.
Stars: ✭ 370 (+927.78%)
Mutual labels:  watch
Binary-Calculator-JavaScript
📱 A handy Calculator for Binary operations, that works on all Devices 📱 💻 🖥 | ⛓ https://play.google.com/store/apps/details?id=com.binarycalculator.ayidouble.binarycalculator.app ⛓
Stars: ✭ 45 (+25%)
Mutual labels:  interactive
WatchSomething
Project that uses an API to list movies and tv shows that are latest, popular, top rated & on air.
Stars: ✭ 11 (-69.44%)
Mutual labels:  watch

mix test.interactive

Build Status Module Version Hex Docs License

mix test.interactive is an interactive test runner for ExUnit tests.

Based on Louis Pilfold's wonderful mix-test.watch and inspired by Jest's interactive watch mode, mix test.interactive allows you to dynamically change which tests should be run with a few keystrokes.

It allows you to easily switch between running all tests, stale tests, or failed tests. Or, you can run only the tests whose filenames contain a substring. Includes an optional "watch mode" which runs tests after every file change.

Installation

The package can be installed by adding mix_test_interactive to your list of dependencies in mix.exs:

def deps do
  [
    {:mix_test_interactive, "~> 1.0", only: :dev, runtime: false}
  ]
end

Usage

Run the mix task:

mix test.interactive

Your tests will run immediately (and every time a file changes).

If you don't want tests to run automatically when files change, you can start mix test.interactive with the --no-watch flag:

mix test.interactive --no-watch

After the tests run, you can use the interactive mode to change which tests will run.

Use the p command to run only test files that match one or more provided patterns. A pattern is the project-root-relative path to a test file (with or without a line number specification) or a string that matches a portion of full pathname. e.g. test/my_project/my_test.exs, test/my_project/my_test.exs:12:24 or my.

If any pattern contains a line number specification, all patterns are passed directly to mix test.

p pattern1 pattern 2

Use the s command to run only test files that reference modules that have changed since the last run (equivalent to the --stale option of mix test).

Use the f command to run only tests that failed on the last run (equivalent to the --failed option of mix test).

Use the a command to run all tests.

Use the w command to turn file-watching mode on or off.

Use the Enter key to re-run the current set of tests without requiring a file change.

Use the q command, or press Ctrl-D to exit the program.

Running A Different Mix Task

By default, mix test.interactive runs mix test. Through the mix config it is possible to run a different mix task. mix test.interactive assumes that this alternative task accepts the same command-line arguments as mix test.

# config/config.exs
use Mix.Config

if Mix.env == :dev do
  config :mix_test_interactive,
    task: "custom_test_task"
end

The task is run with MIX_ENV set to test.

Passing Arguments To Tasks

Any command line arguments passed to the mix test.interactive task will be passed through to the task being run, along with any arguments added by interactive mode. If I want to see detailed trace information for my tests, I can run:

mix test.interactive --trace

mix test.interactive will detect the --stale and --failed flags and use those as initial settings in interactive mode. You can then toggle those flags on and off as needed. It will also detect any filename or pattern arguments and use those as initial settings. However, it does not detect any filenames passed with --include or --only. Note that if you specify a pattern on the command-line, mix test.interactive will find all test files matching that pattern and pass those to mix test as if you had used the p command.

Clearing The Console Before Each Run

If you want mix test.interactive to clear the console before each run, you can enable this option in your config/dev.exs as follows:

# config/config.exs
use Mix.Config

if Mix.env == :dev do
  config :mix_test_interactive,
    clear: true
end

Excluding files or directories

To ignore changes from specific files or directories add exclude: regexp patterns to your config in mix.exs:

# config/config.exs
use Mix.Config

if Mix.env == :dev do
  config :mix_test_interactive,
    exclude: [~r/db_migration\/.*/,
              ~r/useless_.*\.exs/]
end

The default is exclude: [~r/\.#/, ~r{priv/repo/migrations}].

Compatibility Notes

On Linux you may need to install inotify-tools.

Desktop Notifications

You can enable desktop notifications with ex_unit_notifier.

Acknowledgements

This project started as a clone of the wonderful mix-test.watch project, which I've used and loved for years. I've added the interactive mode features to the existing feature set.

The idea for having an interactive mode comes from Jest and its incredibly useful interactive watch mode.

Copyright and License

Copyright (c) 2021-2022 Randy Coulman

This work is free. You can redistribute it and/or modify it under the terms of the MIT License. See the LICENSE.md file for more details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].