All Projects → cypress-io → cypress-browserify-preprocessor

cypress-io / cypress-browserify-preprocessor

Licence: MIT license
Cypress preprocessor for bundling JavaScript via browserify

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to cypress-browserify-preprocessor

cypress-get-it
Get elements by data attribute by creating a Cy command on the fly
Stars: ✭ 23 (+0%)
Mutual labels:  cypress, cypress-io, cypress-plugin
cypress-xpath
Adds XPath command to Cypress test runner
Stars: ✭ 145 (+530.43%)
Mutual labels:  cypress, cypress-io, cypress-plugin
cypress-watch-and-reload
Reloads Cypress when one of the watched files changes
Stars: ✭ 46 (+100%)
Mutual labels:  cypress, cypress-io, cypress-plugin
todo-graphql-example
Example Todo app on top of json-graphql-server
Stars: ✭ 20 (-13.04%)
Mutual labels:  cypress, cypress-io
cypress-angularjs-unit-test
Unit test Angularjs code using Cypress.io test runner
Stars: ✭ 23 (+0%)
Mutual labels:  cypress, cypress-io
cypress-dotenv
Cypress plugin that enables compatability with dotenv
Stars: ✭ 47 (+104.35%)
Mutual labels:  cypress, cypress-plugin
instrument-cra
Little module for CRA applications to instrument code without ejecting react-scripts
Stars: ✭ 61 (+165.22%)
Mutual labels:  cypress, cypress-io
cypress-mochawesome-reporter
Zero config Mochawesome reporter for Cypress with screenshots
Stars: ✭ 48 (+108.7%)
Mutual labels:  cypress, cypress-io
cypress-plugin-stripe-elements
A small Cypress plugin that assists you in filling in Stripe Elements inputs
Stars: ✭ 22 (-4.35%)
Mutual labels:  cypress, cypress-plugin
cypress-upload-file-post-form
Solution for two Cypress testing use-cases I came across with: perform a direct http FORM request to the server containing a file and other parameters and upload a file into a form before submission
Stars: ✭ 59 (+156.52%)
Mutual labels:  cypress, cypress-io
svelte-pwa-now
A PWA ready Svelte v3.0 starter template with Tailwind, Now integration and optional Typescript suppot
Stars: ✭ 138 (+500%)
Mutual labels:  cypress, cypress-io
cypress-hyperapp-unit-test
Unit test Hyperapp components using Cypress
Stars: ✭ 26 (+13.04%)
Mutual labels:  cypress, cypress-io
cypress-example-circleci-orb
Demo of using the Cypress CircleCI Orb
Stars: ✭ 26 (+13.04%)
Mutual labels:  cypress, cypress-io
cypress-retry
Retry just the failed Cypress.io tests using Cypress module API and AST rewriting
Stars: ✭ 16 (-30.43%)
Mutual labels:  cypress, cypress-io
cypress-browser-permissions
A Cypress plugin to set launched browser preferences including permissions like Geolocation, Notifications, Microphone, etc.
Stars: ✭ 40 (+73.91%)
Mutual labels:  cypress, cypress-plugin
cypress-example-docker-compose
Example running Cypress tests against Apache server via docker-compose
Stars: ✭ 106 (+360.87%)
Mutual labels:  cypress, cypress-io
cypress-test-tiny
Tiny Cypress E2E test case
Stars: ✭ 48 (+108.7%)
Mutual labels:  cypress, cypress-io
TLE5012-Magnetic-Angle-Sensor
This repository includes an library for Arduino for the TLE5012 Magnetic Angle Sensor with SSC interface.
Stars: ✭ 37 (+60.87%)
Mutual labels:  cypress, cypress-io
cypress-angular-unit-test
Trying to load and bootstrap Angular component dynamically inside Cypress
Stars: ✭ 146 (+534.78%)
Mutual labels:  cypress, cypress-io
snapshot
Adds value / object / DOM element snapshot testing support to Cypress test runner
Stars: ✭ 114 (+395.65%)
Mutual labels:  cypress, cypress-io

Note: This plugin is deprecated and Cypress will not be moving forward with development of the plugin.

Cypress Browserify Preprocessor CircleCI

Cypress preprocessor for bundling JavaScript via browserify.

Modifying the default options allows you to add support for things like:

  • TypeScript
  • Babel Plugins
  • ES Presets

Installation

Requires Node version 6.5.0 or above.

npm install --save-dev @cypress/browserify-preprocessor

Usage

In your project's plugins file:

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

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

Options

Pass in options as the second argument to browserify:

module.exports = (on) => {
  const options = {
    // options here
  }

  on('file:preprocessor', browserify(options))
}

browserifyOptions

Object of options passed to browserify.

// example
browserify({
  browserifyOptions: {
    extensions: ['.js', '.ts'],
    plugin: [
      ['tsify']
    ]
  }
})

If you pass one of the top-level options in (extensions, transform, etc), it will override the default. In the above example, browserify will process .js and .ts files, but not .jsx or .coffee. If you wish to add to or modify existing options, read about modifying the default options.

watchify is automatically configured as a plugin (as needed), so it's not necessary to manually specify it.

Source maps are always enabled unless explicitly disabled by specifying debug: false.

Default:

{
  extensions: ['.js', '.jsx', '.coffee'],
  transform: [
    [
      'coffeeify',
      {}
    ],
    [
      'babelify',
      {
        ast: false,
        babelrc: false,
        plugins: [
          '@babel/plugin-transform-modules-commonjs', 
          '@babel/plugin-proposal-class-properties',
          '@babel/plugin-proposal-object-rest-spread',
          '@babel/plugin-transform-runtime',
          ],
        presets: [
          '@babel/preset-env',
          '@babel/preset-react',
        ]
      },
    ]
  ],
  debug: true,
  plugin: [],
  cache: {},
  packageCache: {}
}

Note: cache and packageCache are always set to {} and cannot be overridden. Otherwise, file watching would not function correctly.

watchifyOptions

Object of options passed to watchify

// example
browserify({
  watchifyOptions: {
    delay: 500
  }
})

Default:

{
  ignoreWatch: [
    '**/.git/**',
    '**/.nyc_output/**',
    '**/.sass-cache/**',
    '**/bower_components/**',
    '**/coverage/**',
    '**/node_modules/**'
  ],
}

onBundle

A function that is called with the browserify instance. This allows you to specify external files and plugins. See the browserify docs for methods available.

// example
browserify({
  onBundle (bundle) {
    bundle.external('react')
    bundle.plugin('some-plugin')
    bundle.ignore('pg-native')
  }
})

typescript

When the path to the TypeScript package is given, Cypress will automatically transpile .ts spec, plugin, support files. Note that this DOES NOT check types.

browserify({
  typescript: require.resolve('typescript')
})

Default: undefined

Modifying default options

The default options are provided as browserify.defaultOptions so they can be more easily modified.

If, for example, you want to update the options for the babelify transform to turn on babelrc loading, you could do the following:

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

module.exports = (on) => {
  const options = browserify.defaultOptions
  options.browserifyOptions.transform[1][1].babelrc = true

  on('file:preprocessor', browserify(options))
}

Debugging

Execute code with DEBUG=cypress:browserify environment variable.

Contributing

Run all tests once:

npm test

Run tests in watch mode:

npm run test-watch

License

This project is licensed under the terms of the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].