README
cypress-rollup-preprocessor
Cypress preprocessor for bundling JavaScript via rollup
Installation
First install node.js. Then:
npm install cypress-rollup-preprocessor --save-dev
This package relies on the following peer dependencies:
- rollup
It is likely you already have these installed either directly or as a transient dependency, but if not, you will need to install them.
npm install --save-dev rollup
Compatibility
This version is only compatible with rollup 2.x+
Usage
In your project's plugins file:
const rollupPreprocessor = require("cypress-rollup-preprocessor");
module.exports = (on) => {
on("file:preprocessor", rollupPreprocessor());
};
Examples
Options
Pass in options as the argument to rollup
:
const rollupPreprocessor = require("cypress-rollup-preprocessor");
module.exports = (on) => {
const options = {
// send in the options from your rollup.config.js, so it works the same
// as your app's code
rollupOptions: require("../../rollup.config"),
};
on("file:preprocessor", rollupPreprocessor(options));
};
rollupOptions
Object of rollup options. Just require
in the options from your
rollup.config.js
to use the same options as your app.
Contributing
Please read the Contributing guidelines.
Running Tests
To run tests, first install nodeunit and any dependencies via npm:
npm ci
Run tests with:
npm test
Inspiration
Many approaches, patterns and standards were copied from:
- https://github.com/cypress-io/cypress-webpack-preprocessor
- https://github.com/cypress-io/cypress-watch-preprocessor
Alternatives
License
This project is licensed under the terms of the MIT license.