README.md
1# Stack Integration Tests
2
3This directory contains a bunch of integration tests for Stack. Each
4directory inside the `tests` subdirectory represents a single
5test. Each of those directories has:
6
7* A `Main.hs` file, which provides the script to be run
8* A `files `directory, providing the working directory the script will
9 be run from. (If you have a test that doesn't require any specific
10 working directory, there may be no `files` directory.)
11
12It would be great to expand this file into a full tutorial, but for
13now, the easiest way to get started with writing an integration test
14is to copy an existing example.
15
16## Running
17
18One simple way to run a single test is:
19
20* Change into the `files` directory
21* Run the command `stack runghc -- -i../../../lib ../Main.hs`
22
23A more thorough way to run the tests is with
24
25```shell
26$ stack build --flag stack:integration-tests stack --exec stack-integration-test
27```
28
29Note that this command can take a _long_ time. It's also more thorough
30than the quick command given above, as it will run each test with a
31clean `STACK_ROOT`.
32
33## Helper scripts
34
35There are two helper scripts in this directory. Note that these may
36not always work as anticipated, since some of the tests expect a clean
37`STACK_ROOT`, and these scripts do not set that up.
38
39* `run-sort-tests.sh` will run all of the tests in the `tests`
40 directory, and move the successful ones into `tests-success`, and
41 the failing ones into `tests-fail`. It will keep the logs of failing
42 tests in `logs`.
43* `run-single-test.sh` takes a single argument (the name of a test),
44 and runs just that test.
45