This directory contains a bunch of integration tests for Stack. Each
directory inside the tests subdirectory represents a single
test. Each of those directories has:
- A
Main.hsfile, which provides the script to be run - A
filesdirectory, providing the working directory the script will be run from. (If you have a test that doesn't require any specific working directory, there may be nofilesdirectory.)
It would be great to expand this file into a full tutorial, but for now, the easiest way to get started with writing an integration test is to copy an existing example.
One simple way to run a single test is:
- Change into the
filesdirectory - Run the command
stack runghc -- -i../../../lib ../Main.hs
A more thorough way to run the tests is with
$ stack build --flag stack:integration-tests stack --interleaved-output --exec stack-integration-testNote that this command can take a long time. It's also more thorough
than the quick command given above, as it will run each test with a
clean STACK_ROOT.
There are two helper scripts in this directory. Note that these may
not always work as anticipated, since some of the tests expect a clean
STACK_ROOT, and these scripts do not set that up.
run-sort-tests.shwill run all of the tests in thetestsdirectory, and move the successful ones intotests-success, and the failing ones intotests-fail. It will keep the logs of failing tests inlogs.run-single-test.shtakes a single argument (the name of a test), and runs just that test.