Socket
Socket
Sign inDemoInstall

@cypress/browserify-preprocessor

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cypress/browserify-preprocessor

Cypress preprocessor for bundling JavaScript via browserify


Version published
Weekly downloads
435K
increased by4.82%
Maintainers
1
Weekly downloads
 
Created

What is @cypress/browserify-preprocessor?

@cypress/browserify-preprocessor is a Cypress plugin that allows you to use Browserify to bundle your test files. This is particularly useful for transforming and bundling JavaScript files using various Browserify plugins and transforms before they are executed in the Cypress test runner.

What are @cypress/browserify-preprocessor's main functionalities?

Custom Browserify Options

This feature allows you to customize the Browserify options, such as enabling Babel transformations. The code sample demonstrates how to modify the default options to enable Babel transformations by setting `babelrc` to true.

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));
};

Adding Custom Transforms

This feature allows you to add custom transforms to the Browserify bundling process. The code sample shows how to add the `envify` transform to the Browserify options.

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

module.exports = (on) => {
  const options = browserify.defaultOptions;
  options.browserifyOptions.transform.push(['envify', { global: true }]);
  on('file:preprocessor', browserify(options));
};

Using TypeScript with Browserify

This feature allows you to use TypeScript with Browserify by adding the `tsify` plugin and including `.ts` file extensions. The code sample demonstrates how to configure Browserify to handle TypeScript files.

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

module.exports = (on) => {
  const options = browserify.defaultOptions;
  options.browserifyOptions.extensions.push('.ts');
  options.browserifyOptions.plugin.unshift(['tsify']);
  on('file:preprocessor', browserify(options));
};

Other packages similar to @cypress/browserify-preprocessor

Keywords

FAQs

Package last updated on 14 Jul 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc