【发布时间】:2021-02-19 09:53:08
【问题描述】:
如何在 file:preprocessor 上添加多个事件? 我正在努力将 webpack 插件和 cypress-select-tests 插件放在文件中:prep
我在下面尝试过,但它只会处理最后一个。
const cypressTypeScriptPreprocessor = require('./cy-ts-preprocessor');
const selectTestsWithGrep = require('cypress-select-tests/grep')
module.exports = (on, config) => {
on('file:preprocessor', cypressTypeScriptPreprocessor);
on('file:preprocessor', selectTestsWithGrep(config));
另外,做了下面的,但仍然无济于事。
const cypressTypeScriptPreprocessor = require('./cy-ts-preprocessor');
const selectTestsWithGrep = require('cypress-select-tests/grep')
module.exports = (on, config) => {
on('file:preprocessor', { cypressTypeScriptPreprocessor, , selectTestsWithGrep(config)});
非常感谢任何输入。 谢谢。
【问题讨论】:
-
你在使用这个
module.exports = (on, config) => { on('file:preprocessor', cypressTypeScriptPreprocessor); on('file:preprocessor', selectTestsWithGrep(config)); }时遇到了什么错误 -
@AlapanDas 我收到此错误:``` Cypress throwing SyntaxError: 'import' and 'export' may only appear with 'sourceType: module' (17:0) ``` 因为webpack 预处理器被 cypress-select-tests 插件覆盖。
标签: javascript cypress