You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not too sure that this thread should belong in this forum or the one for the cypress-cucumber-preprocessor plugin, but here's the problem.
So basically, I'm trying to modify the es-build-preprocessor to convert *.cucumber files instead of *.feature to the needed .spec.ts files and I hope I'm doing it completely wrong and there's a better solution/approach than the following:
According to the readme's, I should write my own loader to handle *.cucumber files. This looks as follows (based on the existing cucumber-processor code):
import*asfsfrom'fs';// @ts-expect-error will errorimport{compile}from'@badeball/cypress-cucumber-preprocessor/browserify';exportfunctioncreateCucumberESBuildPlugin(config){return{name: 'cucumber',setup(build){// @ts-expect-error will errorbuild.onLoad({filter: /\.cucumber$/},async(args)=>{constcontent=fs.readFileSync(args.path,'utf8');return{contents: awaitcompile(config,content,args.path),loader: 'js',};});},};}
As you can see, I'm using the cypress-on-fix package to fix possible errors for the 'on' listeners.
When executing the Cypress tests in headless mode, I can see that the *.cucumber files are being converted to the correct format in the generated Cypress bundles, but I get the following error:
CypressError: `cy.task('cypress-cucumber-preprocessor:spec-envelopes')`failedwiththefollowingerror:
>UnexpectedstateinspecEnvelopesHandler: before-run.Thisalmostalwaysmeansthatyouorsomeotherplugin,areoverwritingthisplugin's event handlers. For more information & workarounds, see https://github.com/badeball/cypress-cucumber-preprocessor/blob/master/docs/event-handlers.md (if neither workaround work, please report at https://github.com/badeball/cypress-cucumber-preprocessor)
https://on.cypress.io/api/task
I have tried both workaround, but without succes. The same error keeps popping up, but only in headless mode, perhaps because that timings in headless mode are conflicting with eachother but not in headed mode.
I'm very curious what is going wrong so some help in this would be very appreciated!
Cheers,
Thomas
The text was updated successfully, but these errors were encountered:
thomasatdiscoverage
changed the title
Writing seperate plugin for *.cucumber files results in esbuild-preprocessor error
Writing seperate loader for *.cucumber files results in esbuild-preprocessor error
Oct 31, 2024
thomasatdiscoverage
changed the title
Writing seperate loader for *.cucumber files results in esbuild-preprocessor error
Writing seperate loader for *.cucumber files results in esbuild-preprocessor error (headless mode only)
Oct 31, 2024
At our project, we have chosen to rename the .feature files not to .cucumber files, but to .gherkin.feature files so we can configure IntelliJ to use .gherkin.feature files so the preprocessor plugin does not need to be altered. Hereby we solved our challenge in to use Gherkin feature files together with Karate feature files.
No really a solution for our problem, but the workaround is OK by now.
Hi,
Not too sure that this thread should belong in this forum or the one for the cypress-cucumber-preprocessor plugin, but here's the problem.
So basically, I'm trying to modify the es-build-preprocessor to convert *.cucumber files instead of *.feature to the needed .spec.ts files and I hope I'm doing it completely wrong and there's a better solution/approach than the following:
According to the readme's, I should write my own loader to handle *.cucumber files. This looks as follows (based on the existing cucumber-processor code):
I'm using this plugin as follows:
As you can see, I'm using the cypress-on-fix package to fix possible errors for the 'on' listeners.
When executing the Cypress tests in headless mode, I can see that the *.cucumber files are being converted to the correct format in the generated Cypress bundles, but I get the following error:
I have tried both workaround, but without succes. The same error keeps popping up, but only in headless mode, perhaps because that timings in headless mode are conflicting with eachother but not in headed mode.
I'm very curious what is going wrong so some help in this would be very appreciated!
Cheers,
Thomas
The text was updated successfully, but these errors were encountered: