Commit Graph

136 Commits

Author SHA1 Message Date
Tyler Biethman
defde91f2a fix: process_profiler follow up work for v10 (#22363)
* fix: process_profiler follow up work for v10

* Converting index file to ts
2022-06-22 11:44:58 -05:00
Lachlan Miller
abd986aa41 fix: support ESM projects using TypeScript with ts-node/esm (#22118)
* fix: support ESM projects using TypeScript with ts-node/esm

* better error handling

* fix test

* indentation

* register ts-node via --require hook

* be less aggressive with erroring

* update fix system tests

* remove obsolete test

* handle case of not using typescript

* replicate 9.x behavior for legacy plugins w/ ts-node

* make test project valid and adjust tests accordingly

* use ts-node/esm transpile only

* dummy

* extract util function

* merge in refactor using projectFixtureDirectory

* fix test
2022-06-09 21:20:26 +10:00
Tim Griesser
b83bdc2000 fix: #22038 support esm import for windows (#22042)
* fix: #22038 better windows ESM interop

* updates from @flotwig feedback
2022-06-02 15:24:01 -04:00
Tim Griesser
369a865237 fix: partial fix for #21997 & #22004, throw the originalError (#22009)
* fix: partial fix for #21997 & #22004, throw the originalError

* throw originalError test

Co-authored-by: Zach Bloomquist <git@chary.us>
2022-06-01 16:54:07 -04:00
Tim Griesser
566a7b1feb fix: UNIFY-1774 error if component config is not sourced for webpack/vite (#21563)
* fix: UNIFY-1774, throw error if we do not detect a webpackConfig for the user

* remove dead code, rely on auto-sourcing webpack config

* fix error styles, exit the devServer process when config is missing, guard against empty remoteState

* Add missing webpack for todos project

* Update npm/webpack-dev-server/src/makeWebpackConfig.ts

Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>
Co-authored-by: Zachary Williams <ZachJW34@gmail.com>
2022-05-31 14:34:05 -04:00
Jess
996823cd94 fix: support loading config files for projects with type module, without esbuild (#21574)
* fix: support loading config files for projects with type module, without esbuild

* fix: adding process.cwd() to require.resolve paths so that system-tests do not use local dev version of esbuild

* fix: add missing esbuild in test projects

Co-authored-by: Tim Griesser <tgriesser10@gmail.com>
2022-05-31 14:25:08 -04:00
Ryan Manuel
f2bce02f5d fix: issue with compilation failures in component testing (#21599)
* fix: issue with compilation failures in component testing

* add tests

* fix tests

* Refactor tests

* Fix tests

* Refactor tests

* Fix tests

* Fix paths for dependencies in system tests

* Fix tests

* Fix tests

* Fix tests

* Fix tests

* test fix for initial esbuild failures

* Fix tests

* Add back ESLintPlugin

* Add comments around our special esbuild handling logic in vite

* Code cleanup and additional test scenario

* Add config syntax error tests

* Improve tests

* Update comment and remove unused variable

* Remove unneeded hook in webpack dev server

* Disable dev server overlay

* Revert "Remove unneeded hook in webpack dev server"

This reverts commit 98b2f269ae.

* PR comments

* Accidental removal

* Fix dedent

* PR comments
2022-05-25 18:02:05 -05:00
Alejandro Estrada
fbe645224e fix: handle errors on plugins migration child process (#21442)
* fix: handle errors on plugins migration child process

* Update error handler

* Remove console.log
2022-05-13 16:04:35 -05:00
Ryan Manuel
9612686241 fix: issue with generating cypress.config.js in projects with type of module (#21323)
Co-authored-by: Zach Bloomquist <git@chary.us>
2022-05-04 16:41:11 -05:00
Zachary Williams
00a0f5a0e9 fix: restart dev-server on config change (#21212)
* fix: restart dev-server on config change

* close dev server before cp is spawned

* fix test that is failing... not sure why

* cleanup unsued close events

* remove wait

* add back in close for unit tests

Co-authored-by: Tim Griesser <tgriesser10@gmail.com>
2022-05-02 12:05:01 +10:00
Lachlan Miller
22e7d36673 fix: update dev server error message (#21181)
* fix: update dev server error message

* revert change

* remove obsolete test

* revert change

* update errors

* rename error
2022-04-26 12:37:18 +10:00
Jess
b326693879 chore: cutting over system-tests and Cypress to use the new CT Object API (#21079)
* removing vite-dev-server local dependency from react-vite-ts-configured system test

* moving some CRA examples over to use the object api for setup

* fixing issue where function API was broken by object API for cy config + devservers

* adding deeply nested react import to project-fixtures for cra

* finishes cutting over cypress/react for sys tests

* chore: adding circle for this feature branch

* chore: moving over many vue + vite system tests to use object API instead of function API (#21080)

* doing webpack-dev-server cutovers

* removing more webpack-dev-server refrences

* fixing snapshots

* bumping yarn.lock

* wip

* fix test

* fix assertion

Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>

* feat: removing all references for "fresh" dev servers (webpack-dev-server-fresh and vite-dev-server-fresh) (#21094)

Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>
Co-authored-by: Zachary Williams <ZachJW34@gmail.com>

* chore: add dev-servers as deps to server to be included in the binary (#21091)

* fix bad merge

* fix next types and webpack-dev-server- resolve

Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>
Co-authored-by: Zachary Williams <ZachJW34@gmail.com>
2022-04-20 15:57:19 +10:00
Blue F
13caf93b3e Merge branch '10.0-release' into develop-10.0-release 2022-04-14 10:32:05 -07:00
Tom Udding
57dbc170e6 fix: Plugin error when sending on disconnected IPC channel (#21011)
* fix: Plugin error when sending on disconnected IPC channel

* Add unit test for new no send behaviour

Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com>
2022-04-13 11:51:27 -05:00
Alejandro Estrada
0af82eaf64 fix: display correct error location (#21003)
* fix: display correct error location

* Update ts_node

* Add test

* Fix test

* Update with feedback
2022-04-11 13:05:13 -04:00
Tim Griesser
e1da852473 feat: add new webpack-dev-server package based on object API & bundling (#20861)
Adds the new webpack-dev-server-fresh package, exposing the new object api. This package will eventually be merged with/replace the existing webpack-dev-server

closes: UNIFY-1267
2022-04-05 12:05:33 -04:00
Barthélémy Ledoux
8381efe262 fix: build mjs in the cli (#20889)
Co-authored-by: Tim Griesser <tgriesser10@gmail.com>
2022-04-04 17:58:56 -05:00
Ryan Manuel
f9436ab130 Additional code cleanup 2022-03-29 13:17:25 -05:00
Barthélémy Ledoux
1de1aa5ccc feat: error when updating a 9.X value in 10.X in the pluginsFile (#20521) 2022-03-24 11:52:51 -05:00
Emily Rohrbough
efede20d9e chore(unification): remove pluginsFile references (#20560)
* remove pluginsFile references

* fix all tests relying on this system test

* fix broken tests

* fix more broken tests

* one more

* relative path

* pr feedbkac

* fix vite-dev-server broken configuration

* PR feedback on error message

* update errors snaphsot

* bring back error in gql

* fix snapshot

* fix snapshot.

* fix merge issues

Co-authored-by: ElevateBart <ledouxb@gmail.com>
2022-03-15 11:27:04 +10:00
Jess
c2cc967227 feat: adding module support for invoking cypress.config.mjs, .cjs, .ts (#20554)
* feat: adding module support for invoking cypress.config.mjs, .cjs, .ts

Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>
2022-03-14 10:46:29 -04:00
Lachlan Miller
742f261a1b fix(launchpad): correctly migrate projects settings config in plugins (#20509)
Co-authored-by: Barthélémy Ledoux <bart@cypress.io>
2022-03-11 13:04:06 -06:00
Tim Griesser
92eac2f67e feat: Error standardization (#20323)
* refactor: reworking client-side error shape

* feat: add the CodeFrame to baseerror

* consolidate baseError handling, type fixes

* Fix UNIFY-1164 w/ test cleanup to avoid intercepting

* fix types, cleanup based on review / Brian

* fix: imports / types / tests

* cleanup tests, fix TSError location, add reinitializeCypress mutation

* fix: show correct stack trace file name (#20410)

* Improve comments for regexes / TSError capture

* feat: Add codeframe to error, address PR comments

* update snapshot

* change codeframe impl, per Brian's request

* Attempt to fix test flake

Co-authored-by: ElevateBart <ledouxb@gmail.com>
Co-authored-by: Alejandro Estrada <estrada9166@hotmail.com>
2022-03-02 18:03:52 -05:00
Tim Griesser
47b1f38f62 Merge branch 'develop' into 10.0-release
* develop: (35 commits)
  fix(deps): update dependency url-parse to v1.5.6 [security] (#20270)
  chore: fix cache keys to include PLATFORM (#20279)
  chore: fix server performance flake (#20271)
  test(system-tests): support docker-based tests against built binary (#20250)
  chore: fix system-test-firefox screenshots_spec flake (#20268)
  chore(deps): update dependency fs-extra to v9 🌟 (#19939)
  fix: Wait for child process to be ready (#19792)
  fix: treat form-data bodies as binary (#20144)
  test: replace cypress-test-example-repos coverage + remove bump (#20186)
  fix(driver): update wrapErr to ignore number and boolean values (#20172)
  release 9.5.0 [skip ci]
  chore: Update Chrome (stable) to 98.0.4758.102 (#20192)
  chore: enable volar.takeOverMode
  Add span names, merge develop
  fix: Update `.type(' ')` to not emit clicks when the keyup event has been prevented (#20156)
  test: remove redundant "other projects" CI jobs (#20133)
  chore(driver): move cy.focused and cy.root into their own files (#20054)
  Move sending root event to own script
  chore: release @cypress/vue-v3.1.1
  chore: release @cypress/react-v5.12.3
  ...
2022-02-22 12:40:07 -05:00
Brian Mann
61a5a84764 rename a bunch of errors for consistency 2022-02-22 10:06:05 -05:00
Tim Griesser
73def69360 Fixing CONFIG_VALIDATION_ERROR / SETUP_NODE_EVENTS_IS_NOT_FUNCTION errors 2022-02-21 17:37:39 -05:00
Tim Griesser
7e8370a2a5 working through mapping error cases from develop 2022-02-21 17:07:46 -05:00
Tim Griesser
d3b1969a75 update CONFIG_FILE_REQUIRE_ERROR 2022-02-21 16:23:48 -05:00
Tim Griesser
4478048a6a fix: serialize details when serializing the error 2022-02-21 14:00:27 -05:00
Johannes Ewald
ad50062ca2 fix: Wait for child process to be ready (#19792)
Co-authored-by: Zach Bloomquist <github@chary.us>
Co-authored-by: Zach Bloomquist <git@chary.us>
2022-02-17 18:21:08 +00:00
Tim Griesser
6727893b1e fix: additional cleanup of errors following merge 2022-02-17 09:59:30 -05:00
Tim Griesser
9a1874d6a8 fix: clean up a few test failures 2022-02-16 17:07:53 -05:00
Brian Mann
923ab0a9ba export additional properties on error, update refs, fix tests 2022-02-15 02:03:14 -05:00
Brian Mann
81a0b0f0d2 fix require, lazy load if necessary 2022-02-14 18:58:34 -05:00
Tim Griesser
6279a7dd10 wip: type fixes & changes after merge 2022-02-14 08:20:11 -05:00
Tim Griesser
678bedeca6 Merge branch 'develop' into 10.0-release
* develop:
  feat: gray out the path to system node in cypress run header (#20121)
  feat: redesign server errors (#20072)
  test: fix awesome-typescript-loader test and remove test-binary job (#20131)
  fix: Fix issues with stack traces and command log in Chrome 99 (#20049)
  fix: `cy.type(' ')` fires click event on button-like elements. (#20067)
  fix: `change`, `input` events are not fired when the same option is selected again. (#19623)
  build: publish vue3 on latest (#20099)
  chore: release @cypress/webpack-preprocessor-v5.11.1
  chore: release @cypress/webpack-dev-server-v1.8.1
  fix: detect newly added specs in dev-server compilation (#17950)
  chore: Remove pkg/driver //@ts-nocheck part 3 (#19837)
  chore: set up semantic-pull-request GitHub Action (#20091)
  chore: release @cypress/react-v5.12.2
  fix: remove nullish coalescing in js files to support node 12 (#20094)
  docs: update @cypress/webpack-preprocessor links (#19902)
  refactor: use aliases instead of meta (#19566)
2022-02-13 15:36:48 -05:00
Brian Mann
29841f32b9 feat: redesign server errors (#20072)
* chore: rename errors.js -> errors.ts

* refactor: type safety on errors

* refactor: add err_template for consistent error formatting

* fix a few system tests

* fix tests; update snapshots

* Fix types

* normalize snapshot - remove chalk ansi colors

* more unit test fixes

* more system test fixes

* circleci build

* backtick always in stdout, fix error formatting and failing snapshots

* refactor: create @packages/errors

* fix import

* fix import

* fixing build / tests

* remove extraneous file

* move warnIfExplicitCiBuildId

* fix build / tests

* Fix

* error, type fixes, documentation, standardize child process error serialization

* fix import

* build errors on install

* wrote specs generating visual images of all errors

* remove unused dep

* sanitize stack traces

* add image diffing

- if base images don't exist, create them
- if base images don't match and local, overwrite them, if in CI throw
- if base images are stale and local, delete them, if in CI throw

* remove Courier New + MesloLGS NF font

* type fixes, remove Bluebird, general cleanup

* TS Cleanup

* skip typecheck on tests for now

* yarn.lock

* fix @types/chai version

* fix yarn.lock

* Different version of mocha types so it isnt patched

* errors spec snapshot

* CI fix

* fixes

* store snapshot images in circle artifacts

* dont change artifact destination prefix

* use Courier Prime

* antialias the text

* decrease pixelmatch threshold, fail in CI only when changed pixels > 100

* increase timeout

* overflow: hidden, remove new Promise, add debug logging

Co-Authored-By: Tim Griesser <tgriesser@gmail.com>

* run unit tests w/ concurrency=1

* unique window per file

* disable app hardware acceleration + use in process gpu + single process

* do not do image diffing

- conditionally convert html to images
- store html snapshots
- do not store images in git

* store snapshot html

* Merge branch 'tgriesser/chore/refactor-errors' of https://github.com/cypress-io/cypress into tgriesser/chore/refactor-errors

* remove concurrency

* fix assertion

* fixing ci

* Link in readme

* pass the browsers to listItems

* fix: build @packages/errors in CI, defer import to prevent errors locally

* Merge branch 'develop' into tgriesser/chore/refactor-errors

* develop:
  chore: fix cypress npm package artifact upload path (#20023)
  chore(driver): move cy.within logic into it's own file (#20036)
  chore: update automerge workflows (#19982)
  fix(selectFile): use target window's File/DataTransfer classes (#20003)
  chore: Update Chrome (stable) to 98.0.4758.80 and Chrome (beta) to 98.0.4758.80 (#19995)
  fix: Adjust ffmpeg CLI args for performance (#19983)
  build: allow unified to run cypress on Apple Silicon (arm64) (backport #19067 to 9.x) (#19968)

* fix run-if-ci.sh

* remove dead code

* Mark the .html files as generated in gitattributes

* fix running single error case, slice out more of the brittle stack

* remove additional brittle stack line

* firefox web security error

* nest inside of describe

* reformat and redesign errors

* more error cleanup and standardization

* additional formatting of errors, code cleanup, refactoring

* update ansi colors to match terminal colors

* cleanup remaining loose ends, update several errors, compact excess formatters

* fix types

* additional formatting, remove TODO's, ensure no [object Object] in output

* add test for 412 server response on invalid schema

* update unknown dashboard error on creating run

* use fs.access instead of fs.stat for perf

* added PLUGINS_FILE_NOT_FOUND error

- separated out from PLUGINS_FILE_ERROR
- add system tests for both cases
- update snapshots
- remove stack trace from PLUGINS_FILE_NOT_FOUND fka PLUGINS_FILE_ERROR

* add plugins system test around plugins synchronously throwing on require

* remove forcing process.cwd() to be packages/server, update affected code

- this was a long needed hangover from very old code that was doing unnecessary things due to respawning electron from node and handling various entrypoints into booting cypress
- this also makes the root yarn dev and dev-debug work correctly because options.cwd is set correctly now

* perf: lazy load chalk

* remove excessive line since the file exists but is invalid

* fix types

* add system test when plugins function throws a synchronous error

* create new PLUGINS_INVALID_EVENT_ERROR, wire it up correctly for error template use

- properly pass error instance from child to ensure proper user stack frames
- move error display code into the right place

* only show a single stack trace, either originalError or internal cypressError

* push error html snapshots

* fix tests, types

* fix test

* fix failing tests

* fix tests

* fixes lots of broken tests

* more test fixes

* fixes more tests

* fix type checking

* wip: consistent handling of interpolated values

* feat: fixing up errors, added simple error comparison tool

* wrapping up error formatting

* Fixes for unit tests

* fix PLUGINS_VALIDATION_ERROR

* fix fs.readdir bug, show rows even if there's only markdown formatting [SKIP CI]

* when in base-list, show full width of errors

* Fix type errors

* added searching and filtering for files based on error name

* fix: system tests

* updated NO_SPECS_FOUND error to properly join searched folder + pattern

- join patterns off of process.cwd, not projectRoot
- highlight original specPattern in yellow, baseDir in blue
- add tests

* fixes failing tests

* fix test

* preserve original spec pattern, display relative to projectRoot for terminal banner

* make the nodeVersion path display in gray, not white

* fix tests, pass right variables

* fix chrome:canary snapshots

* update snapshots

* update snapshot

* strip newlines caused by "Still waiting to connect to {browser}..."

* don't remove the snapshotHtmlFolder in CI, add additional verification snapshots match to error keys symmetrically

* update snapshot

* update snapshot

* update snapshot

* update snapshot

* update snapshot

* update snapshot

* update gitignore

* fix snapshot

* update snapshot html

* update logic for parsing the resolve pattern matching, add tests

* update snapshots

* update snapshot

* update snapshot

* update snapshot

* fix failing test

* fix: error_message_spec

* fix snapshot

* run each variant through an it(...) so multiple failures are received

* add newlines to multiline formatters, add fmt.stringify, allow format overrides

* stringify invalid return values from plugins

* move config validation errors into packages/errors, properly highlight and stringify values

* add component testing yarn commands

* fix the arrow not showing on details

* fix typescript error

* fixed lots of poorly written tests that weren't actually testing anything. created settings validation error when given a string validation result.

* fixes tests

* fixes tests, adds new error template for validating within an array list (for browser validation)

* remove dupe line

* fix copy for consistency, update snapshots

* remove redundant errors, standardize formatting and phrasing

* more formatting

* remove excess snapshots

* prune out excessive error snapshot html files when not in CI

* add missing tests, add case for when config validation fails without a fileType

* fixes test

* update snapshot

* update snapshot

* update snapshot

* sort uniqErrors + errorKeys prior to assertion - assert one by one

* add system test for binding to an event with the wrong handler

* fixes tests

* set more descriptive errors when setting invalid plugin events, or during plugin event validation

* remove duplicate PLUGINS_EVENT_ERROR, collapse into existing error

* use the same multiline formatting as @packages/errors

* standardize verbiage and highlighting for consistency

* fix incorrect error path

* fixes tests, standardized and condensed more language

* Update packages/errors/src/errors.ts

Co-authored-by: Ryan Manuel <ryanm@cypress.io>

* Update guides/error-handling.md

Co-authored-by: Ryan Manuel <ryanm@cypress.io>

* Update guides/error-handling.md

Co-authored-by: Ryan Manuel <ryanm@cypress.io>

* added some final todo's

* fix types

Co-authored-by: Tim Griesser <tgriesser10@gmail.com>
Co-authored-by: Tim Griesser <tgriesser@gmail.com>
Co-authored-by: Ryan Manuel <ryanm@cypress.io>
2022-02-11 02:06:07 -05:00
Alejandro Estrada
6e803597a3 fix: update scaffold template to use correct path (#20047)
* fix: update scaffold template to use correct path

* Remove support for dynamic import on devServer

* Update scaffold template

* Update config files

* Update with feedback

* Rename cypressConfig to cypressDevServerConfig

* Update devserver link

* Update comment
2022-02-07 16:58:24 -05:00
Emily Rohrbough
99f24863a2 fix: move node 17 Check from Binary to CLI (#19977) 2022-01-31 12:03:36 -06:00
Alejandro Estrada
37a9cdbba3 fix: remove optional chaining from js files (#19702)
* fix: remove optional chaining from js files

* Revert un-needed changes

* Revert unintended changes
2022-01-18 16:01:13 +10:00
Tim Griesser
0d5eae1b62 refactor: consistent getCtx in server, optional chaining for this._io calls (#19699)
* refactor: consistent getCtx in server, optional chaining for this._io calls
* fix: ensure the child process is cleaning up after itsself
2022-01-14 11:09:12 -05:00
Tim Griesser
bfc032a2d4 fix: open browser at correct time during lifecycle (#19572) 2022-01-12 13:41:25 -05:00
Emily Rohrbough
1fa95e2e29 fix: surface openSSL unhandled rejection errors that occur within plugin code (#19598) 2022-01-10 09:23:27 -06:00
Aku Kotkavuo
59e42afd23 fix: Improve heuristic for --openssl-legacy-provider (#19320) (#19522)
Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com>
2022-01-06 14:42:18 -06:00
Emily Rohrbough
a81fa26c89 fix: surface openSSL unhandled rejection errors that occur within plugin code (#19553)
Co-authored-by: Matt Henkes <mjhenkes@gmail.com>
2022-01-05 16:53:19 -06:00
Tim Griesser
4626f7481c feat: ProjectLifecycleManager & general launchpad cleanup (#19347)
See #19347 for full summary

Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>
Co-authored-by: estrada9166 <estrada9166@hotmail.com>
Co-authored-by: Alejandro Estrada <estrada9166@gmail.com>
Co-authored-by: Jess <jess@jessicasachs.io>
2021-12-21 21:28:44 -05:00
Tim Griesser
806a31a989 refactor: Improved support for e2e testing (#19306) 2021-12-09 21:23:58 -05:00
Blue F
6b19381f79 fix: Add support for system node 17 (#19094) 2021-12-02 09:36:58 -08:00
Zach Bloomquist
28a912354b test: node_modules installs for system-tests, other improvements (#18574)
Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com>
2021-11-29 15:28:05 +10:00
Zach Bloomquist
71d92e0e49 test: node_modules installs for system-tests, other improvements (#18574)
Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com>
2021-11-24 20:10:28 +00:00