Remove bashisms from JS test runner

1. Stop using bash arrays.
2. Account for the sh-builtin `echo` not having an `-n`
   argument on BSDs.
3. Strip spaces from `wc -l` output when calculating the
   number of tests for 1.

Patch by Klaus Trainer & Jan Lehnardt.

Closes COUCHDB-1793.