Add test runner script with proper checking

This commit is contained in:
Oskar Wickström 2017-10-04 08:02:08 +02:00
parent 740064f182
commit 948c6c163e
3 changed files with 35 additions and 4 deletions

View File

@ -46,6 +46,12 @@ If you have any issues or possible improvements please file them as
[GitHub Issues](https://github.com/owickstrom/purescript-spec-mocha/issues). [GitHub Issues](https://github.com/owickstrom/purescript-spec-mocha/issues).
Pull requests requests are encouraged. Pull requests requests are encouraged.
### Running Tests
This project's tests include some failures to test the Mocha
integration. Thus, use `run_tests.sh` instead of `pulp test` to check
that everything is all right.
## License ## License
[MIT License](LICENSE.md). [MIT License](LICENSE.md).

View File

@ -1,4 +0,0 @@
#!/bin/bash
pulp browserify -I test --main Test.Main > output/bundle.js
mocha output/bundle.js

29
run_tests.sh Executable file
View File

@ -0,0 +1,29 @@
#!/bin/bash
set -e
mkdir -p output
pulp browserify -I test --main Test.Main --to output/bundle.js
$(mocha output/bundle.js > output/test-output.txt) || echo "Checking test output..."
fail() {
echo -e "\nTests output:\n"
cat output/test-output.txt
exit 1
}
test_single() {
str="$1"
echo -n "${str}? "
if ! grep -q "$str" output/test-output.txt; then
echo "Nope."
fail
else
echo "Yes!"
fi
}
test_single "2 passing"
test_single "1 pending"
test_single "2 failing"