diff --git a/README.md b/README.md index a7804af..3a127c1 100644 --- a/README.md +++ b/README.md @@ -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). 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 [MIT License](LICENSE.md). diff --git a/run-example-test.sh b/run-example-test.sh deleted file mode 100755 index fc98cbe..0000000 --- a/run-example-test.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -pulp browserify -I test --main Test.Main > output/bundle.js -mocha output/bundle.js diff --git a/run_tests.sh b/run_tests.sh new file mode 100755 index 0000000..b73c7d9 --- /dev/null +++ b/run_tests.sh @@ -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"