Istanbul instruments the code in a way that executing the function always breaks with error TypeError: Cannot destructure 'undefined' as it is undefined., for example:
// format is as emitted by babel-plugin-istanbul
const fn = ({ prop } = cov_3lpv0ilsj().b[0][0]++, {
})=>{
cov_3lpv0ilsj().f[3]++;
return prop;
};
The issue is clearly the default statement, which does not get properly wrapped in parens, for example this would work:
Given this example source code:
Istanbul instruments the code in a way that executing the function always breaks with error
TypeError: Cannot destructure 'undefined' as it is undefined.
, for example:The issue is clearly the default statement, which does not get properly wrapped in parens, for example this would work:
Also, if it helps, default values for properties in the destructure expression work just fine:
Environment
Config
.babelrc