Recently, I've started to use Karma as my JavaScript testing service. It works quite good, but everytime the tests are run, the results will be displayed in the terminal that has started the Karma Runner.
I would like to change the output location to the Unity notification (notify-send) but I don't know how to do this.
Also a test like echo 'hi' > notify-send is not working.
Thanks for your help in advance.


There are several ways you could do it. If you wanted everything in a single notification it would be as simple as:

notify-send "Summary" "$(command)"

Replacing command with echo "hello" or your karma command, or whatever.

You could also do one line per notification, if each test result were on a line, such as:

command | while read line; do notify-send "Summary" "$line"; done

Possibly with a sleep 1 in there to avoid flooding the notifications, although without some app to collect the notifications, that may be a bit difficult to follow. You could also use a similar command to collect together several lines before displaying the notification.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.