refactored to minimise number of npm installs needed to run tests