taras42 / karma-jasmine-html-reporter

A Karma plugin. Dynamically displays tests results at debug.html page
MIT License
44 stars 17 forks source link

"Uncaught ReferenceError: jasmineRequire is not defined" on Windows #18

Closed protazy closed 8 years ago

protazy commented 8 years ago

Hi,

This is the same issue as described in #4, but the reason is different.

Fix #17 introduced a regex pattern which allows loading reporter files in correct order: var JASMINE_CORE_PATTERN = /(\/karma-jasmine\/)/i; But this pattern does not take into account using a Windows machine, where backward slashes are used as path separators. Since the regex does not match, files are added in wrong order and running tests fails with "Uncaught ReferenceError: jasmineRequire is not defined".

The easiest way to fix it would be to get rid of path separators entirely, or take into account both options: var JASMINE_CORE_PATTERN = /(karma-jasmine)/i; or var JASMINE_CORE_PATTERN = /([\\/]karma-jasmine[\\/])/i;

RussellChamp commented 8 years ago

This is a pain point for me as well as it's causing me to be unable to run my karma tests. I'm a fan of option 2

taras42 commented 8 years ago

Hello, I pushed the change. Thanks for the fix. Next time just make pull request.

damoqiongqiu commented 7 years ago

var JASMINE_CORE_PATTERN = /(karma-jasmine)/i;

@protazy This works on Windows, thank you.