I’m facing an issue with Cypress and the Cucumber preprocessor. When I try to run a test based on a .feature file, Cypress throws the following error:
Error: ENOENT: no such file or directory, stat ‘C:UsersglahoudAppDataRoamingCypresscyproductionprojectsintegral-qa-4a37eb8370c66f6ec3a454d102bc9ffdbundlescypresse2efeaturesreadersreadersForm.feature’
Here’s what I’ve tried so far:
Verified that the .feature file exists in the specified path.
Cleared the Cypress cache using npx cypress cache clear.
Ensured that my specPattern in cypress.config.ts is correctly pointing to the cypress/e2e/**/*.feature files.
Here is my current cypress.config.ts setup:
import createEsbuildPlugin from '@badeball/cypress-cucumber-preprocessor/esbuild';
import { defineConfig } from 'cypress';
import { addCucumberPreprocessorPlugin } from '@badeball/cypress-cucumber-preprocessor';
import createBundler = require('@bahmutov/cypress-esbuild-preprocessor');
import dotenv from 'dotenv';
dotenv.config();
export default defineConfig({
e2e: {
experimentalRunAllSpecs: true,
supportFile: 'cypress/support/e2e.ts',
specPattern: 'cypress/e2e/**/*.feature',
baseUrl: process.env.BASE_URL,
async setupNodeEvents(on, config) {
await addCucumberPreprocessorPlugin(on, config);
on('file:preprocessor', createBundler({ plugins: [createEsbuildPlugin(config)] }));
return config;
}
},
env: {
API_URL: process.env.API_URL,
waitTime: process.env.CYPRESS_WAIT_TIME || 5000,
}
});
How can I resolve this issue and ensure Cypress can find and execute my .feature
files correctly? Is there a way to prevent Cypress from caching in the AppDataRoaming folder or force it to look for the files in my project directory?
Hedi BenSaid is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.