Fix ReferenceError in js tests

The issue with #6542 is that the variable IPython isn't defined yet, so a ReferenceError gets raised. This pull request makes sure it's actually defined using `typeof`, which makes these errors go away.