scripts/karma: refactor