Skip to content

Commit a99b6fe

Browse files
andylrandycoulman
andauthored
Add README documentation for Script Execution (#126) (#127)
* Add README documentation for Script Execution (#126) Adds text for running MTI as an independent script. Useful for working on 3rd party projects that may not want MTI as a `mix.exs` dependency. Closes #126 --------- Co-authored-by: Randy Coulman <randy@randycoulman.com>
1 parent f159f4f commit a99b6fe

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

README.md

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,14 @@ mode" which runs tests after every file change.
2424

2525
## Installation
2626

27-
The package can be installed by adding `mix_test_interactive` to your list of
28-
dependencies in `mix.exs`:
27+
`mix test.interactive` can be added as a dependency to your project, or it can
28+
be run from an Elixir script without being added to your project.
29+
30+
### Installing as a Dependency
31+
32+
To install `mix test.interactive` as a dependency of your project, making it
33+
available to anyone working in the project, add `mix_test_interactive` to the
34+
list of dependencies in your project's `mix.exs` file:
2935

3036
```elixir
3137
def deps do
@@ -35,6 +41,31 @@ def deps do
3541
end
3642
```
3743

44+
### Running from an Elixir Script
45+
46+
If you are working on a 3rd-party project, you may not be able to add
47+
`mix test.interactive` as a dependency. In this case, it is possible
48+
to invoke `mix test.interactive` from an Elixir script.
49+
50+
To accomplish this, put the following script somewhere on your PATH and make it
51+
executable.
52+
53+
```elixir
54+
#!/usr/bin/env elixir
55+
56+
Mix.install([
57+
{:mix_test_interactive, "~> 4.1"}
58+
])
59+
60+
MixTestInteractive.run(System.argv())
61+
```
62+
63+
As an example, let's assume you've named the script `mti_exec`.
64+
65+
Now you can `cd` to the project's root directory, and run `mti_exec`. The script
66+
will accept all of `mix_test_interactive`'s [command-line options](#options) and
67+
allow you to use any of its [interactive commands](#interactive-commands).
68+
3869
## Usage
3970

4071
```shell

0 commit comments

Comments
 (0)