Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11If Cypress reports a Cucumber step as undefined, either the step’s text does not match a registered expression, or the preprocessor has not discovered the file containing that definition. Compare the text after the Gherkin keyword, verify the feature-to-step-file glob, then confirm which configuration and package your run actually uses. This guide focuses on the maintained @badeball/cypress-cucumber-preprocessor package.
What “undefined” means in Cypress
Cucumber marks a step undefined when it cannot find a registered step definition whose expression matches the step text. Subsequent steps in that scenario are skipped. A definition may exist in your repository and still be unavailable because the preprocessor did not discover it for that feature. The key distinction is whether the failure is a matching problem or a discovery problem.
Cucumber describes a step definition as a method with an expression linking it to one or more Gherkin steps. The expression can be a Cucumber Expression or a regular expression. See the Cucumber step-definition documentation and its step-definition reference.
Fix it in this order
- Copy the exact undefined text. Compare the feature step and the Cypress output, starting after
Given,When,Then,And, orBut. The keyword does not determine which registration function must be used. - Check the expression and parameters. Confirm that literal words, punctuation, quotes, regular-expression anchors, and capture groups match the actual step text.
- Check discovery and pairing. Verify that the configured
stepDefinitionsglob includes the definition file for the feature. - Confirm the effective configuration. Remove conflicting configuration locations and use debug output to inspect what the preprocessor loads.
- Check package lineage and imports. Make sure the project consistently uses the maintained scoped package.
- Classify any build error separately. A webpack or esbuild compilation error is not the same as an undefined step.
Match the step text, not the keyword
Compare the phrase after the Gherkin keyword. A Given step can match a definition registered with When or Then; the registered expression is what matters. The expression must match the step’s words and parameter format.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problems#1 Best Overall
import { Given } from '@badeball/cypress-cucumber-preprocessor';
Given('I log in as {string}', (role) => {
// implementation
});
This matches a feature step such as Given I log in as "admin". If the feature instead says I log in as admin without quotes, the shown Cucumber Expression may not match. Either make the feature text conform to the expression or choose an expression or regular expression for the syntax you intend. Check parameter syntax against the version of the Cucumber expression implementation installed in your project.
Common expression mismatches
- Different literal wording: “I sign in” and “I log in” are different text.
- Punctuation or spacing: Check punctuation and the exact spaces in the feature step.
- Parameter shape: A quoted string parameter and an unquoted word may not match the same expression.
- Regular-expression boundaries: Check anchors and capture groups; an expression that is too strict or too loose may not match as intended.
Do not create a second definition until you have checked whether the existing expression is simply too narrow. Overlapping expressions can make matching ambiguous rather than fixing discovery.
Put the definition where the feature can find it
The maintained preprocessor uses stepDefinitions glob patterns to determine which files are available to each feature. Its documented defaults for common cypress/e2e layouts include:
{
"stepDefinitions": [
"cypress/e2e/[filepath]/**/*.{js,ts}",
"cypress/e2e/[filepath].{js,ts}",
"cypress/support/step_definitions/**/*.{js,ts}"
]
}
For cypress/e2e/duckduckgo.feature, documented matching locations include cypress/e2e/duckduckgo/steps.ts, cypress/e2e/duckduckgo.ts, and cypress/support/step_definitions/duckduckgo.ts. The [filepath] token lets the preprocessor pair files with a feature path. Consult the maintained project’s step-definition documentation for the current pattern behavior.
Recommended Free Tools
Feature files in a different directory
If your feature files live under another root, the default prefix is derived from their common ancestor. Check the actual feature path and set a glob that reflects your project layout. A shared directory can be added explicitly, for example:
{
"stepDefinitions": [
"cypress/e2e/[filepath]/**/*.{js,ts}",
"cypress/support/step_definitions/**/*.{js,ts}"
]
}
A broad pattern such as cypress/e2e/**/*.js may make every matching definition and hook available to every feature. That can be appropriate for intentionally global steps, but it broadens scope and can create collisions. Prefer feature-specific patterns plus an explicit shared directory when that reflects the intended organization.
Verify which configuration is active
Configuration can be stored in a dedicated .cypress-cucumber-preprocessorrc.json file or under cypress-cucumber-preprocessor in package.json. The project documentation specifies that only one configuration location applies. If you have duplicate or empty blocks, do not assume the file you edited is controlling the run.
For a package.json configuration, the relevant setting belongs inside the named object:
Rank #3
{
"cypress-cucumber-preprocessor": {
"stepDefinitions": [
"cypress/e2e/[filepath]/**/*.{js,ts}",
"cypress/support/step_definitions/**/*.{js,ts}"
]
}
}
Run the documented debug command from the project environment to inspect preprocessor behavior and the files and settings used:
DEBUG=cypress:electron,cypress-cucumber-preprocessor cypress run
If your shell or script runner handles environment variables differently, adapt how you set DEBUG; keep the documented variable and Cypress command. The maintained preprocessor’s configuration documentation explains the supported configuration locations and options.
Make sure you are using one package family
Inspect package.json, the lockfile, and imports in step files. The maintained preprocessor FAQ describes the unscoped cypress-cucumber-preprocessor package as severely outdated and advises against mixing it with @badeball/cypress-cucumber-preprocessor. Use one package consistently, including its import paths, configuration, and setup instructions. See the maintainer FAQ.
When correcting a mixed setup, first identify which package is installed and which one your Cypress configuration and step files import. Then align them with the documentation for the package you intend to keep. Do not treat changing an import alone as a complete migration; configuration and integration setup may also differ by package version.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Tell an undefined step from a bundler error
If the message says a step is undefined, investigate expression matching and file discovery. If Cypress instead reports a webpack or esbuild compilation error, the failure is in preprocessing or bundling, not step matching. The Cucumber integration uses third-party bundlers; its documentation notes that esbuild should be configured with inline source maps so code frames remain useful. See the preprocessor’s bundler documentation.
Fix the first reported compilation error before interpreting the test’s step behavior. A file that fails to compile cannot register its definitions, so the eventual symptom may look like missing steps even though the underlying failure is bundling.
Troubleshooting by symptom
| Symptom | Likely cause | What to check |
|---|---|---|
| One step is undefined; nearby steps work | Expression text or parameter mismatch | Compare the exact phrase after the keyword, including punctuation, quotes, and regex captures. |
| Every step in a feature is undefined | Definition files are not being discovered, or imports/configuration use the wrong package | Check the feature path against stepDefinitions, inspect debug output, and verify package imports. |
| Definitions work for one feature but not another | Feature-specific glob does not include the second feature’s path, or shared steps are not configured | Inspect the common ancestor and add a deliberate shared glob if needed. |
| Changing one config file has no effect | A different configuration location is active | Remove duplicate configuration locations and use the documented debug command. |
| Cypress reports a compile or source-map error | Bundler configuration fails before definitions can be registered | Resolve the bundler error; check the integration’s bundler guidance, including inline source maps for esbuild. |
Or skip the browser setup
If your goal is a clean screenshot of a page rather than debugging a Cypress feature test, ScreenshotNeo provides a screenshot API and MCP server. It does not fix Cucumber definitions or run Cypress tests; it is an alternative for capturing the page directly.
One GET request returns an image or PDF. The example below saves a WebP screenshot; see the ScreenshotNeo documentation for request options and response details.
Best Value
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Cookie and consent banners, newsletter popups, and chat widgets are removed before capture, and each step can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed; response headers identify the page verdict and billing status. An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents. The Free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 shots.
Sign up for ScreenshotNeo and get 1,000 free screenshots a month with no card.
Keeping the fix maintainable
- Keep feature-specific definitions close to their feature when that makes ownership and pairing clear.
- Put truly shared steps in a deliberate shared directory rather than broadening every feature’s glob by accident.
- Use expressions that reflect the language used in feature files; avoid relying on punctuation or parameter assumptions that authors do not follow.
- When changing package versions or configuration, check the documentation for that installed version. The preprocessor documentation is maintained and may change with releases.
Frequently Asked Questions
Does `Given` in a feature have to use `Given()` in the step file?
No. Matching is based on the step expression and text after the Gherkin keyword, not the registration function’s name.
Why are all steps missing even though the definition file exists?
The preprocessor may not have paired that file with the feature. Check the effective `stepDefinitions` glob and configuration using the documented debug output.
Can I use regex instead of a Cucumber Expression?
Yes. Cucumber step definitions can use either form; ensure the regex anchors and capture groups match the intended step text.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

