Skip to content

Commit

Permalink
Merge pull request Constellation#32 from claydotio/comments
Browse files Browse the repository at this point in the history
ignore blocks of code - fixes Constellation#27
  • Loading branch information
Constellation committed May 24, 2015
2 parents 9edabcc + eae104e commit 1452ee2
Show file tree
Hide file tree
Showing 81 changed files with 6,138 additions and 39 deletions.
18 changes: 9 additions & 9 deletions lib/command.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 13 additions & 13 deletions lib/cover.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/hook.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions lib/ibrik.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 15 additions & 11 deletions lib/instrumenter.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/report.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion src/instrumenter.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,13 @@ class Instrumenter extends istanbul.Instrumenter

try
code = coffee.compile code, sourceMap: true
program = esprima.parse(code.js, loc: true)
program = esprima.parse(code.js, {
loc: true
range: true
raw: true
tokens: true
comment: true
})
@fixupLoc program, code.sourceMap
@instrumentASTSync program, filename, code
catch e
Expand Down
2 changes: 2 additions & 0 deletions test/cover.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,5 @@ describe 'coverage', ->
it 'complicated', (done) ->
coverTest('test/fixture/third_party/StringScannerWithTest.coffee').then(done, done)

it 'ignore comment', (done) ->
coverTest('test/fixture/comment.coffee').then(done, done)
5 changes: 5 additions & 0 deletions test/fixture/comment.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cond = no
### istanbul ignore if ###
if cond
console.log('ng')
console.log('ok')
130 changes: 130 additions & 0 deletions test/fixture/comment.coffee.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
{
"test/fixture/comment.coffee":{
"path":"test/fixture/comment.coffee",
"s":{
"1":1,
"2":1,
"3":1,
"4":1,
"5":0,
"6":1
},
"b":{
"1":[
0,
1
]
},
"f":{
"1":1
},
"fnMap":{
"1":{
"name":"(anonymous_1)",
"line":1,
"loc":{
"start":{
"line":1,
"column":-15
},
"end":{
"line":1,
"column":-15
}
}
}
},
"statementMap":{
"1":{
"start":{
"line":1,
"column":-15
},
"end":{
"line":1,
"column":-15
}
},
"2":{
"start":{
"line":1,
"column":-15
},
"end":{
"line":1,
"column":-15
}
},
"3":{
"start":{
"line":1,
"column":-15
},
"end":{
"line":1,
"column":-15
}
},
"4":{
"start":{
"line":3,
"column":0
},
"end":{
"line":1,
"column":-15
}
},
"5":{
"skip":true,
"start":{
"line":4,
"column":4
},
"end":{
"line":3,
"column":0
}
},
"6":{
"start":{
"line":5,
"column":0
},
"end":{
"line":1,
"column":-15
}
}
},
"branchMap":{
"1":{
"line":3,
"type":"if",
"locations":[
{
"skip":true,
"start":{
"line":3,
"column":0
},
"end":{
"line":3,
"column":0
}
},
{
"start":{
"line":3,
"column":0
},
"end":{
"line":3,
"column":0
}
}
]
}
}
}
}
1 change: 1 addition & 0 deletions tmp/test/fixture/comment.coffee/coverage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"/home/zoli/Downloads/ibrik/test/fixture/comment.coffee":{"path":"/home/zoli/Downloads/ibrik/test/fixture/comment.coffee","s":{"1":1,"2":1,"3":1,"4":1,"5":0,"6":1},"b":{"1":[0,1]},"f":{"1":1},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":-15},"end":{"line":1,"column":-15}}}},"statementMap":{"1":{"start":{"line":1,"column":-15},"end":{"line":1,"column":-15}},"2":{"start":{"line":1,"column":-15},"end":{"line":1,"column":-15}},"3":{"start":{"line":1,"column":-15},"end":{"line":1,"column":-15}},"4":{"start":{"line":3,"column":0},"end":{"line":1,"column":-15}},"5":{"start":{"line":4,"column":4},"end":{"line":3,"column":0},"skip":true},"6":{"start":{"line":5,"column":0},"end":{"line":1,"column":-15}}},"branchMap":{"1":{"line":3,"type":"if","locations":[{"start":{"line":3,"column":0},"end":{"line":3,"column":0},"skip":true},{"start":{"line":3,"column":0},"end":{"line":3,"column":0}}]}}}}
Loading

0 comments on commit 1452ee2

Please sign in to comment.