Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chinchiheather/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
https://github.com/chinchiheather/cypress-babel-esx-preprocessor
babel babel-presets cypress cypress-plugin cypress-preprocessor
Last synced: 22 days ago
JSON representation
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
- Host: GitHub
- URL: https://github.com/chinchiheather/cypress-babel-esx-preprocessor
- Owner: chinchiheather
- Created: 2018-04-06T04:02:11.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-04-10T05:36:42.000Z (over 6 years ago)
- Last Synced: 2024-11-26T09:17:12.203Z (about 1 month ago)
- Topics: babel, babel-presets, cypress, cypress-plugin, cypress-preprocessor
- Language: JavaScript
- Homepage:
- Size: 42 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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](https://babeljs.io/docs/plugins/preset-stage-1/) as well as all JavaScript that has been finalised in the ECMA standard by using [babel-preset-env](https://babeljs.io/docs/plugins/preset-env/)This uses Cypress' default preprocessor under the hood ([@cypress/browserify-preprocessor](https://github.com/cypress-io/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
```bash
# npm
npm install cypress-babel-esx-preprocessor --save-dev# yarn
yarn add cypress-babel-esx-preprocessor --dev
```## Usage
```javascript
// cypress/plugins/index.jsconst babelEsX = require('cypress-babel-esx-preprocessor');
module.exports = (on) => {
on('file:preprocessor', babelEsX());
};
```Pass in some additional babel presets/plugins:
```javascript
// cypress/plugins/index.jsconst babelEsX = require('cypress-babel-esx-preprocessor');
module.exports = (on) => {
const babelOptions = {
presets: ['babel-preset-react'],
plugins: ['babel-plugin-lodash']
};
on('file:preprocessor', babelEsX(babelOptions));
};
```Pass in options to @cypress/browserify-preprocessor:
```javascript
// cypress/plugins/index.jsconst babelEsX = require('cypress-babel-esx-preprocessor');
const browserify = require('@cypress/browserify-preprocessor')module.exports = (on) => {
const options = browserify.defaultOptions;
options.extensions.push('ts', 'tsx');
on('file:preprocessor', babelEsX(null, options));
};
```