Fix for TypeError when running tests in require.js