cypress-babel-esx

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

moved to cypress-babel-esx-preprocessor
Last updated 2 years ago by chinchiheather .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install cypress-babel-esx 
SYNC missed versions from official npm registry.

cypress-babel-esx

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 --save-dev

# yarn
yarn add cypress-babel-esx --dev

Usage

// cypress/plugins/index.js

const babelEsX = require('cypress-babel-esx');

module.exports = (on) => {
    on('file:preprocessor', babelEsX());
};

Pass in some additional babel presets/plugins:

// cypress/plugins/index.js

const babelEsX = require('cypress-babel-esx');

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:

// cypress/plugins/index.js

const babelEsX = require('cypress-babel-esx');
const browserify = require('@cypress/browserify-preprocessor')

module.exports = (on) => {
    const options = browserify.defaultOptions;
    options.extensions.push('ts', 'tsx');
    on('file:preprocessor', babelEsX(null, options));
};

Current Tags

  • 1.0.0                                ...           latest (2 years ago)

1 Versions

  • 1.0.0 [deprecated]           ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (4)
Dev Dependencies (6)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |