import { addCucumberPreprocessorPlugin } from "@badeball/cypress-cucumber-preprocessor"; import { createEsbuildPlugin } from "@badeball/cypress-cucumber-preprocessor/esbuild"; import createBundler from "@bahmutov/cypress-esbuild-preprocessor"; import { defineConfig } from "cypress"; export default defineConfig({ e2e: { baseUrl: "http://localhost:5173", // Experimental — testing whether real Gherkin .feature files work with // this preprocessor version (see experiment/cucumber-cypress). Only one // throwaway feature exists right now (login.feature); the rest of the // suite is still plain .cy.ts, matched by the default `**/*.cy.ts` // pattern alongside `**/*.feature`. specPattern: ["cypress/e2e/**/*.cy.ts", "cypress/e2e/**/*.feature"], async setupNodeEvents(on, config) { // Disable GPU for headless/sandboxed environments (e.g. CI containers) // where no GPU device is available. on("before:browser:launch", (browser, launchOptions) => { if (browser.family === "chromium") { launchOptions.args.push("--disable-gpu", "--no-sandbox"); } return launchOptions; }); await addCucumberPreprocessorPlugin(on, config); on( "file:preprocessor", createBundler({ plugins: [createEsbuildPlugin(config)], }), ); return config; }, }, });