The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
If Cypress reports an undefined Cucumber step, it did not find any registered step-definition expression that matches the text after the Given, When, Then, And or But keyword. Fix it in this order: compare the exact expression, make sure the preprocessor discovers and pairs the file with the feature, verify that one configuration source is active, and confirm that every file uses the maintained package. Steps after an undefined step are skipped, so a later failure is usually a consequence rather than a second defect.
What “undefined” means in Cypress
Cucumber registers a step definition as an expression connected to one or more Gherkin steps. During a run it removes the keyword and searches the registered expressions for a match. If none matches, the step is marked undefined and the remaining steps in that scenario are skipped.
That distinction matters: an undefined step is normally a matching or discovery problem, not an assertion failure in your implementation. A JavaScript or TypeScript syntax error, webpack error or esbuild error is a different preprocessing layer and needs a bundler fix instead.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
1. Copy the exact step text
Start with the first undefined line in the Cypress output and the corresponding line in the .feature file. Compare only the text after the keyword.
#1 Best Overall
Given I log in as "admin"
The relevant text is I log in as "admin". Whether the line starts with Given or When does not determine matching; the registered expression and its parameters do.
- Check spelling, capitalization, punctuation and quotation marks.
- Remove accidental trailing spaces or characters copied into the feature.
- Check that the feature is running the file you edited, rather than a duplicate feature with the same scenario.
- Fix the first undefined step before investigating later skipped steps.
2. Make the expression match
Cucumber Expressions
A Cucumber Expression combines literal words with parameter placeholders. This definition expects a quoted string:
import { Given } from '@badeball/cypress-cucumber-preprocessor';
Given('I log in as {string}', (role) => {
// use role in the test
});
It matches Given I log in as "admin". If the feature says I log in as admin without quotes, change the feature to the quoted form or use an expression that accepts the unquoted syntax. Parameter syntax is implemented by the Cucumber-expression version used by your installed preprocessor, so check that version when adding types beyond the basic placeholders.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errorsRegular expressions
A definition may use a regular expression instead. Anchors and capture groups must describe the complete step you intend to support.
When(/^I submit the order for (d+) items$/, (count) => {
// count is captured from the step
});
A regex that is too tightly anchored, has the wrong number of capture groups or expects different punctuation will not match. Prefer a readable Cucumber Expression for ordinary prose; use a regex when the syntax genuinely needs it.
Do not rely on the registration keyword
Given, When and Then are registration functions for readability. Matching is against the expression text. A definition registered with Given can match a feature line introduced by another keyword when the remaining text is identical, subject to the preprocessor and Cucumber version in use.
3. Put the file where the preprocessor can discover it
A correct definition is invisible if it is outside the configured stepDefinitions glob. Pairing determines which definitions are available to each feature, so inspect both the filesystem and the pattern.
Documented layouts for cypress/e2e
For cypress/e2e/duckduckgo.feature, these layouts are covered by the common default patterns:
cypress/e2e/duckduckgo/steps.tscypress/e2e/duckduckgo.tscypress/support/step_definitions/duckduckgo.ts
The corresponding patterns are:
{
"stepDefinitions": [
"cypress/e2e/[filepath]/**/*.{js,ts}",
"cypress/e2e/[filepath].{js,ts}",
"cypress/support/step_definitions/**/*.{js,ts}"
]
}
[filepath] is based on the feature’s path. If your features are under a different common root, adapt the prefix to that layout.
Shared definitions
If several features use definitions in a shared directory, add an explicit glob for that directory. A broad pattern such as cypress/e2e/**/*.js exposes every definition and hook to every feature. That can solve visibility while creating accidental cross-feature coupling, so use the narrowest deliberate pattern that reflects your intended scope.
File extensions and case
Confirm that the glob includes the extension you actually use (.js, .ts or both), and check directory and filename case on case-sensitive systems. A TypeScript file excluded by a JavaScript-only glob behaves exactly like a missing file.
4. Verify the configuration source that wins
The maintained preprocessor supports a dedicated .cypress-cucumber-preprocessorrc.json or a package.json section. Use one authoritative location and remove stale, conflicting settings.
Rank #3
Using package.json
{
"cypress-cucumber-preprocessor": {
"stepDefinitions": [
"cypress/e2e/[filepath]/**/*.{js,ts}",
"cypress/support/step_definitions/**/*.{js,ts}"
]
}
}
Using a dedicated configuration file
Place the same relevant settings in .cypress-cucumber-preprocessorrc.json when that is the configuration file your project uses. Do not leave an empty or obsolete cypress-cucumber-preprocessor block in package.json while expecting the dedicated file to control the run. Only one configuration location applies; an unintended file can make your apparently correct pattern irrelevant.
Inspect the resolved behavior
Run Cypress with the documented debug namespaces:
DEBUG=cypress:electron,cypress-cucumber-preprocessor cypress run
On Windows PowerShell, set the variable for the command in the shell’s usual way, for example:
$env:DEBUG="cypress:electron,cypress-cucumber-preprocessor"; npx cypress run
Use the output to see which settings and files the preprocessor is using. If your expected step file never appears, fix discovery or configuration before changing the expression.
PC 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 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minute5. Make sure the package and imports belong to one family
The unscoped cypress-cucumber-preprocessor package is severely outdated according to the maintainer FAQ. The maintained package is @badeball/cypress-cucumber-preprocessor. Do not mix them.
- Inspect
package.jsonand the lockfile for both package names. - Inspect every step file and support file for import statements from both families.
- Remove the old family, install and configure the maintained package consistently, then reinstall dependencies if the lockfile still resolves the old package.
- Keep the import and configuration syntax aligned with the version you installed.
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor';
A definition imported from one package while Cypress is running another can look valid in the editor yet never register with the active preprocessor.
6. Separate an undefined step from a bundler failure
Once the file is discovered and its expression matches, a different class of error can prevent execution: a webpack or esbuild compilation failure. Read the first error category in the Cypress output.
| What Cypress shows | Likely layer | Next action |
|---|---|---|
| Undefined step; later steps skipped | Expression matching or file pairing | Compare text, inspect globs and configuration. |
| Module not found, syntax error or compilation error | Preprocessor/bundler | Fix imports, TypeScript/JavaScript syntax and bundler setup. |
| Browser opens but application assertion fails | Test implementation or application | Debug the step body and application state. |
Cucumber integration uses a third-party bundler. If you configure esbuild, enable inline source maps when creating the bundler so code frames point to the useful source location. A bundler error must be fixed before a step body can run; changing Gherkin wording will not resolve it.
Recommended Free Tools
A repeatable diagnostic checklist
- Copy the first undefined line exactly.
- Remove its Gherkin keyword and compare the remaining text with the registered expression.
- Check literal punctuation, quotes, parameter placeholders, regex anchors and capture groups.
- Confirm the step file extension and location match an active
stepDefinitionsglob. - Confirm the feature-to-directory pairing implied by
[filepath]. - Check that only one configuration source is active and run the DEBUG command.
- Check that all imports and dependencies use
@badeball/cypress-cucumber-preprocessor, not a mixture with the outdated unscoped package. - If the message is a compile error, switch to bundler troubleshooting and source-map configuration.
- Run the smallest feature containing the step again before restoring the full suite.
Common symptoms and precise fixes
“The step file exists, but every step is undefined”
This usually indicates discovery or pairing, especially when several steps in one feature fail. Verify the feature’s directory, the [filepath] expansion and the configured shared-directory glob. Use DEBUG output to confirm the file is loaded.
“Only one wording variant is undefined”
The file is probably found, but the expression does not match. Compare quotes, punctuation and parameter syntax. Add a second explicit expression only when the wording represents a supported variant; avoid a vague regex that hides genuine mistakes.
“Definitions work in one feature but not another”
The patterns may be feature-specific. Either move the shared definition into the configured shared directory or add a scoped glob for the second feature. Do not make the entire tree globally visible unless that scope is intentional.
“Changing Given to When fixed nothing”
That is expected when the remaining text is unchanged. The keyword is not the part that normally determines the match.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →“A package upgrade introduced undefined steps”
Check package identity, imports, lockfile resolution and configuration syntax together. Recheck the exact installed version because preprocessor documentation and options can change with releases.
Best Value
Or skip the browser setup
If your goal is to capture a page image for a Cypress fixture, visual baseline or debugging ticket rather than execute a browser test, ScreenshotNeo returns a screenshot or PDF through one request. Its pre-capture flow accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups and chat widgets; those steps can be disabled individually. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and the response identifies the page verdict and billing status in headers.
Use the same request from your shell:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the complete option list and response behavior in the ScreenshotNeo documentation. The service also has an MCP server with take_screenshot, get_page_info and capture_pdf tools for Claude, Cursor and other MCP clients. It supports full-page and selector captures, device and viewport settings, dark mode, retina scale, PDF controls, custom CSS and JavaScript, clicks, waits, request blocking, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, chosen cache TTLs, signed image links, asynchronous webhooks, bulk capture of up to 100 URLs per call, usage data and an OpenAPI specification.
There is a free allowance of 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 screenshots; every feature is included on every plan. Create a free ScreenshotNeo account.
FAQ
Do skipped steps indicate separate missing definitions?
Usually no. After the first undefined step, Cucumber skips subsequent steps in that scenario, so diagnose the earliest undefined line first.
Can one definition support both quoted and unquoted values?
Yes, but the expression or regular expression must explicitly accept both forms. Keeping one documented syntax is generally easier to maintain.
Should all step definitions be global?
Only when that is your intended architecture. Feature-specific pairing limits accidental coupling; shared globs are appropriate for deliberately reusable definitions.
Frequently Asked Questions
Do skipped steps indicate separate missing definitions?
Usually no. After the first undefined step, Cucumber skips subsequent steps in that scenario, so diagnose the earliest undefined line first.
Can one definition support both quoted and unquoted values?
Yes, but the expression or regular expression must explicitly accept both forms. Keeping one documented syntax is generally easier to maintain.
Should all step definitions be global?
Only when that is your intended architecture. Feature-specific pairing limits accidental coupling; shared globs are appropriate for deliberately reusable definitions.
The Bottom Line
Fix undefined Cypress Cucumber steps by proving the expression matches the text, the file is paired through an active glob, one configuration source is winning, and the maintained package is used consistently. Treat bundler compilation errors as a separate problem.
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.
Free tools Windows power users keep installed
One-click scans. No signup required.

