Better check for commonJS

Better check for commonJS, otherwise it also takes the QUnit module method, which causes a crash

This is the same check JQuery uses