How to use the @cypress/browserify-preprocessor.defaultOptions function in @cypress/browserify-preprocessor

To help you get started, we’ve selected a few @cypress/browserify-preprocessor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nasa / cumulus-dashboard / cypress / plugins / index.js View on Github external
module.exports = (on) => {
  let options = browserify.defaultOptions;
  const babelOptions = options.browserifyOptions.transform[1][1];
  babelOptions.global = true;
  // ignore all node_modules except files in @cumulus/
  // see https://github.com/cypress-io/cypress-browserify-preprocessor/issues/19
  babelOptions.ignore = [/\/node_modules\/(?!@cumulus\/)/];

  // options.onBundle = (bundle) => {
  //   bundle.ignore('graceful-fs');
  //   bundle.ignore('@cumulus/cmrjs');
  //   // bundle.ignore('@cumulus/logger');
  // };
  // const bundle = browserify(options);
  // Run specialized file preprocessor to transpile ES6+ -> ES5
  // This fixes compatibility issues with Electron
  on('file:preprocessor', browserify(options));
github TheBrainFamily / cypress-cucumber-preprocessor / lib / index.js View on Github external
const preprocessor = (options = browserify.defaultOptions) => async file => {
  if (options.browserifyOptions.transform.indexOf(transform) === -1) {
    options.browserifyOptions.transform.unshift(transform);
  }
  // load arguments from running Cypress instance
  await cypressExecutionInstance.load();

  if (file.shouldWatch) {
    if (watcher) {
      watcher.close();
    }
    watcher = chokidar
      .watch([`${stepDefinitionPath()}*.js`, `${stepDefinitionPath()}*.ts`], {
        ignoreInitial: true
      })
      .on("all", () => {
        touch(file.filePath);
github TheBrainFamily / TheBrain2.0 / testing / web / cypress / plugins / index.js View on Github external
module.exports = (on) => {
  const options = browserify.defaultOptions
  options.browserifyOptions.transform[1][1].babelrc = true
  options.browserifyOptions.transform[1][1].plugins.push([
    'get-rid-of-async-await',
    {'onlyInPath': ['testing/web/features', 'testing/testHelpers', 'testing/common/']}
  ])
  options.browserifyOptions.transform[1][1].plugins.push('transform-async-to-generator')
  options.browserifyOptions.transform[1][1].presets.push('es2015')
  options.browserifyOptions.transform[1][1].presets.push('stage-2')
  console.log('preprocessing', options.browserifyOptions.transform)

  on('file:preprocessor', browserify(options))
}
github bahmutov / cypress-select-tests / src / index.js View on Github external
const onFilePreprocessor = (config, pickTests) => {
  const options = {
    browserifyOptions: {
      transform: [
          ...browserify.defaultOptions.browserifyOptions.transform,
          itify(config, pickTests)
      ]
    }
  }

  return browserify(options)
}
github TheBrainFamily / cypress-app-watcher-preprocessor / cypressPreprocessor.js View on Github external
const watchApp = preprocessor => file => {
  if (!filesToRerun.find(f => f.filePath === file.filePath)) {
    filesToRerun.push(file);
    file.on("close", () => {
      console.log("closing!", file.filePath);
      filesToRerun = filesToRerun.filter(f => f.filePath !== file.filePath);
    });
  }
  if (!preprocessor) {
    preprocessor = browserifyPreprocessor(
      browserifyPreprocessor.defaultOptions
    );
  }
  return preprocessor(file);
};
github TheBrainFamily / TheBrain2.0 / cypress / plugins / index.js View on Github external
module.exports = (on) => {
  const options = browserify.defaultOptions
  options.browserifyOptions.transform[1][1].babelrc = true
  options.browserifyOptions.transform[1][1].plugins.push(["get-rid-of-async-await", {"onlyInPath": ["cypress/integration", "testing/testHelpers"]}])
  options.browserifyOptions.transform[1][1].plugins.push("transform-async-to-generator")
  options.browserifyOptions.transform[1][1].presets.push("es2015")
  options.browserifyOptions.transform[1][1].presets.push("stage-2")
  console.log("preprocessing", options.browserifyOptions.transform)

  on('file:preprocessor', browserify(options))
}
github chinchiheather / cypress-eslint-preprocessor / index.js View on Github external
const lint = preprocessor => (file) => {
  const report = cli.executeOnFiles([file.filePath]);
  if (report.errorCount > 0) {
    const errorMsgs = report.results[0].messages.filter(result => result.severity === 2);
    logResults(file.filePath, errorMsgs, 'error', 'red');
  }

  if (report.warningCount > 0) {
    const warningMsgs = report.results[0].messages.filter(result => result.severity === 1);
    logResults(file.filePath, warningMsgs, 'warning', 'yellow');
  }

  if (!preprocessor) {
    preprocessor = browserifyPreprocessor(browserifyPreprocessor.defaultOptions);
  }
  return preprocessor(file);
};
github withspectrum / spectrum / cypress / plugins / index.js View on Github external
module.exports = (on, config) => {
  const options = browserify.defaultOptions;
  options.browserifyOptions.transform[1][1].presets.push('@babel/preset-flow');
  on('file:preprocessor', browserify(options));
};
github cypress-io / cypress-example-recipes / examples / preprocessors__flow-browserify / cypress / plugins / index.js View on Github external
module.exports = (on, config) => {
  const options = browserify.defaultOptions

  options.browserifyOptions.transform[1][1].presets.push('@babel/preset-flow')
  on('file:preprocessor', browserify(options))
}

@cypress/browserify-preprocessor

Cypress preprocessor for bundling JavaScript via browserify

MIT
Latest version published 3 years ago

Package Health Score

50 / 100
Full package analysis

Popular @cypress/browserify-preprocessor functions