Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Most Cypress Support file missing or invalid and We found an error preparing your test file failures come from one of five things: an incorrect supportFile path, a missing or duplicate file, a syntax or dependency error, a browser-incompatible import, or (when the message names the config) an ESM/CommonJS mismatch. Check the failing filename first, then follow the matching path below.

First identify which file actually failed

Cypress has two different loading paths that are easy to confuse:

  • End-to-end support: normally cypress/support/e2e.js (also .jsx, .ts, or .tsx). Cypress bundles it and loads it before each spec.
  • Configuration or plugin code: normally cypress.config.js and code registered through setupNodeEvents. This is loaded by Node, not by the browser bundle.

If the stack trace names cypress/support/e2e.js, use the support-file checks. If it says Error Loading Config, mentions cypress.config.js, or points to a plugin, use the module-format section as well.

Check the support-file path and configuration scope

Use the default path when possible

With no override, create exactly one file at cypress/support/e2e.js. Check capitalization, spelling, extension, and the directory from which Cypress is launched. A file named e2e.jsx, e2e.ts, or e2e.tsx is also valid; a differently named file is not selected unless configured.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Put a custom path under e2e

Since Cypress 10.0.0, supportFile belongs inside the testing-type object. For example:

const { defineConfig } = require('cypress')

module.exports = defineConfig({
  e2e: {
    supportFile: 'cypress/support/my-e2e.js'
  }
})

Do not put supportFile at the configuration root. A root-level setting is obsolete and can itself produce an Error Loading Config message. To disable the e2e support file deliberately, set e2e.supportFile to false.

Make the match unambiguous

Search the project for files that match the configured support-file pattern. Keep one intended entry point for the testing type. Duplicate matching files can cause Cypress to reject the setup even when each file is individually valid.

Verify the file exists and can be bundled

  1. Open the configured path in the same project directory where Cypress runs.
  2. Confirm the file is committed, readable, and has the expected extension.
  3. Read the first reported filename and line number in the Cypress error panel; do not assume the headline identifies the true source.
  4. Temporarily reduce the support file to a minimal statement such as console.log('support loaded'). If Cypress starts, restore imports one at a time to find the failing dependency.

Cypress documents missing files, syntax errors, and missing dependencies as common test-file preparation causes. A dependency imported by e2e.js can fail compilation even though the support file itself looks correct.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Fix JavaScript syntax and dependency errors

Check syntax at the reported line

Look for an unclosed brace or parenthesis, a missing comma, malformed template literal, or a TypeScript/JSX construct in a file whose extension does not support it. Keep the support entry point valid for the language you selected and ensure every imported file is parseable by Cypress’s bundler.

Resolve every import

Check relative paths from cypress/support/e2e.js, package names in package.json, and the lockfile after a clean install. Case-sensitive operating systems will reject an import whose capitalization differs from the actual filename. If a package is required only by one command, import it in the narrowest module possible rather than making every spec load it.

Keep the support bundle focused

The support file and its imports are loaded before every spec. Remove unused imports and avoid importing an entire application bundle merely to register one command. This reduces preparation time and limits the number of modules that can break startup.

Move Node-only work out of e2e.js

Support code runs in the browser context. Modules such as fs, database drivers, and server-side SDKs are Node-oriented and should not be imported into the browser bundle. Put that work in the Node-side setupNodeEvents function, then expose a narrowly scoped operation to tests with cy.task().

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

Browser-side support file

// cypress/support/e2e.js
Cypress.Commands.add('seedData', () => {
  cy.task('seedDatabase')
})

Node-side configuration

// cypress.config.js
const { defineConfig } = require('cypress')

module.exports = defineConfig({
  e2e: {
    setupNodeEvents(on, config) {
      on('task', {
        seedDatabase() {
          // Use fs, a database client, or another Node-only API here.
          return null
        }
      })
      return config
    }
  }
})

If removing a Node import makes the preparation error disappear, the runtime boundary—not JavaScript syntax—was the cause.

Handle ESM and CommonJS errors in config or plugins

Messages such as Cannot use import statement outside a module must be classified by the file named in the stack trace. Cypress 15.17.0 introduced Node-style module selection for configuration and plugin files and no longer retries the other loader after a failure:

  • .mjs selects ESM.
  • .cjs selects CommonJS.
  • .js follows the nearest package.json type: module means ESM; omitted or commonjs means CommonJS.

Align syntax and extension. For CommonJS, use require and module.exports. For ESM, use import and export default, and ensure the nearest package metadata selects ESM. This rule concerns config/plugin loading; e2e.js still travels through Cypress’s support/spec bundling pipeline.

Symptom-to-cause checklist

Message or symptom First checks Likely correction
Support file missing or invalid e2e.supportFile, exact path, existence, duplicates Restore the default path or correct the nested setting; keep one match.
We found an error preparing your test file Reported line, imports, package installation, browser compatibility Fix syntax, install/rename the dependency, or move Node code to a task.
Error Loading Config mentioning supportFile Config version and option scope Move supportFile under e2e (or component for component tests).
Cannot use import statement outside a module Whether the failing file is config/plugin or support For config/plugin, align extension and nearest package type; for support, inspect bundled imports.

Exact wording and stack traces vary by Cypress version, so treat the label as a routing hint rather than proof of the cause.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

A repeatable recovery procedure

  1. Copy the complete error, including the first file path and line.
  2. Classify the file as support, config, or plugin.
  3. For support, verify e2e.supportFile, file existence, and duplicate matches.
  4. Replace the entry point temporarily with a minimal script and re-add imports one at a time.
  5. Move filesystem, database, and other Node-only operations into setupNodeEvents and call them with cy.task().
  6. For config/plugin failures, check the Cypress version (especially 15.17.0 or later), extension, and nearest package.json type.
  7. Restart the Cypress process after changing configuration or dependencies so the new bundle is built.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If your goal is a clean image of a web page rather than running Cypress tests, ScreenshotNeo provides a single HTTP request. It accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed; response headers identify the page verdict and whether the shot was billed.

Using the API requires an access key. The complete option set includes full-page capture with lazy images, CSS-selector element capture, dark mode, device presets or custom viewports, retina scale, PDF settings, HTML/CSS rendering, custom JavaScript and CSS, clicks, waits, request blocking, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, configurable caching, signed image links, asynchronous jobs with signed webhooks, bulk capture of up to 100 URLs per call, usage data, and an OpenAPI specification. Familiar parameter names used by other screenshot APIs are accepted to ease migration.

cURL

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Python

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Node.js

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

See the ScreenshotNeo API documentation for request options and response headers. An MCP server also lets Claude, Cursor, and other MCP clients call take_screenshot, get_page_info, and capture_pdf. The Free plan includes 1,000 shots each month with no card; paid plans start at $5 for 3,000 shots, and every feature is included on every plan. Create a free ScreenshotNeo account.

FAQ

Can I set one support file for both testing types?

Configure e2e and component testing separately. Each testing type has its own support-file setting and expected runtime.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Why does the error appear only after adding a command?

A command often introduces a new import. The command may be valid while that imported package is missing, unparsable, or browser-incompatible; isolate the new import to confirm.

Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Should I rename e2e.js to e2e.mjs?

Not to fix a support-bundle error. The .mjs/.cjs selection rule described above is for Cypress config and plugin files; first correct the support path and its bundled dependencies.

Frequently Asked Questions

Can I set one support file for both testing types?

Configure e2e and component testing separately. Each testing type has its own support-file setting and expected runtime.

Why does the error appear only after adding a command?

A command often introduces a new import. The command may be valid while that imported package is missing, unparsable, or browser-incompatible; isolate the new import to confirm.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Should I rename e2e.js to e2e.mjs?

Not to fix a support-bundle error. The .mjs/.cjs selection rule is for Cypress config and plugin files; first correct the support path and bundled dependencies.

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.