|
| 1 | +// using browserify |
| 2 | +const browserify = require('@cypress/browserify-preprocessor') |
| 3 | + |
| 4 | +module.exports = (on, config) => { |
| 5 | + require('../../../../task')(on, config) |
| 6 | + |
| 7 | + const options = browserify.defaultOptions |
| 8 | + // options.browserifyOptions.transform[1][1].babelrc = true |
| 9 | + options.browserifyOptions.extensions.push('.ts') |
| 10 | + // options.browserifyOptions.transform.push([ |
| 11 | + // require.resolve('browserify-istanbul'), |
| 12 | + // {} |
| 13 | + // ]) |
| 14 | + options.typescript = require.resolve('typescript') |
| 15 | + // on('file:preprocessor', require('../../../../use-babelrc')) |
| 16 | + console.log('browserify options') |
| 17 | + console.log(JSON.stringify(options, null, 2)) |
| 18 | + |
| 19 | + on('file:preprocessor', browserify(options)) |
| 20 | + return config |
| 21 | +} |
| 22 | + |
| 23 | +// using webpack |
| 24 | +/// <reference types="cypress" /> |
| 25 | +// const webpack = require('@cypress/webpack-preprocessor') |
| 26 | + |
| 27 | +// /** |
| 28 | +// * @type {Cypress.PluginConfig} |
| 29 | +// */ |
| 30 | +// module.exports = (on, config) => { |
| 31 | +// const options = { |
| 32 | +// // use the same Webpack options to bundle spec files as your app does "normally" |
| 33 | +// // which should instrument the spec files in this project |
| 34 | +// webpackOptions: require('../../webpack.config'), |
| 35 | +// watchOptions: {} |
| 36 | +// } |
| 37 | +// on('file:preprocessor', webpack(options)) |
| 38 | + |
| 39 | +// require('../../../../task')(on, config) |
| 40 | +// return config |
| 41 | +// } |
0 commit comments