Skip to content

Update webpack from 5.97.1 to 5.98.0 causes tests stop running with component testing #1296

@KarineBrandelli

Description

@KarineBrandelli

Description

Cypress component tests fail to run when the webpack dependency is updated from 5.97.1 to version 5.98.0 or any later version. The issue does not appear to affect end-to-end (e2e) tests in other projects, suggesting it is specific to component testing.

This error also occured to me eventually when I added some step (a new Then/When) and saved the file (not sure it helps).

Steps to reproduce

  1. Acess the codesandbox and fork the repo: https://codesandbox.io/p/devbox/cypress-cucumber-3y4jwl
  2. Open the terminal
  3. Run yarn to install dependencies
  4. Run yarn cy:run to execute the tests. The tests should pass at this stage
  5. Open the package.json file
  6. Change the webpack version from 5.97.1 to 5.98.0
  7. In the terminal, run yarn again to update the dependencies
  8. Run yarn cy:run in the terminal

Observe that the Cypress component tests now fail.

Version 5.97.1:
Image

Version 5.98.0 (and all above)
Image
Image

Full error:

  1) An uncaught error was detected outside of a test:
     TypeError: The following error originated from your test code, not from Cypress.

  > Cannot read properties of null (reading 'replace')

When Cypress detects uncaught errors originating from your test code it will automatically fail the current test.

Cypress could not associate this error to any specific test.

We dynamically generated a new test to display this failure.
      at maybeRetrievePositionFromSourceMap (http://localhost:8080/__cypress/src/vendors-node_modules_badeball_cypress-cucumber-preprocessor_dist_entrypoint-browser_js-node_m-d01cc3.js:2416:39)
      at Registry.defineStep (http://localhost:8080/__cypress/src/vendors-node_modules_badeball_cypress-cucumber-preprocessor_dist_entrypoint-browser_js-node_m-d01cc3.js:2868:75)
      at defineStep (http://localhost:8080/__cypress/src/vendors-node_modules_badeball_cypress-cucumber-preprocessor_dist_entrypoint-browser_js-node_m-d01cc3.js:1594:35)
      at ./cypress/integration/common/when.step.tsx (webpack://storybook-webpack-react/./cypress/integration/common/when.step.tsx:7:0)
      at __webpack_require__ (http://localhost:8080/__cypress/src/main.js:2709:42)
      at ./cypress/integration/features/check-tree.feature (webpack://storybook-webpack-react/./cypress/integration/features/check-tree.feature:5:4)
      at __webpack_require__ (http://localhost:8080/__cypress/src/main.js:2709:42)
      at __webpack_require__.t (http://localhost:8080/__cypress/src/main.js:2757:38)

Desired behavior

The Cypress component tests should pass regardless of the webpack version (5.97.1, 5.98.0, or later). The update to webpack should not cause the tests to fail.

Cypress version

14.3.2

Preprocessor version

22.0.1

Node version

20.12.0

Operating system

Ubuntu 22.04

Checklist

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions