Closed gabriellupu closed 9 years ago
The actual problem was that UNIX prefers \n line ending style since Windows evaluates them as \r\n sometimes. The required update was to adapt a regex in preprocess.js from
/\n/g
to
/\r?\n/g
Check the pull request. Thanks !
PS: Tests are now passing on Linux and Windows as well now.
I think this can be closed since PR #47 has been merged in.
thanks @lupugabriel1
Sorry to have to re-open this, but I'm running into the same problem, but for an exclude test. I'm running a project that appears to end up passing a test string containing only a new line. I'm on Windows, so I think this is coming through as "\r\n". I'm not sure if something outside of preprocess.js is passing something it really shouldn't be, or if it's a result of the regex replacement that happens earlier in the script.
Either way, this blows up in getTestTemplate(). I was able to prevent it by adding a line at the top of testPasses() that contains: if( test && test.replace( /[\n\r\s]*/gi, '' ) == '' ) { test = '' }
. (Obviously, this is just saying "after replacing all spaces, cr, and lf, if we're left with an empty string, then set test to an empty string").
I don't understand everything going on in preprocess.js well enough to know if this is a truly viable fix, but for now it's what I'm using to stop it from failing.
Just checking to see if I should be opening a new issue for this?
I thought I had the same issue. It turned out I had a copy-paste issue with '// ifdef etc... -->' where I had left on an html tag on the end. It would be nice to have a little better logging info to find these types of syntax errors, as all it says is the aforementioned 'SyntaxError: Unexpected token )'. Hope this is helpful.
In preprocess.js the following method gets test = "%0D" (newline)
this is causing test to be evaluated as true because it's a newline, and the
breaks with "SyntaxError: Unexpected token )". This happens only under Windows (8.1 x64), on MAC it runs fine.
Full stack
Also, the following test is failing: