Cannot read property 'start' of undefined
TypeError: Cannot read property 'start' of undefined
at /Users/david/Projects/abc-environment/node_modules/nyc/node_modules/istanbul-reports/lib/html/annotator.js:137:32
at Array.forEach (native)
at annotateBranches (/Users/david/Projects/abc-environment/node_modules/nyc/node_modules/istanbul-reports/lib/html/annotator.js:112:30)
at Object.annotateSourceCode (/Users/david/Projects/abc-environment/node_modules/nyc/node_modules/istanbul-reports/lib/html/annotator.js:191:9)
at HtmlReport.onDetail (/Users/david/Projects/abc-environment/node_modules/nyc/node_modules/istanbul-reports/lib/html/index.js:217:39)
at LcovReport.(anonymous function) [as onDetail] (/Users/david/Projects/abc-environment/node_modules/nyc/node_modules/istanbul-reports/lib/lcov/index.js:24:24)
at Visitor.(anonymous function) [as onDetail] (/Users/david/Projects/abc-environment/node_modules/nyc/node_modules/istanbul-lib-report/lib/tree.js:34:30)
at ReportNode.Node.visit (/Users/david/Projects/abc-environment/node_modules/nyc/node_modules/istanbul-lib-report/lib/tree.js:123:17)
at /Users/david/Projects/abc-environment/node_modules/nyc/node_modules/istanbul-lib-report/lib/tree.js:116:23
at Array.forEach (native)
- The CLI command runs through without error
- The error message is present in the HTML output (see @BenoitAverty comment here)
- This error only seems to happen when you are using the default function parameters from ES2015 and comparing something with
if afterwards. When using one of the two, it's working fine.
- The error does not happen when ran on the pre-generated code (from babel)
- The error happens in all versions of
babel-plugin-rewire, starting from 1.0.0-beta-1 up to 1.0.0
- The error does not happen when
rewire is removed from the .babelrc, so it seems to be an issue with this library
- The full dependency list can be seen here
This is a minimal reproduction test case, which yields the HTML error.
// module
const answer = 42
export default function (something, punctuation = '!') {
if (something === 'test') {
console.log('Testing something.')
}
return answer + punctuation
}
// Test
import {expect} from 'chai'
import module from './module.js'
describe('my module', () => {
it('should return the answer to life', async () => {
let result = await module('hello')
expect(result).to.equal('42!')
})
it('should return the answer to life', async () => {
let result = await module('test', '?')
expect(result).to.equal('42?')
})
})
ifafterwards. When using one of the two, it's working fine.babel-plugin-rewire, starting from1.0.0-beta-1up to1.0.0rewireis removed from the.babelrc, so it seems to be an issue with this libraryThis is a minimal reproduction test case, which yields the HTML error.