Last active
February 2, 2016 13:35
-
-
Save anderssonjohan/1f8574844fbdd18c6431 to your computer and use it in GitHub Desktop.
Hack to send xUnit test result to the OSX notification center when having a running karma-osx-reporter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Use this to hijack the karma-osx-reporter web service listening to localhost:1337 to send | |
# xUnit result to the OSX notification center. | |
# See https://github.com/petrbela/karma-osx-reporter for output. | |
# | |
# Usage: ./report-osx-notifier.sh <path to xunit report.xml> | |
# | |
message=`grep "assembly" $1 | sed -e 's/[=\"]/ /g' | tr -s ' ' | grep -o "total[^>]*"` | |
method="pass" | |
if [ -z "$(echo $message | grep 'failed 0')" ]; then | |
method="fail" | |
fi | |
url="http://localhost:1337/$method?title=xUnit&message=$message" | |
url="${url// /%20}" | |
curl -s "$url" > /dev/null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"scripts": { | |
"api-test:watch": "cd api && cross-env ASPNET_ENV=Development dnx-watch test", // dnx command in api/project.json: "test": "xunit.runner.dnx -xml report.xml" | |
"api-test:osxnotify": "chokidar api/report.xml -c './api/report-osx-notifier.sh ./api/report.xml'", | |
"brunch-test:watch": "cd brunch && npm run karma", | |
"test:watch": "concurrent --kill-others -p command \"npm run api-test:watch\" \"npm run brunch-test:watch\" \"npm run api-test:osxnotify\"", | |
"test": "npm run api-test && npm run brunch-test", | |
}, | |
"devDependencies": { | |
"chokidar-cli": "^1.2.0", | |
"concurrently": "^1.0.0", | |
"cross-env": "^1.0.7" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment