Closed hasanalpzengin closed 7 months ago
@hasanalpzengin chances are that it's related to major version upgrade could you reproduce it with Cypress 12 and VRT agent 5.7.0 ?
I have tried Cypress 12 but not VRT agent but didn't work. Sorry for late reply. I stopped investigation after that. Thanks a lot for your help :)
Hi, I had the same problem trying to use agent-cypress with esbuild. You can fix this by adding esbuild-plugins-node-modules-polyfill.
Hope this helps someone, for example someone who is trying to get this to work in Cypress + Cucumber using @badeball/cypress-cucumber-preprocessor (like me).
Hi Whenlit, Thanks for getting the solution for this issue. Can you please guide how and where we need to use modules-polyfill.. will wait for your answer
Ah yes. This is added in your cypress config file, say cypress.config.ts
. I'll add a more or less complete example for cypress/cucumber:
import { defineConfig } from 'cypress';
import cypressOnFix from 'cypress-on-fix';
import createBundler from '@bahmutov/cypress-esbuild-preprocessor';
import { addCucumberPreprocessorPlugin } from '@badeball/cypress-cucumber-preprocessor';
import createEsbuildPlugin from '@badeball/cypress-cucumber-preprocessor/esbuild';
import { nodeModulesPolyfillPlugin } from 'esbuild-plugins-node-modules-polyfill'; // <--- add this
const config = {
e2e: {
async setupNodeEvents(cypressOn, config: Cypress.PluginConfigOptions): Promise<Cypress.PluginConfigOptions> {
// Make sure plugins don't overwrite each other's event handlers
const on = cypressOnFix(cypressOn);
// Add cucumber preprocessor
await addCucumberPreprocessorPlugin(on, config);
on(
file:preprocessor',
createBundler({
plugins: [
nodeModulesPolyfillPlugin(), // <--- and this
createEsbuildPlugin(config)
]
})
);
// Return the config object as it might have been modified by the plugin.
return config;
},
}
};
export default defineConfig(config);
Hi, it's pretty similar issue to #217 but the topic was closed. I am having the following error:
when I try to add commands to my e2e project.
Cypress version is: 13.7.3
Is this problem fixed completely with the new version ?