Files
cypress/packages/driver
Bill Glesias f3b67666a5 fix: update cypress to Typescript 5 (#29568)
* fix: update the monorepo to typescript 5

* chore: updating v8 snapshot cache

* chore: updating v8 snapshot cache

* chore: updating v8 snapshot cache

* run ci to see problems [run ci]

* update vue-tsc and typings that conflict with update

* regen snapshot

* fix typescript errors ui test as stack trace behavior has changed

* fix server unit tests

* update cy.origin() spec based on stack traces and code frames

* update spec to include source map url

* run ci

* fix check-ts

* chore: fix system tests [run ci]

* add preprocessor tests to batteries included to exercise new logic

* run ci

* refactor unit tests to be a bit more dry

* pin typescript to ~5.4 and adjust config to ignroe deprecations but keep importsNotUsedAsValues

* add changelog entry

* add fixme issue to stack trace mismatches inside evaled context

* use import type webpack as webpack as a lib isn't actually invboked in the runner webpack config

* fix system test as adding 4 lines of comments impacts the stack trace line 4 lines (duh)

---------

Co-authored-by: cypress-bot[bot] <+cypress-bot[bot]@users.noreply.github.com>
2024-06-04 19:17:38 -04:00
..

Driver

This is the core JavaScript library that is loaded inside the browser that is responsible for executing Cypress commands and managing the test runtime.

Building

The driver is actually consumed by the runner like any other npm module. To develop the driver and see changes reflected you need to run the watch task inside of the runner.

yarn workspace @packages/runner watch

Developing

If you're developing on the driver, you'll want to run in the normal Cypress GUI mode, like you would when you're writing tests for your own Cypress projects.

yarn workspace @packages/driver cypress:open

Read the runner's README.md for more information.

Running

You can also run all of the driver's tests locally. We don't really recommend this because it takes a long time, and we have this process optimized by load balancing the tests across multiple workers in CI.

It's usually easier to run the tests in the GUI, commit, and then see if anything broke elsewhere.

# in separate terminal
yarn workspace @packages/driver cypress:run

# or for development
yarn workspace @packages/driver cypress:open

Debug Logs

The debug module is used to generate debug logs for the driver. In the browser, you can enable driver debug logs by setting localStorage.debug in the console:

localStorage.debug = "cypress:driver,cypress:driver:*"

Note: you may need to enable "Verbose" or "Debug" log levels inside the browser's developer tools, since not all browsers display debug logs by default.

Patches

  • sinon
  • unfetch to polyfill fetch. Added constructor function to point XMLHttpRequest to the application under test window.

Note: when creating a patch, make sure there is no package-lock.json file! Also rename the patch to have ".dev.patch" extension.

Cross-origin Testing

Working on cross-origin testing or reviewing a PR related to it? Check out the Cross-origin Testing Technical Overview.