-
Notifications
You must be signed in to change notification settings - Fork 146
Testing
homeshick comes with testsuites which ensure that the tool runs to spec after a feature was added or a refactor performed. It uses bats to run these suites and determine the outcome of the tests.
To run all tests, simply invoke the run
script in the test/
folder.
Individual test suites can be run by executing the files in the test/suites/
folder.
To run tests, only bats is required. On OSX it can be install through homebrew, though the bats install script makes it fairly easy to install on all platforms.
Additionally expect can be installed to test the interactive
prompts (these tests will be skipped if expect
cannot be found).
To run the tests in a stable manner, fixtures
are needed. In the context of homeshick, those fixtures are git repositories.
Each repository is created by a script of the same name in test/fixtures/
.
When developing for homeshick some form of manual testing is often needed to quickly confirm that
a feature behaves in a specific way. The test/interactive
script can be run to drop in to
a shell where $HOME
is set to a temporary folder.
homeshick will automatically be symlinked to point at the version in your git working copy
so that any changes can be tested quickly.
To drop into a preconfigured homefolder where the homeshick
function is defined and various
dotfiles exist, a setup.sh
file can be added to the test/
folder.
It will automatically be executed everytime an interactive environment is set up.
The GNU core utilities can be installed
via homebrew on OSX and also configured to override the built-in OSX utilities by modifying the $PATH
.
The run
and interactive
scripts automatically remove that override from $PATH
if it is detected,
in order to test homeshick with the built-in OSX utilities.
If you want to preserve the GNU coreutils path in your $PATH
while running tests or
using the test/interactive
script, you must set the environment variable
$HOMESHICK_KEEP_PATH
to true (export HOMESHICK_KEEP_PATH=true
).