Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coverage broken when using babel-jest #304

Closed
jehoshua02 opened this issue Mar 14, 2015 · 15 comments
Closed

Coverage broken when using babel-jest #304

jehoshua02 opened this issue Mar 14, 2015 · 15 comments

Comments

@jehoshua02
Copy link

The issue can reproduced by following these precise steps:

git clone https://github.com/jehoshua02/react-scaffold.git
cd react-scaffold
npm install
npm test -- --coverage

And I get this output:

~/projects/jehoshua02/react-scaffold 馃殌  babel_jest
$ npm test -- --coverage

> react-scaffold@1.0.0 test /Users/employee/projects/jehoshua02/react-scaffold
> jest --coverage

Using Jest CLI v0.4.0
 PASS  __tests__/sum-test.js (0.682s)
 PASS  __tests__/Hello.js (1.048s)
2 tests passed (2 total)
Run time: 1.971s
-----------------------|-----------|-----------|-----------|-----------|
File                   |   % Stmts |% Branches |   % Funcs |   % Lines |
-----------------------|-----------|-----------|-----------|-----------|
   app/components/     |       100 |       100 |       100 |       100 |
      Hello.js         |       100 |       100 |       100 |       100 |
   app/util/           |       100 |       100 |       100 |       100 |
      sum.js           |       100 |       100 |       100 |       100 |
   node_modules/react/ |       100 |       100 |       100 |       100 |
      addons.js        |       100 |       100 |       100 |       100 |
-----------------------|-----------|-----------|-----------|-----------|
All files              |       100 |       100 |       100 |       100 |
-----------------------|-----------|-----------|-----------|-----------|

Failed with unexpected error.

/Users/employee/projects/jehoshua02/react-scaffold/node_modules/jest-cli/src/jest.js:179
      throw error;
            ^
TypeError: Cannot set property 'covered' of undefined
  at /Users/employee/projects/jehoshua02/react-scaffold/node_modules/jest-cli/node_modules/istanbul/lib/report/html.js:175:66
  at Array.forEach (native)
  at annotateLines (/Users/employee/projects/jehoshua02/react-scaffold/node_modules/jest-cli/node_modules/istanbul/lib/report/html.js:173:28)
  at HtmlReport.Report.mix.writeDetailPage (/Users/employee/projects/jehoshua02/react-scaffold/node_modules/jest-cli/node_modules/istanbul/lib/report/html.js:406:9)
  at /Users/employee/projects/jehoshua02/react-scaffold/node_modules/jest-cli/node_modules/istanbul/lib/report/html.js:472:26
  at SyncFileWriter.extend.writeFile (/Users/employee/projects/jehoshua02/react-scaffold/node_modules/jest-cli/node_modules/istanbul/lib/util/file-writer.js:57:9)
  at FileWriter.extend.writeFile (/Users/employee/projects/jehoshua02/react-scaffold/node_modules/jest-cli/node_modules/istanbul/lib/util/file-writer.js:147:23)
  at /Users/employee/projects/jehoshua02/react-scaffold/node_modules/jest-cli/node_modules/istanbul/lib/report/html.js:471:24
  at Array.forEach (native)
  at HtmlReport.Report.mix.writeFiles (/Users/employee/projects/jehoshua02/react-scaffold/node_modules/jest-cli/node_modules/istanbul/lib/report/html.js:465:23)
  at /Users/employee/projects/jehoshua02/react-scaffold/node_modules/jest-cli/node_modules/istanbul/lib/report/html.js:467:22
  at Array.forEach (native)
  at HtmlReport.Report.mix.writeFiles (/Users/employee/projects/jehoshua02/react-scaffold/node_modules/jest-cli/node_modules/istanbul/lib/report/html.js:465:23)
  at HtmlReport.Report.mix.writeReport (/Users/employee/projects/jehoshua02/react-scaffold/node_modules/jest-cli/node_modules/istanbul/lib/report/html.js:549:14)
  at LcovReport.Report.mix.writeReport (/Users/employee/projects/jehoshua02/react-scaffold/node_modules/jest-cli/node_modules/istanbul/lib/report/lcov.js:55:19)
  at /Users/employee/projects/jehoshua02/react-scaffold/node_modules/jest-cli/node_modules/istanbul/lib/reporter.js:93:20
  at Array.forEach (native)
  at Object.Reporter.write (/Users/employee/projects/jehoshua02/react-scaffold/node_modules/jest-cli/node_modules/istanbul/lib/reporter.js:87:30)
  at DefaultTestReporter.IstanbulTestReporter.onRunComplete (/Users/employee/projects/jehoshua02/react-scaffold/node_modules/jest-cli/src/IstanbulTestReporter.js:33:14)
  at /Users/employee/projects/jehoshua02/react-scaffold/node_modules/jest-cli/src/TestRunner.js:453:40
  at _fulfilled (/Users/employee/projects/jehoshua02/react-scaffold/node_modules/jest-cli/node_modules/q/q.js:798:54)
  at self.promiseDispatch.done (/Users/employee/projects/jehoshua02/react-scaffold/node_modules/jest-cli/node_modules/q/q.js:827:30)
  at Promise.promise.promiseDispatch (/Users/employee/projects/jehoshua02/react-scaffold/node_modules/jest-cli/node_modules/q/q.js:760:13)
  at /Users/employee/projects/jehoshua02/react-scaffold/node_modules/jest-cli/node_modules/q/q.js:574:44
  at flush (/Users/employee/projects/jehoshua02/react-scaffold/node_modules/jest-cli/node_modules/q/q.js:108:17)
  at process._tickCallback (node.js:442:13)

npm ERR! Test failed.  See above for more details.

As you can see, the tests run fine, and pass, the coverage is output to the console (which is all I really want), but something after that, I'm assuming when writing out reports to the disk, is failing and generating a big ugly error.

Issue also reported over at babel-jest.

@garetht
Copy link

garetht commented Mar 15, 2015

@jehoshua02 I encountered this issue too when using babel-jest, but I think the problem is more general, in that any time the postprocessed file has more lines than the source file this error will be produced (if it has fewer I assume the coverage report will simply be incorrect). I tried this with the CoffeeScript example off the jest repo and got the same error. I'm wondering if it might be helpful to rephrase the issue?

@DaleLJefferson
Copy link

Same issue here, is there a workaround?

> jest --coverage

Using Jest CLI v0.4.0
 PASS  src/common/__tests__/Store-test.js (0.971s)
1 test passed (1 total)
Run time: 1.233s
---------------|-----------|-----------|-----------|-----------|
File           |   % Stmts |% Branches |   % Funcs |   % Lines |
---------------|-----------|-----------|-----------|-----------|
   common/     |        85 |        60 |        70 |     84.21 |
      Store.js |        85 |        60 |        70 |     84.21 |
---------------|-----------|-----------|-----------|-----------|
All files      |        85 |        60 |        70 |     84.21 |
---------------|-----------|-----------|-----------|-----------|

Failed with unexpected error.

/Users/dale/Development/AgileDashboard/node_modules/jest-cli/src/jest.js:179
      throw error;
            ^
TypeError: Cannot set property 'covered' of undefined
  at /Users/dale/Development/AgileDashboard/node_modules/jest-cli/node_modules/istanbul/lib/report/html.js:174:66
  at Array.forEach (native)
  at annotateLines (/Users/dale/Development/AgileDashboard/node_modules/jest-cli/node_modules/istanbul/lib/report/html.js:172:28)
  at HtmlReport.Report.mix.writeDetailPage (/Users/dale/Development/AgileDashboard/node_modules/jest-cli/node_modules/istanbul/lib/report/html.js:406:9)
  at /Users/dale/Development/AgileDashboard/node_modules/jest-cli/node_modules/istanbul/lib/report/html.js:472:26
  at SyncFileWriter.extend.writeFile (/Users/dale/Development/AgileDashboard/node_modules/jest-cli/node_modules/istanbul/lib/util/file-writer.js:57:9)
  at FileWriter.extend.writeFile (/Users/dale/Development/AgileDashboard/node_modules/jest-cli/node_modules/istanbul/lib/util/file-writer.js:147:23)
  at /Users/dale/Development/AgileDashboard/node_modules/jest-cli/node_modules/istanbul/lib/report/html.js:471:24
  at Array.forEach (native)
  at HtmlReport.Report.mix.writeFiles (/Users/dale/Development/AgileDashboard/node_modules/jest-cli/node_modules/istanbul/lib/report/html.js:465:23)
  at /Users/dale/Development/AgileDashboard/node_modules/jest-cli/node_modules/istanbul/lib/report/html.js:467:22
  at Array.forEach (native)
  at HtmlReport.Report.mix.writeFiles (/Users/dale/Development/AgileDashboard/node_modules/jest-cli/node_modules/istanbul/lib/report/html.js:465:23)
  at HtmlReport.Report.mix.writeReport (/Users/dale/Development/AgileDashboard/node_modules/jest-cli/node_modules/istanbul/lib/report/html.js:549:14)
  at LcovReport.Report.mix.writeReport (/Users/dale/Development/AgileDashboard/node_modules/jest-cli/node_modules/istanbul/lib/report/lcov.js:55:19)
  at /Users/dale/Development/AgileDashboard/node_modules/jest-cli/node_modules/istanbul/lib/reporter.js:93:20
  at Array.forEach (native)
  at Object.Reporter.write (/Users/dale/Development/AgileDashboard/node_modules/jest-cli/node_modules/istanbul/lib/reporter.js:87:30)
  at DefaultTestReporter.IstanbulTestReporter.onRunComplete (/Users/dale/Development/AgileDashboard/node_modules/jest-cli/src/IstanbulTestReporter.js:33:14)
  at /Users/dale/Development/AgileDashboard/node_modules/jest-cli/src/TestRunner.js:453:40
  at _fulfilled (/Users/dale/Development/AgileDashboard/node_modules/jest-cli/node_modules/q/q.js:798:54)
  at self.promiseDispatch.done (/Users/dale/Development/AgileDashboard/node_modules/jest-cli/node_modules/q/q.js:827:30)
  at Promise.promise.promiseDispatch (/Users/dale/Development/AgileDashboard/node_modules/jest-cli/node_modules/q/q.js:760:13)
  at /Users/dale/Development/AgileDashboard/node_modules/jest-cli/node_modules/q/q.js:574:44
  at flush (/Users/dale/Development/AgileDashboard/node_modules/jest-cli/node_modules/q/q.js:108:17)
  at /Users/dale/Development/AgileDashboard/node_modules/jest-cli/src/lib/FakeTimers.js:325:7
  at process._tickCallback (node.js:442:13)

npm ERR! Test failed.  See above for more details.

@wyuenho
Copy link

wyuenho commented Apr 11, 2015

Any ideas how to solve this issue that I can try?

@ericwooley
Copy link

Im running into this also, so close to working!

@ericwooley
Copy link

The problem is in the istanbul package in report/html.js, there appears to be an some sort of error where the report is expecting another line and there is none. I changed the function to

function annotateLines(fileCoverage, structuredText) {
    var lineStats = fileCoverage.l;

    if (!lineStats) { return; }
    Object.keys(lineStats).forEach(function (lineNumber) {
        var count = lineStats[lineNumber];
        if(!structuredText[lineNumber]){
            console.log(lineNumber, 'does not exist in', structuredText);
        }
        structuredText[lineNumber].covered = count > 0 ? 'yes' : 'no';
    });
    structuredText.forEach(function (item) {
        if (item.covered === null) {
            item.covered = 'neutral';
        }
    });
}

and got

81 does not exist in [ { line: 0,
    covered: null,
    text:
     { text: '',
       origLength: 0,
       offsets: [],
       consumeBlanks: undefined,
       startPos: -1,
       endPos: 1 } },
  { line: 1,
    covered: null,
    text:
     { text: '',
       origLength: 0,
       offsets: [],
       consumeBlanks: true,
       startPos: -1,
       endPos: 1 } },
  { line: 2,
    covered: null,
    text:
     { text: 'import autoprefixer from \'autoprefixer-core\';',
       origLength: 45,
       offsets: [],
       consumeBlanks: true,
       startPos: 0,
       endPos: 44 } },
  { line: 3,
    covered: 'yes',
    text:
     { text: 'let defaultAddOptions = {',
       origLength: 25,
       offsets: [],
       consumeBlanks: true,
       startPos: 0,
       endPos: 24 } },
  { line: 4,
    covered: null,
    text:
     { text: '    noWarnings: false,',
       origLength: 22,
       offsets: [],
       consumeBlanks: true,
       startPos: 4,
       endPos: 21 } },
  { line: 5,
    covered: 'yes',
    text:
     { text: '    prefix:false',
       origLength: 16,
       offsets: [],
       consumeBlanks: true,
       startPos: 4,
       endPos: 15 } },
  { line: 6,
    covered: null,
    text:
     { text: '};',
       origLength: 2,
       offsets: [],
       consumeBlanks: true,
       startPos: 0,
       endPos: 1 } },
  { line: 7,
    covered: 'yes',
    text:
     { text: 'function toKebab(str){',
       origLength: 22,
       offsets: [],
       consumeBlanks: true,
       startPos: 0,
       endPos: 21 } },
  { line: 8,
    covered: null,
    text:
     { text: '    str = str.replace(/([A-Z])/g, \'-$1\').toLowerCase();',
       origLength: 55,
       offsets: [],
       consumeBlanks: true,
       startPos: 4,
       endPos: 54 } },
  { line: 9,
    covered: 'yes',
    text:
     { text: '    return str;',
       origLength: 15,
       offsets: [],
       consumeBlanks: true,
       startPos: 4,
       endPos: 14 } },
  { line: 10,
    covered: null,
    text:
     { text: '}',
       origLength: 1,
       offsets: [],
       consumeBlanks: true,
       startPos: 0,
       endPos: 0 } },
  { line: 11,
    covered: null,
    text:
     { text: 'class ReactInStyle {',
       origLength: 20,
       offsets: [],
       consumeBlanks: true,
       startPos: 0,
       endPos: 19 } },
  { line: 12,
    covered: null,
    text:
     { text: '    constructor(options) {',
       origLength: 26,
       offsets: [],
       consumeBlanks: true,
       startPos: 4,
       endPos: 25 } },
  { line: 13,
    covered: 'yes',
    text:
     { text: '        this.setOptions(options);',
       origLength: 33,
       offsets: [],
       consumeBlanks: true,
       startPos: 8,
       endPos: 32 } },
  { line: 14,
    covered: null,
    text:
     { text: '        this.init();',
       origLength: 20,
       offsets: [],
       consumeBlanks: true,
       startPos: 8,
       endPos: 19 } },
  { line: 15,
    covered: 'yes',
    text:
     { text: '    }',
       origLength: 5,
       offsets: [],
       consumeBlanks: true,
       startPos: 4,
       endPos: 4 } },
  { line: 16,
    covered: null,
    text:
     { text: '    setOptions(options) {',
       origLength: 25,
       offsets: [],
       consumeBlanks: true,
       startPos: 4,
       endPos: 24 } },
  { line: 17,
    covered: 'yes',
    text:
     { text: '        options = options || {};',
       origLength: 32,
       offsets: [],
       consumeBlanks: true,
       startPos: 8,
       endPos: 31 } },
  { line: 18,
    covered: null,
    text:
     { text: '        this.options = options;',
       origLength: 31,
       offsets: [],
       consumeBlanks: true,
       startPos: 8,
       endPos: 30 } },
  { line: 19,
    covered: null,
    text:
     { text: '    }',
       origLength: 5,
       offsets: [],
       consumeBlanks: true,
       startPos: 4,
       endPos: 4 } },
  { line: 20,
    covered: null,
    text:
     { text: '    init() {',
       origLength: 12,
       offsets: [],
       consumeBlanks: true,
       startPos: 4,
       endPos: 11 } },
  { line: 21,
    covered: 'yes',
    text:
     { text: '        this.unApliedStyles = {};',
       origLength: 33,
       offsets: [],
       consumeBlanks: true,
       startPos: 8,
       endPos: 32 } },
  { line: 22,
    covered: 'yes',
    text:
     { text: '        this.appliedStyles = {};',
       origLength: 32,
       offsets: [],
       consumeBlanks: true,
       startPos: 8,
       endPos: 31 } },
  { line: 23,
    covered: 'yes',
    text:
     { text: '        this.initStyleTag();',
       origLength: 28,
       offsets: [],
       consumeBlanks: true,
       startPos: 8,
       endPos: 27 } },
  { line: 24,
    covered: null,
    text:
     { text: '    }',
       origLength: 5,
       offsets: [],
       consumeBlanks: true,
       startPos: 4,
       endPos: 4 } },
  { line: 25,
    covered: null,
    text:
     { text: '    destroy() {',
       origLength: 15,
       offsets: [],
       consumeBlanks: true,
       startPos: 4,
       endPos: 14 } },
  { line: 26,
    covered: 'yes',
    text:
     { text: '        if (this.styleTag.parentNode) {',
       origLength: 39,
       offsets: [],
       consumeBlanks: true,
       startPos: 8,
       endPos: 38 } },
  { line: 27,
    covered: 'yes',
    text:
     { text: '            this.styleTag.parentNode.removeChild(this.styleTag);',
       origLength: 64,
       offsets: [],
       consumeBlanks: true,
       startPos: 12,
       endPos: 63 } },
  { line: 28,
    covered: 'yes',
    text:
     { text: '        }',
       origLength: 9,
       offsets: [],
       consumeBlanks: true,
       startPos: 8,
       endPos: 8 } },
  { line: 29,
    covered: null,
    text:
     { text: '        this.init();',
       origLength: 20,
       offsets: [],
       consumeBlanks: true,
       startPos: 8,
       endPos: 19 } },
  { line: 30,
    covered: 'yes',
    text:
     { text: '    }',
       origLength: 5,
       offsets: [],
       consumeBlanks: true,
       startPos: 4,
       endPos: 4 } },
  { line: 31,
    covered: 'yes',
    text:
     { text: '    initStyleTag() {',
       origLength: 20,
       offsets: [],
       consumeBlanks: true,
       startPos: 4,
       endPos: 19 } },
  { line: 32,
    covered: null,
    text:
     { text: '        this.styleTag = document.createElement(\'style\');',
       origLength: 56,
       offsets: [],
       consumeBlanks: true,
       startPos: 8,
       endPos: 55 } },
  { line: 33,
    covered: null,
    text:
     { text: '        this.styleTag.id = \'react-in-style\';',
       origLength: 44,
       offsets: [],
       consumeBlanks: true,
       startPos: 8,
       endPos: 43 } },
  { line: 34,
    covered: 'yes',
    text:
     { text: '        document.getElementsByTagName(\'head\')[0].appendChild(this.styleTag);',
       origLength: 76,
       offsets: [],
       consumeBlanks: true,
       startPos: 8,
       endPos: 75 } },
  { line: 35,
    covered: null,
    text:
     { text: '    }',
       origLength: 5,
       offsets: [],
       consumeBlanks: true,
       startPos: 4,
       endPos: 4 } },
  { line: 36,
    covered: null,
    text:
     { text: '    add(reactClass, selector, options = defaultAddOptions) {',
       origLength: 60,
       offsets: [],
       consumeBlanks: true,
       startPos: 4,
       endPos: 59 } },
  { line: 37,
    covered: 'yes',
    text:
     { text: '        this.unApliedStyles[selector] = reactClass.prototype.style;',
       origLength: 67,
       offsets: [],
       consumeBlanks: true,
       startPos: 8,
       endPos: 66 } },
  { line: 38,
    covered: 'yes',
    text:
     { text: '        this.renderStyles(options);       ',
       origLength: 42,
       offsets: [],
       consumeBlanks: true,
       startPos: 8,
       endPos: 34 } },
  { line: 39,
    covered: null,
    text:
     { text: '    }',
       origLength: 5,
       offsets: [],
       consumeBlanks: true,
       startPos: 4,
       endPos: 4 } },
  { line: 40,
    covered: null,
    text:
     { text: '    renderStyles(options) {',
       origLength: 27,
       offsets: [],
       consumeBlanks: true,
       startPos: 4,
       endPos: 26 } },
  { line: 41,
    covered: null,
    text:
     { text: '        Object.keys(this.unApliedStyles).forEach((selector) => {',
       origLength: 64,
       offsets: [],
       consumeBlanks: true,
       startPos: 8,
       endPos: 63 } },
  { line: 42,
    covered: null,
    text:
     { text: '            var style = this.unApliedStyles[selector];',
       origLength: 54,
       offsets: [],
       consumeBlanks: true,
       startPos: 12,
       endPos: 53 } },
  { line: 43,
    covered: 'yes',
    text:
     { text: '            delete this.unApliedStyles[selector];',
       origLength: 49,
       offsets: [],
       consumeBlanks: true,
       startPos: 12,
       endPos: 48 } },
  { line: 44,
    covered: 'yes',
    text:
     { text: '            this.appliedStyles[selector] = style;',
       origLength: 49,
       offsets: [],
       consumeBlanks: true,
       startPos: 12,
       endPos: 48 } },
  { line: 45,
    covered: 'yes',
    text:
     { text: '            var styleString = this.objToCss(style, selector);',
       origLength: 61,
       offsets: [],
       consumeBlanks: true,
       startPos: 12,
       endPos: 60 } },
  { line: 46,
    covered: null,
    text:
     { text: '            if(options.prefix){',
       origLength: 31,
       offsets: [],
       consumeBlanks: true,
       startPos: 12,
       endPos: 30 } },
  { line: 47,
    covered: null,
    text:
     { text: '                styleString = autoprefixer.process(styleString).css;',
       origLength: 68,
       offsets: [],
       consumeBlanks: true,
       startPos: 16,
       endPos: 67 } },
  { line: 48,
    covered: null,
    text:
     { text: '            }',
       origLength: 13,
       offsets: [],
       consumeBlanks: true,
       startPos: 12,
       endPos: 12 } },
  { line: 49,
    covered: null,
    text:
     { text: '            this.styleTag.innerHTML += styleString + \'\\n\';',
       origLength: 58,
       offsets: [],
       consumeBlanks: true,
       startPos: 12,
       endPos: 57 } },
  { line: 50,
    covered: 'yes',
    text:
     { text: '        });',
       origLength: 11,
       offsets: [],
       consumeBlanks: true,
       startPos: 8,
       endPos: 10 } },
  { line: 51,
    covered: 'yes',
    text:
     { text: '    }',
       origLength: 5,
       offsets: [],
       consumeBlanks: true,
       startPos: 4,
       endPos: 4 } },
  { line: 52,
    covered: null,
    text:
     { text: '',
       origLength: 0,
       offsets: [],
       consumeBlanks: true,
       startPos: -1,
       endPos: 1 } },
  { line: 53,
    covered: 'yes',
    text:
     { text: '    objToCss(style, rootSelector = \'\', styles = []) {',
       origLength: 53,
       offsets: [],
       consumeBlanks: true,
       startPos: 4,
       endPos: 52 } },
  { line: 54,
    covered: null,
    text:
     { text: '        var rootStyle = \'\';',
       origLength: 27,
       offsets: [],
       consumeBlanks: true,
       startPos: 8,
       endPos: 26 } },
  { line: 55,
    covered: null,
    text:
     { text: '        Object.keys(style).forEach((key) => {',
       origLength: 45,
       offsets: [],
       consumeBlanks: true,
       startPos: 8,
       endPos: 44 } },
  { line: 56,
    covered: null,
    text:
     { text: '            let spacer = \' \',',
       origLength: 29,
       offsets: [],
       consumeBlanks: true,
       startPos: 12,
       endPos: 28 } },
  { line: 57,
    covered: null,
    text:
     { text: '            firstLetter = key[0], ',
       origLength: 34,
       offsets: [],
       consumeBlanks: true,
       startPos: 12,
       endPos: 32 } },
  { line: 58,
    covered: 'yes',
    text:
     { text: '            selector = key;',
       origLength: 27,
       offsets: [],
       consumeBlanks: true,
       startPos: 12,
       endPos: 26 } },
  { line: 59,
    covered: 'yes',
    text:
     { text: '',
       origLength: 0,
       offsets: [],
       consumeBlanks: true,
       startPos: -1,
       endPos: 1 } },
  { line: 60,
    covered: 'yes',
    text:
     { text: '            if (firstLetter === \'&\') {',
       origLength: 38,
       offsets: [],
       consumeBlanks: true,
       startPos: 12,
       endPos: 37 } },
  { line: 61,
    covered: null,
    text:
     { text: '                spacer = \'\';',
       origLength: 28,
       offsets: [],
       consumeBlanks: true,
       startPos: 16,
       endPos: 27 } },
  { line: 62,
    covered: null,
    text:
     { text: '                selector = key.substring(1);',
       origLength: 44,
       offsets: [],
       consumeBlanks: true,
       startPos: 16,
       endPos: 43 } },
  { line: 63,
    covered: null,
    text:
     { text: '            } ',
       origLength: 14,
       offsets: [],
       consumeBlanks: true,
       startPos: 12,
       endPos: 12 } },
  { line: 64,
    covered: null,
    text:
     { text: '            selector = selector.replace(/&/g, rootSelector);',
       origLength: 60,
       offsets: [],
       consumeBlanks: true,
       startPos: 12,
       endPos: 59 } },
  { line: 65,
    covered: 'yes',
    text:
     { text: '            if (typeof style[key] !== \'object\') {',
       origLength: 49,
       offsets: [],
       consumeBlanks: true,
       startPos: 12,
       endPos: 48 } },
  { line: 66,
    covered: null,
    text:
     { text: '                rootStyle += toKebab(key) + \':\' + style[key] + \'; \';',
       origLength: 68,
       offsets: [],
       consumeBlanks: true,
       startPos: 16,
       endPos: 67 } },
  { line: 67,
    covered: 'yes',
    text:
     { text: '            } else {',
       origLength: 20,
       offsets: [],
       consumeBlanks: true,
       startPos: 12,
       endPos: 19 } },
  { line: 68,
    covered: 'yes',
    text:
     { text: '                if (firstLetter === \':\') {',
       origLength: 42,
       offsets: [],
       consumeBlanks: true,
       startPos: 16,
       endPos: 41 } },
  { line: 69,
    covered: null,
    text:
     { text: '                    spacer = \'\';',
       origLength: 32,
       offsets: [],
       consumeBlanks: true,
       startPos: 20,
       endPos: 31 } },
  { line: 70,
    covered: null,
    text:
     { text: '                }',
       origLength: 17,
       offsets: [],
       consumeBlanks: true,
       startPos: 16,
       endPos: 16 } },
  { line: 71,
    covered: null,
    text:
     { text: '                var newKey = rootSelector + spacer + selector;',
       origLength: 62,
       offsets: [],
       consumeBlanks: true,
       startPos: 16,
       endPos: 61 } },
  { line: 72,
    covered: null,
    text:
     { text: '                this.objToCss(style[key], newKey, styles);',
       origLength: 58,
       offsets: [],
       consumeBlanks: true,
       startPos: 16,
       endPos: 57 } },
  { line: 73,
    covered: 'yes',
    text:
     { text: '            }',
       origLength: 13,
       offsets: [],
       consumeBlanks: true,
       startPos: 12,
       endPos: 12 } },
  { line: 74,
    covered: null,
    text:
     { text: '        });',
       origLength: 11,
       offsets: [],
       consumeBlanks: true,
       startPos: 8,
       endPos: 10 } },
  { line: 75,
    covered: 'yes',
    text:
     { text: '        styles.unshift(rootSelector.trim() + \'{\' + rootStyle.trim() + \'}\');',
       origLength: 75,
       offsets: [],
       consumeBlanks: true,
       startPos: 8,
       endPos: 74 } },
  { line: 76,
    covered: 'yes',
    text:
     { text: '        return styles.join(\'\\n\');',
       origLength: 33,
       offsets: [],
       consumeBlanks: true,
       startPos: 8,
       endPos: 32 } },
  { line: 77,
    covered: 'yes',
    text:
     { text: '    }',
       origLength: 5,
       offsets: [],
       consumeBlanks: true,
       startPos: 4,
       endPos: 4 } },
  { line: 78,
    covered: 'yes',
    text:
     { text: '}',
       origLength: 1,
       offsets: [],
       consumeBlanks: true,
       startPos: 0,
       endPos: 0 } },
  { line: 79,
    covered: 'yes',
    text:
     { text: 'export default new ReactInStyle();',
       origLength: 34,
       offsets: [],
       consumeBlanks: true,
       startPos: 0,
       endPos: 33 } },
  { line: 80,
    covered: 'yes',
    text:
     { text: '',
       origLength: 0,
       offsets: [],
       consumeBlanks: true,
       startPos: -1,
       endPos: 1 } } ]

I think it is some kind of mapping error by babel, telling istanbul there is one more line then there should be? Not really sure though. Hopefully this can help someone with a little experience with these libraries.

@codyhatch
Copy link

Is there any progress on this?

@ericwooley
Copy link

I updated the versions and it seems to be working now. You can see how I am using it here https://github.com/ericwooley/react-in-style

@crestenstclair
Copy link

I'm still seeing this problem, on node v0.10.38

@screendriver
Copy link
Contributor

Same here

@danielstern
Copy link

I'm experiencing this issue with Node v4.0.0 and Jest v0.5.2 with babel-jest 2.14.2

@koddsson
Copy link

Working for me on babel-jest: ^5.3.0, jest-cli: ^0.5.7 and node v4.1.0.

@quantizor
Copy link
Contributor

Not working for me on babel-jest: ^6.0.1, jest-cli: ^0.8.0 and node v5.1.0

@cpojer
Copy link
Member

cpojer commented Feb 17, 2016

I'd like to fix this if it is still causing trouble for people. Can someone provide me a proper repro against jest 0.8 or 0.9?

@cpojer
Copy link
Member

cpojer commented Mar 11, 2016

This will be fixed in 0.9.2 tomorrow. #785 and #787.

@cpojer cpojer closed this as completed Mar 11, 2016
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests