Add helper for JS tests

The PR compliment to #2581