|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 2 weeks ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
1020 bytes
|
| Rev | Line | |
|---|
| [9af201e] | 1 | module.exports = class CovLine {
|
|---|
| 2 | constructor (line, startCol, lineStr) {
|
|---|
| 3 | this.line = line
|
|---|
| 4 | // note that startCol and endCol are absolute positions
|
|---|
| 5 | // within a file, not relative to the line.
|
|---|
| 6 | this.startCol = startCol
|
|---|
| 7 |
|
|---|
| 8 | // the line length itself does not include the newline characters,
|
|---|
| 9 | // these are however taken into account when enumerating absolute offset.
|
|---|
| 10 | const matchedNewLineChar = lineStr.match(/\r?\n$/u)
|
|---|
| 11 | const newLineLength = matchedNewLineChar ? matchedNewLineChar[0].length : 0
|
|---|
| 12 | this.endCol = startCol + lineStr.length - newLineLength
|
|---|
| 13 |
|
|---|
| 14 | // we start with all lines having been executed, and work
|
|---|
| 15 | // backwards zeroing out lines based on V8 output.
|
|---|
| 16 | this.count = 1
|
|---|
| 17 |
|
|---|
| 18 | // set by source.js during parsing, if /* c8 ignore next */ is found.
|
|---|
| 19 | this.ignore = false
|
|---|
| 20 | }
|
|---|
| 21 |
|
|---|
| 22 | toIstanbul () {
|
|---|
| 23 | return {
|
|---|
| 24 | start: {
|
|---|
| 25 | line: this.line,
|
|---|
| 26 | column: 0
|
|---|
| 27 | },
|
|---|
| 28 | end: {
|
|---|
| 29 | line: this.line,
|
|---|
| 30 | column: this.endCol - this.startCol
|
|---|
| 31 | }
|
|---|
| 32 | }
|
|---|
| 33 | }
|
|---|
| 34 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.