cypress-babel-esx-preprocessor
Cypress plugin to allow you to use all proposals to the JavaScript language at Proposal stage or above by using babel-preset-stage-1 as well as all JavaScript that has been finalised in the ECMA standard by using babel-preset-env
This uses Cypress' default preprocessor under the hood (@cypress/browserify-preprocessor), adding the necessary configuration to use these babel presets
Most notably this allows use of object destructuring/object spread syntax in your Cypress spec files
Install
# npm npm install cypress-babel-esx-preprocessor --save-dev # yarn yarn add cypress-babel-esx-preprocessor --dev
Usage
// cypress/plugins/index.js const babelEsX = ; module { ;};
Pass in some additional babel presets/plugins:
// cypress/plugins/index.js const babelEsX = ; module { const babelOptions = presets: 'babel-preset-react' plugins: 'babel-plugin-lodash' ; ;};
Pass in options to @cypress/browserify-preprocessor:
// cypress/plugins/index.js const babelEsX = ;const browserify = module { const options = browserifydefaultOptions; optionsextensions; ;};