CI: Simplify running JS unit tests on Sauce Labs

By doing `tee /dev/stderr` to print stuff to the console/CircleCI logs
in the middle of pipelines that manipulate it, and by using the CLI tool
`json` to read from JSON directly rather than `node -p require()...`.

(Though /dev/stderr etc isn't in POSIX, it's quite portable:
http://unix.stackexchange.com/a/36404 )

Also, use = not == in test because the latter is undocumented, and by
using `test` rather than `[ ... ]`, there's no need to quote it in YAML.
diff --git a/circle.yml b/circle.yml
index 5355a53..75576b2 100644
--- a/circle.yml
+++ b/circle.yml
@@ -128,7 +128,7 @@
                  "framework": "mocha",
                  "url": "http://localhost:8000/test/unit.html?post_xunit_to=http://localhost:9000",
                  "platforms": [["", "Chrome", ""]]
-      }' | tee js-tests
+      }' | tee /dev/stderr | tail -1 > js-tests.json
 
     # Wait for tests to finish:
     #
@@ -144,17 +144,16 @@
              -X POST \
              -u $SAUCE_USERNAME:$SAUCE_ACCESS_KEY \
              -H 'Content-Type: application/json' \
-             -d "$(tail -1 js-tests)" \
-        | tee status
-        tail -1 status > status.json
+             -d @js-tests.json \
+        | tee /dev/stderr | tail -1 > status.json
+
         # deliberately do `... != false` rather than `... == true`
         # because unexpected values should break rather than infinite loop
-        [ "$(node -p 'require("./status.json").completed')" != false ] && break
+        [ "$($json completed <status.json)" != false ] && break
       done
 
     # Complain to Circle CI if any unit tests failed
-    - |-
-      [ "$(node -p 'require("./status.json")["js tests"][0].result.failures')" == 0 ]
+    - test "$($json 'js tests'.0.result.failures <status.json)" = 0
 
     # Wait for screenshots to be ready
     - while [ ! -e ~/screenshots_are_ready ]; do sleep 1; done; test -z "$(<~/screenshots_are_ready)":