Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →If you see “jQuery is not defined” while running a Cypress test, first identify which environment raised it: Cypress’s test code, the application loaded by cy.visit(), or the spec’s compile/preprocess step. Cypress bundles jQuery for its own use, but that does not automatically add jQuery or $ to your application’s window. Use Cypress.$ for immediate DOM traversal in Cypress code, cy.get() for retryable test queries, and fix the application’s script or module loading when the app itself needs jQuery.
First find which environment is missing jQuery
The same message can describe three different problems. Locate the first relevant stack-trace frame and note whether the browser page has loaded. Cypress tests and the application under test (AUT) run in different contexts; a compile error occurs earlier still.
| Where the error appears | Likely issue | First check |
|---|---|---|
Application code after cy.visit() |
The page or its bundle did not load jQuery before code that depends on it, or the page does not expose a global. | Inspect the AUT window with cy.window(). |
| A spec or support file running in the Cypress test context | Test code expects a global that is not available there, or uses a synchronous jQuery pattern where Cypress commands are needed. | Use cy.get() for test actions or Cypress.$ for immediate traversal. |
| Before the test runs, during import or bundling | The preprocessor or bundler cannot resolve an import or configured alias. | Check the active dev-server or bundler configuration, not just TypeScript settings. |
Cypress documents Cypress.$ as “jQuery, for DOM traversal outside of Cypress commands” and lists jQuery among the utility libraries bundled with Cypress (Cypress utility API). That is a Cypress-side facility; it does not establish that the application has loaded jQuery.
When application code raises the error
If a plugin or application script refers to jQuery before that identifier exists, fix the application’s dependency loading. Cypress is not a substitute for a missing production or test-build dependency.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errors#1 Best Overall
Load scripts in dependency order
For a page using script tags, load jQuery before every plugin or script that calls it. Confirm that the jQuery URL responds successfully, that the page actually includes it, and that the test or production build has not omitted it. The jQuery Learning Center illustrates this order by loading jquery.js before registering code that uses jQuery (How jQuery Works).
<script src="/js/jquery.js"></script>
<script src="/js/plugin-that-uses-jquery.js"></script>
<script src="/js/app.js"></script>
Use the actual paths and order required by your application. If jQuery is supplied by a CDN, inspect the browser’s network panel for a failed or blocked request as well as the console for the first error; a later script cannot use a dependency that did not load.
For bundled applications, express the dependency in the bundle
In a module-based app, import jQuery and dependent plugins in the application entry point in dependency order. Do not assume that importing a module necessarily creates window.jQuery or window.$; module scope and browser globals are not interchangeable. If a legacy plugin explicitly requires a global, configure the application’s supported bundler to expose it, then verify the result in the AUT window. The exact configuration is framework- and bundler-specific.
Verify the application window
cy.window() yields the active page window, which is the relevant place to check an application global (Cypress cy.window() documentation).
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 →Rank #2
cy.visit('/page');
cy.window().should((win) => {
expect(typeof win.jQuery).to.equal('function');
});
This assertion is appropriate only if the app is intended to expose a global. If the app uses modules without a global, verify the behavior that depends on jQuery through the public UI or API instead of requiring window.jQuery.
When Cypress test code needs jQuery or the DOM
Choose the Cypress mechanism according to the job. Cypress commands are queued and yield results later; Cypress.$ is an immediate jQuery function for DOM traversal outside the command chain.
Prefer Cypress queries for test actions and assertions
cy.get('[data-testid="dialog"]').should('be.visible');
This lets Cypress manage the query and retry behavior. Do not treat cy.get() as a synchronous function that immediately returns a jQuery object. Cypress explicitly warns, “This will not work! Cypress does not return the element synchronously” in its discussion of the command chain (Cypress introduction: mixing async and sync code).
Use Cypress.$ for immediate traversal in Cypress code
const $dialog = Cypress.$('[data-testid="dialog"]');
if ($dialog.length) {
// Immediate traversal or inspection in Cypress's context.
}
Use this for synchronous inspection or a utility that genuinely needs immediate traversal. It is not a replacement for an application dependency: if an app plugin calls window.jQuery, supplying Cypress’s jQuery does not load that plugin’s dependency into the AUT.
Recommended Free Tools
Rank #3
Keep callback boundaries clear
Do not assign the result of a Cypress command as though it were an immediate value:
// Avoid: cy.get() does not synchronously return the element.
const dialog = cy.get('[data-testid="dialog"]');
Instead, keep work that depends on the yielded subject in the chain:
cy.get('[data-testid="dialog"]').then(($dialog) => {
expect($dialog).to.have.length(1);
});
Within such a callback Cypress yields the matched subject; use the chain for actions and assertions that benefit from Cypress’s command model.
When $ is the problem, not jQuery
A missing jQuery identifier and a collision over $ are different failures. Another library may own $ even though jQuery is loaded. In that case, use jQuery explicitly or relinquish jQuery’s claim to $ with noConflict().
Rank #4
jQuery.noConflict();
jQuery(function ($) {
// $ is a local jQuery alias inside this ready callback.
});
jQuery’s guidance says to enter no-conflict mode immediately after loading jQuery and before using it when avoiding conflicts (Avoiding conflicts with other libraries). The API describes jQuery.noConflict() as relinquishing jQuery’s control of the $ variable (jQuery.noConflict()). The ready callback can receive a local $ alias even when the global shorthand is unavailable (jQuery ready event).
noConflict() does not restore a missing or failed jQuery script. If jQuery itself is undefined, repair loading or bundling first. If the project loads multiple jQuery versions, decide deliberately which code owns each version and global rather than relying on load order accidentally.
When the error happens before the browser test starts
If the stack trace points to a spec/support import or the build reports an unresolved module, troubleshoot preprocessing. Confirm which Cypress dev server or preprocessor is compiling the spec, and whether its bundler can resolve the package or alias. A TypeScript path mapping alone does not configure webpack: Cypress’s webpack documentation says aliases must also be explicitly configured there (Cypress TypeScript support).
- Check that the dependency named in the import is installed in the project used by the test runner.
- Check that the active bundler configuration includes the alias and points it to the intended file.
- Check that the Cypress dev-server or preprocessor actually uses that configuration.
- Distinguish a compile-time unresolved import from a browser runtime error; changing the AUT’s script tags will not resolve a spec import the bundler cannot find.
Cypress’s dev-server setup can vary by framework and version, so use the configuration path for the server selected by your project rather than copying an alias recipe for a different tool (Cypress component testing framework configuration).
Choose the fix by failure mode
| Symptom | Correct direction | Do not do this |
|---|---|---|
App plugin says jQuery is not defined |
Load or import app jQuery before the plugin; expose a global only if the plugin requires it. | Assume Cypress’s bundled library injects a global into the app. |
| Test wants to find or act on an element | Use cy.get() and continue the Cypress chain. |
Expect cy.get() to synchronously return a jQuery object. |
| Test utility needs immediate DOM traversal | Use Cypress.$ in Cypress’s context. |
Use that function to satisfy an app plugin’s window.jQuery dependency. |
jQuery exists but $ is wrong |
Use jQuery or a local alias with noConflict(). |
Use noConflict() to mask a failed jQuery request. |
| Spec fails to compile or import | Configure the active preprocessor/bundler alias explicitly. | Rely on TypeScript paths as if they automatically configure webpack. |
Troubleshooting checklist
- The app console points to a plugin. Inspect the AUT’s network requests and entry-point order. Make sure jQuery succeeds and precedes the plugin in the test build as well as the normal build.
win.jQueryis undefined but the UI works. The app may intentionally bundle jQuery without exposing a global. Test the user-visible behavior rather than enforcing a global the app does not promise.win.jQueryexists butwin.$is not jQuery. Check whether another library owns$; usejQueryor a local ready-callback alias.Cypress.$works but app code still fails. These are different contexts. Repair the AUT’s own dependency loading rather than changing Cypress test helpers.- A Cypress command appears to have no usable value. Keep dependent work inside
.then()or another Cypress chain callback; commands are not synchronous return values. - An alias resolves in the application but not the spec. Configure the bundler used for Cypress preprocessing. A TypeScript path entry is not, by itself, a bundler alias.
- The problem appears only in CI or a test build. Compare the scripts, environment, and bundler configuration used there with the working build; confirm that the jQuery asset or package is present in that path.
Or skip the browser setup
If your goal is to capture a page screenshot rather than test application behavior, ScreenshotNeo provides a screenshot API and MCP server. One GET request can return a PNG, JPEG, WebP, or PDF. Its capture can accept cookie/consent banners and remove more than 60 known consent platforms, newsletter popups, and chat widgets; those steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers report the page verdict and billing status.
For a direct capture, create an API key and run this cURL request; see the ScreenshotNeo documentation for request options.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
ScreenshotNeo also has an MCP server with take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Learn about ScreenshotNeo or sign up for 1,000 free screenshots a month with no card.
FAQ
Is Cypress’s jQuery the same as my application’s jQuery?
It is a bundled Cypress utility available to Cypress code. Do not assume it is the same instance as, or a global in, the application window.
Free tools Windows power users keep installed
One-click scans. No signup required.
Should I add jQuery to Cypress just to use $?
Usually not. Use cy.get() for Cypress-managed queries or Cypress.$ for immediate traversal in Cypress code. Add or expose jQuery in the application only when the application actually depends on it.
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.

