Fix commonjs / qunit collision

qunit and commonjs both define global 'module' object. Seems a common resolution is to determine the existence of commonjs by testing if module and module.exports exists.