Add test-tap npm script to run tests and output TAP results to a
separate file.

Fixes #1946.