Remove implicit global declarations in Karma tests

Follows on from #2183. However, this PR is against **dev** as I did not deem buggy test codes to warrant a hotfix.