柏树10的Webpack编译误差和角质中的黄瓜
我在此站点中看到了其他类似的问题,但是其中没有一个对我有满意的解决方案。我没有任何webpack.config.js文件,因为我们从Angular中获取默认配置。请,请参阅下面的相应图像,以更好地了解我的问题。
我的项目中的其他配置:
package.json
"cypress-cucumber-preprocessor": {
"nonGlobalStepDefinitions": true,
"json": {
"enabled": true
},
"stepDefinitions": "**/cypress/e2e/**/*.js",
"step_definitions": "**/cypress/e2e/**/*.js"
},
cypress.config.ts
import { defineConfig } from 'cypress'
export default defineConfig({
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
return require('./cypress/plugins/index.js')(on, config)
},
specPattern: '**/e2e/**/*.feature',
"supportFile": false,
chromeWebSecurity: false
},
})
更新1: 您好@wirtuald,感谢您回复我。 我开始在一个非常复杂的角度项目上找到这个问题。因此,我从头开始创建了一个基本项目, 我仍然有相同的问题 。然后,我在此新项目的所有信息下给您:
我没有“插件”文件夹
- package.json上的“插件”文件夹
版本:
“ devDepentencies”:{ “@badeball/Cypress-Cucumber-Preprocessor”:“^11.2.0”, “柏树”:“^10.2.0” },,
- 包装上 在 “ nonglobalstepdefinitions”:是的, “ json”:{ “启用”:true },, “ stepdefinitions”:[ “ [filepath]。{js,ts}”, “柏树/e2e/**/*。{js,ts}” 这是给出的
}
cypress.config.js:
const {decteConfig} = require(“ cypress”); Module.exports = decteConfig({ E2E:{ Specpattern:“ **/*。功能”, chromewebscurity:false, setupnodeevents(on,config){ //在这里实现节点事件侦听器 },, },, });
-project结构
- direct-strention-steps.js
import { Given, When, Then } from "@badeball/cypress-cucumber-preprocessor";
Given("Access to NXSuite", () => {
cy.visit("https://www.nxsuite.com");
})
I have seen other similar questions in this site, but non of them have a satisfatory solution for me. I don't have any webpack.config.js file since we take the default configuration from angular. Please, see below the corresponding image to have a better sight of my problem.
Other configurations in my project:
package.json
"cypress-cucumber-preprocessor": {
"nonGlobalStepDefinitions": true,
"json": {
"enabled": true
},
"stepDefinitions": "**/cypress/e2e/**/*.js",
"step_definitions": "**/cypress/e2e/**/*.js"
},
cypress.config.ts
import { defineConfig } from 'cypress'
export default defineConfig({
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
return require('./cypress/plugins/index.js')(on, config)
},
specPattern: '**/e2e/**/*.feature',
"supportFile": false,
chromeWebSecurity: false
},
})
Update 1:
Hello @Wirtuald, thanks for responding me.
I began getting this issue on a quite complex angular project. So, I created a basic project from scratch and I still have the same issue. Then, I give you below all the information of this new project:
I dont have "plugins" folder
versions on package.json:
"devDependencies": { "@badeball/cypress-cucumber-preprocessor": "^11.2.0", "cypress": "^10.2.0" },
preprocessor config on package.json
"cypress-cucumber-preprocessor": { "nonGlobalStepDefinitions": true, "json": { "enabled": true }, "stepDefinitions": [ "[filepath].{js,ts}", "cypress/e2e/**/*.{js,ts}" ]
}
cypress.config.js:
const { defineConfig } = require("cypress"); module.exports = defineConfig({ e2e: { specPattern: "**/*.feature", chromeWebSecurity: false, setupNodeEvents(on, config) { // implement node event listeners here }, }, });
-project structure
- direct-attention-steps.js
import { Given, When, Then } from "@badeball/cypress-cucumber-preprocessor";
Given("Access to NXSuite", () => {
cy.visit("https://www.nxsuite.com");
})
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您只是缺少WebPack流程, - 开始
webpack.ts示例在此处给出赛普拉斯 - 库伯 - 预处理/示例/webpack-ts/cypress.config.ts 。
它需要
@cypress/webpack-preprocessor
和ts-loader
的其他安装。中
在 update1
You're just missing the webpack process, from quick-start
The webpack.ts example is given here cypress-cucumber-preprocessor/examples/webpack-ts/cypress.config.ts.
It needs additional installs for
@cypress/webpack-preprocessor
andts-loader
.In Update1 in
cypress.config.js
you have a typoshould be
尝试安装 @cypress/webpack-preprocessor
Try to install @cypress/webpack-preprocessor
问题
就我而言,这是最新版本的
cypress
我首先使用的,请确保您使用
@badeball/cypress-cucumber-preprocessor 解决了柏树10的一些兼容问题。参见 https> https:// github。 com/badeball/cypress-cucumber-Preprocessor/essess/722#用于未来信息。
此外,最新版本的柏树已删除了插件文件。就我而言,将所有代码从
cypress/插件/index.js
内部迁移。参见 https://docs.cypress.io/guides/guides/guides/guides/guides/references/references /迁移指南#插件 - 文件被检查devil在详细信息中,也可能与您的插件文件本身有关。也许您可以分享,以便我们可以帮助您更好。您还可以分享哪个版本的“@badeball/cypress-cucumber-preprocessor”您
希望它能帮助您,
In my case, it was an issue with the latest version of
cypress
I'm using
First, make sure that you use the latest version of
@badeball/cypress-cucumber-preprocessor
which fix some compatibilty issues with cypress 10. See https://github.com/badeball/cypress-cucumber-preprocessor/issues/722# for futher info.Also, latest version of cypress has removed plugin file. In my case, migrating all the code from
cypress/plugins/index.js
insidesetupNodeEvents
method solved the issue. See https://docs.cypress.io/guides/references/migration-guide#Plugins-File-RemovedThe devil is in the details, it could also be related to your plugin file itself. Maybe you could share it, so that we can help you better. Can you also share what version of "@badeball/cypress-cucumber-preprocessor" you use
Hope it will help you,
我修改了上述解决方案:
然后删除了.ts文件的规则,仅保留WebPack配置中的.feature规则。
那之后一切都很好
I modified the above solution:
and I removed the rule for .ts files, keeping just the .feature rule in the webpack config.
It all worked ok after that
我有类似的问题。除了调整脚本外,我的解决方法还将节点从18降低至16.13.2
I had similiar problem. Besides tweaking scripts my workaround was to downgrade Node from 18 to 16.13.2