Use grunt rather than explicit test runner for npm
Protect context-lookups from undefined values

Fixes #166, #587