Coverage inserting LCOV causes a syntax error

100 views
Skip to first unread message

Ruben Oliveira

unread,
Mar 8, 2013, 10:40:49 AM3/8/13
to js-test...@googlegroups.com
What steps will reproduce the problem?
1. Please see the complete files in attachment

What is the expected output? What do you see instead?
I should not be getting this:

(...)
--tests all --verbose
line 239:9 mismatched input 'float' expecting Identifier
line 239:49 missing RPAREN at ';'
line 240:62 no viable alternative at input 'float'
line 246:5 mismatched input ')' expecting RBRACE
line 251:21 no viable alternative at input ':'
line 251:30 missing Identifier at '('
(...)
Chrome 25.0.1364.97 Windows: Run 70 tests (Passed: 69; Fails: 0; Errors 1) (130.00 ms) error loading file: /test/src/main/webapp/js/libs/filters/MetricRangeSlider.js:251: Uncaught SyntaxError: Unexpected token ; Firefox 12.0 Windows: Run 70 tests (Passed: 69; Fails: 0; Errors 1) (276.00 ms) error loading file: /test/src/main/webapp/js/libs/filters/MetricRangeSlider.js:251: missing } after property list Tests failed: Tests failed. See log for details. (...) What version of the product are you using? On what operating system? coverage 1.3.2 or coverage 1.3.5 Please provide any additional information below. The problem is in line (from attached files): updateDefaultPanel:LCOV_18h[251]++; function() { as you can see, LCOV_18h[251]++; is placed on the wrong place. I suppose it should be: updateDefaultPanel: function() { LCOV_18h[251]++;
While this lines:

line 239:9 mismatched input 'float' expecting Identifier line 239:49 missing RPAREN at ';' line 240:62 no viable alternative at input 'float' line 246:5 mismatched input ')' expecting RBRACE line 251:21 no viable alternative at input ':' line 251:30 missing Identifier at '('

may be related to coverage processing of external libs (like jquery) the error

error loading file: /test/src/main/webapp/js/libs/filters/MetricRangeSlider.js:251: Uncaught SyntaxError: Unexpected token ;
points directly to my file although its code is pretty straightforward...

Can this be a bug? Are there any workarounds?
MetricRangeSlider.js
MetricRangeSlider_LCOV.js

Nathan Redding

unread,
Mar 15, 2013, 3:18:03 PM3/15/13
to js-test...@googlegroups.com
I would suggest running your JavaScript through a tool such as JSHint. When I did so, one of the things it complained about near where the error is that you are getting is the use of a variable named 'float', which is a reserved word. It sounds like this could be what is throwing off the coverage generator.

Ruben Oliveira

unread,
Mar 18, 2013, 5:45:20 AM3/18/13
to js-test...@googlegroups.com
Thanks a lot Nathan!
It solved the problem.

Cory Smith

unread,
Mar 18, 2013, 1:06:06 PM3/18/13
to js-test...@googlegroups.com
So that actual issue is horrible messaging. Got it.
> --
> You received this message because you are subscribed to the Google Groups
> "JsTestDriver" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to js-test-drive...@googlegroups.com.
> To post to this group, send email to js-test...@googlegroups.com.
> Visit this group at http://groups.google.com/group/js-test-driver?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Ruben Oliveira

unread,
Mar 18, 2013, 2:12:34 PM3/18/13
to js-test...@googlegroups.com
It could be better, but if I've seen worst.
Reply all
Reply to author
Forward
0 new messages