code-coverage icon indicating copy to clipboard operation
code-coverage copied to clipboard

use-babelrc missing debug options to show source map

Open Vishwaas opened this issue 4 years ago • 0 comments

When we use on('file:preprocessor', require('@cypress/code-coverage/use-babelrc')) in the plugin/index.js file the source maps stop working. The source maps only show up if we have console.log in the tests. Inside use-babelrc, we can see that browserify.defaultOptions has debug as undefined, so setting

const browserify = require('@cypress/browserify-preprocessor')

const options = browserify.defaultOptions
options.browserifyOptions.transform[1][1].babelrc = true
//adding the below line shows source map or else source map comes up only if console.log is added to a test file
options.browserifyOptions.debug = true
module.exports = browserify(options)

Related issue: https://github.com/cypress-io/cypress-browserify-preprocessor/issues/88

Note: not using use-babelrc or not preprocessing i.e. not having the below line in plugin/index.js will show sourcemaps, enabling this line without adding .debug=true disables sourcemap on('file:preprocessor', require('@cypress/code-coverage/use-babelrc'))

Vishwaas avatar Jun 21 '21 04:06 Vishwaas