Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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));
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);
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))
}
const onFilePreprocessor = (config, pickTests) => {
const options = {
browserifyOptions: {
transform: [
...browserify.defaultOptions.browserifyOptions.transform,
itify(config, pickTests)
]
}
}
return browserify(options)
}
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);
};
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))
}
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);
};
module.exports = (on, config) => {
const options = browserify.defaultOptions;
options.browserifyOptions.transform[1][1].presets.push('@babel/preset-flow');
on('file:preprocessor', browserify(options));
};
module.exports = (on, config) => {
const options = browserify.defaultOptions
options.browserifyOptions.transform[1][1].presets.push('@babel/preset-flow')
on('file:preprocessor', browserify(options))
}