diff --git a/packages/driver/src/cypress/error_messages.coffee b/packages/driver/src/cypress/error_messages.coffee index a82d12c79fc1..a5ecbb7a9db6 100644 --- a/packages/driver/src/cypress/error_messages.coffee +++ b/packages/driver/src/cypress/error_messages.coffee @@ -1027,6 +1027,9 @@ module.exports = { When Cypress detects uncaught errors originating from your test code it will automatically fail the current test. """ + suite_without_callback: (suiteTitle) -> + return "Suite '#{suiteTitle}' was defined but no callback was supplied. Supply a callback or explicitly skip the suite." + viewport: bad_args: "#{cmd('viewport')} can only accept a string preset or a width and height as numbers." dimensions_out_of_range: "#{cmd('viewport')} width and height must be at least 0px." diff --git a/packages/server/__snapshots__/6_uncaught_spec_errors_spec.coffee.js b/packages/server/__snapshots__/6_uncaught_spec_errors_spec.coffee.js index 72251eb0fdf4..a444b75b5fa9 100644 --- a/packages/server/__snapshots__/6_uncaught_spec_errors_spec.coffee.js +++ b/packages/server/__snapshots__/6_uncaught_spec_errors_spec.coffee.js @@ -424,3 +424,311 @@ exports['e2e uncaught errors / failing5'] = ` ` + +exports['e2e uncaught errors failing6 1'] = ` + +==================================================================================================== + + (Run Starting) + + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ Cypress: 1.2.3 │ + │ Browser: FooBrowser 88 │ + │ Specs: 1 found (uncaught_missing_suite_callback.js) │ + │ Searched: cypress/integration/uncaught_missing_suite_callback.js │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ + + +──────────────────────────────────────────────────────────────────────────────────────────────────── + + Running: uncaught_missing_suite_callback.js... (1 of 1) + + + 1) An uncaught error was detected outside of a test + + 0 passing + 1 failing + + 1) An uncaught error was detected outside of a test: + Uncaught TypeError: Cannot read property 'call' of undefined + +This error originated from your test code, not from Cypress. + +When Cypress detects uncaught errors originating from your test code it will automatically fail the current test. + +Suite 'foo' was defined but no callback was supplied. Supply a callback or explicitly skip the suite. + at stack trace line + + + + + (Results) + + ┌──────────────────────────────────────────────────┐ + │ Tests: 1 │ + │ Passing: 0 │ + │ Failing: 1 │ + │ Pending: 0 │ + │ Skipped: 0 │ + │ Screenshots: 1 │ + │ Video: true │ + │ Duration: X seconds │ + │ Spec Ran: uncaught_missing_suite_callback.js │ + └──────────────────────────────────────────────────┘ + + + (Screenshots) + + - /foo/bar/.projects/e2e/cypress/screenshots/uncaught_missing_suite_callback.js/An uncaught error was detected outside of a test (failed).png (1280x720) + + + (Video) + + - Started processing: Compressing to 32 CRF + - Finished processing: /foo/bar/.projects/e2e/cypress/videos/abc123.mp4 (X seconds) + + +==================================================================================================== + + (Run Finished) + + + Spec Tests Passing Failing Pending Skipped + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ ✖ uncaught_missing_suite_callback.js XX:XX 1 - 1 - - │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ + 1 of 1 failed (100%) XX:XX 1 - 1 - - + + +` + +exports['e2e uncaught errors failing7 1'] = ` + +==================================================================================================== + + (Run Starting) + + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ Cypress: 1.2.3 │ + │ Browser: FooBrowser 88 │ + │ Specs: 1 found (uncaught_missing_suite_callback_empty_suite.js) │ + │ Searched: cypress/integration/uncaught_missing_suite_callback_empty_suite.js │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ + + +──────────────────────────────────────────────────────────────────────────────────────────────────── + + Running: uncaught_missing_suite_callback_empty_suite.js... (1 of 1) + + + 1) An uncaught error was detected outside of a test + + 0 passing + 1 failing + + 1) An uncaught error was detected outside of a test: + Uncaught TypeError: Cannot read property 'call' of undefined + +This error originated from your test code, not from Cypress. + +When Cypress detects uncaught errors originating from your test code it will automatically fail the current test. + +Suite 'testing2' was defined but no callback was supplied. Supply a callback or explicitly skip the suite. + at stack trace line + + + + + (Results) + + ┌──────────────────────────────────────────────────────────────┐ + │ Tests: 1 │ + │ Passing: 0 │ + │ Failing: 1 │ + │ Pending: 0 │ + │ Skipped: 0 │ + │ Screenshots: 1 │ + │ Video: true │ + │ Duration: X seconds │ + │ Spec Ran: uncaught_missing_suite_callback_empty_suite.js │ + └──────────────────────────────────────────────────────────────┘ + + + (Screenshots) + + - /foo/bar/.projects/e2e/cypress/screenshots/uncaught_missing_suite_callback_empty_suite.js/An uncaught error was detected outside of a test (failed).png (1280x720) + + + (Video) + + - Started processing: Compressing to 32 CRF + - Finished processing: /foo/bar/.projects/e2e/cypress/videos/abc123.mp4 (X seconds) + + +==================================================================================================== + + (Run Finished) + + + Spec Tests Passing Failing Pending Skipped + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ ✖ uncaught_missing_suite_callback_empt… XX:XX 1 - 1 - - │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ + 1 of 1 failed (100%) XX:XX 1 - 1 - - + + +` + +exports['e2e uncaught errors failing8 1'] = ` + +==================================================================================================== + + (Run Starting) + + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ Cypress: 1.2.3 │ + │ Browser: FooBrowser 88 │ + │ Specs: 1 found (uncaught_missing_suite_callback_empty_suite.js) │ + │ Searched: cypress/integration/uncaught_missing_suite_callback_empty_suite.js │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ + + +──────────────────────────────────────────────────────────────────────────────────────────────────── + + Running: uncaught_missing_suite_callback_empty_suite.js... (1 of 1) + + + 1) An uncaught error was detected outside of a test + + 0 passing + 1 failing + + 1) An uncaught error was detected outside of a test: + Uncaught TypeError: Cannot read property 'call' of undefined + +This error originated from your test code, not from Cypress. + +When Cypress detects uncaught errors originating from your test code it will automatically fail the current test. + +Suite 'testing2' was defined but no callback was supplied. Supply a callback or explicitly skip the suite. + at stack trace line + + + + + (Results) + + ┌──────────────────────────────────────────────────────────────┐ + │ Tests: 1 │ + │ Passing: 0 │ + │ Failing: 1 │ + │ Pending: 0 │ + │ Skipped: 0 │ + │ Screenshots: 1 │ + │ Video: true │ + │ Duration: X seconds │ + │ Spec Ran: uncaught_missing_suite_callback_empty_suite.js │ + └──────────────────────────────────────────────────────────────┘ + + + (Screenshots) + + - /foo/bar/.projects/e2e/cypress/screenshots/uncaught_missing_suite_callback_empty_suite.js/An uncaught error was detected outside of a test (failed).png (1280x720) + + + (Video) + + - Started processing: Compressing to 32 CRF + - Finished processing: /foo/bar/.projects/e2e/cypress/videos/abc123.mp4 (X seconds) + + +==================================================================================================== + + (Run Finished) + + + Spec Tests Passing Failing Pending Skipped + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ ✖ uncaught_missing_suite_callback_empt… XX:XX 1 - 1 - - │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ + 1 of 1 failed (100%) XX:XX 1 - 1 - - + + +` + +exports['e2e uncaught errors failing9 1'] = ` + +==================================================================================================== + + (Run Starting) + + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ Cypress: 1.2.3 │ + │ Browser: FooBrowser 88 │ + │ Specs: 1 found (uncaught_missing_suite_callback_type_error.js) │ + │ Searched: cypress/integration/uncaught_missing_suite_callback_type_error.js │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ + + +──────────────────────────────────────────────────────────────────────────────────────────────────── + + Running: uncaught_missing_suite_callback_type_error.js... (1 of 1) + + + 1) An uncaught error was detected outside of a test + + 0 passing + 1 failing + + 1) An uncaught error was detected outside of a test: + Uncaught TypeError: fn.call is not a function + +This error originated from your test code, not from Cypress. + +When Cypress detects uncaught errors originating from your test code it will automatically fail the current test. + +Suite 'testing' was defined but no callback was supplied. Supply a callback or explicitly skip the suite. + at stack trace line + + + + + (Results) + + ┌─────────────────────────────────────────────────────────────┐ + │ Tests: 1 │ + │ Passing: 0 │ + │ Failing: 1 │ + │ Pending: 0 │ + │ Skipped: 0 │ + │ Screenshots: 1 │ + │ Video: true │ + │ Duration: X seconds │ + │ Spec Ran: uncaught_missing_suite_callback_type_error.js │ + └─────────────────────────────────────────────────────────────┘ + + + (Screenshots) + + - /foo/bar/.projects/e2e/cypress/screenshots/uncaught_missing_suite_callback_type_error.js/An uncaught error was detected outside of a test (failed).png (1280x720) + + + (Video) + + - Started processing: Compressing to 32 CRF + - Finished processing: /foo/bar/.projects/e2e/cypress/videos/abc123.mp4 (X seconds) + + +==================================================================================================== + + (Run Finished) + + + Spec Tests Passing Failing Pending Skipped + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ ✖ uncaught_missing_suite_callback_type… XX:XX 1 - 1 - - │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ + 1 of 1 failed (100%) XX:XX 1 - 1 - - + + +` diff --git a/packages/server/test/e2e/6_uncaught_spec_errors_spec.coffee b/packages/server/test/e2e/6_uncaught_spec_errors_spec.coffee index c2677c847237..19a281b0993c 100644 --- a/packages/server/test/e2e/6_uncaught_spec_errors_spec.coffee +++ b/packages/server/test/e2e/6_uncaught_spec_errors_spec.coffee @@ -27,8 +27,44 @@ describe "e2e uncaught errors", -> expectedExitCode: 1 } - e2e.it "failing5", { - spec: "caught_async_sync_test_spec.coffee" - snapshot: true - expectedExitCode: 4 - } + it "failing5", -> + e2e.exec(@, { + spec: "caught_async_sync_test_spec.coffee" + snapshot: true + expectedExitCode: 4 + }) + + it "failing6", -> + e2e.exec(@, { + spec: "uncaught_missing_suite_callback.js" + snapshot: true + expectedExitCode: 1 + }) + + it "failing7", -> + e2e.exec(@, { + spec: "uncaught_missing_suite_callback_empty_suite.js" + snapshot: true + expectedExitCode: 1 + }) + + it "failing8", -> + e2e.exec(@, { + spec: "uncaught_missing_suite_callback_empty_suite.js" + snapshot: true + expectedExitCode: 1 + }) + + it "failing9", -> + e2e.exec(@, { + spec: "uncaught_missing_suite_callback_type_error.js" + snapshot: true + expectedExitCode: 1 + }) + + it "failing9", -> + e2e.exec(@, { + spec: "uncaught_missing_suite_callback_type_error.js" + snapshot: true + expectedExitCode: 1 + }) diff --git a/packages/server/test/support/fixtures/projects/e2e/cypress/integration/uncaught_missing_suite_callback.js b/packages/server/test/support/fixtures/projects/e2e/cypress/integration/uncaught_missing_suite_callback.js new file mode 100644 index 000000000000..c9ce99a48b71 --- /dev/null +++ b/packages/server/test/support/fixtures/projects/e2e/cypress/integration/uncaught_missing_suite_callback.js @@ -0,0 +1 @@ +describe('foo') diff --git a/packages/server/test/support/fixtures/projects/e2e/cypress/integration/uncaught_missing_suite_callback_empty_suite.js b/packages/server/test/support/fixtures/projects/e2e/cypress/integration/uncaught_missing_suite_callback_empty_suite.js new file mode 100644 index 000000000000..9c351028f18f --- /dev/null +++ b/packages/server/test/support/fixtures/projects/e2e/cypress/integration/uncaught_missing_suite_callback_empty_suite.js @@ -0,0 +1,5 @@ + +context('testing', () => { }) + +describe('testing2') + diff --git a/packages/server/test/support/fixtures/projects/e2e/cypress/integration/uncaught_missing_suite_callback_type_error.js b/packages/server/test/support/fixtures/projects/e2e/cypress/integration/uncaught_missing_suite_callback_type_error.js new file mode 100644 index 000000000000..1d6f18fa82ea --- /dev/null +++ b/packages/server/test/support/fixtures/projects/e2e/cypress/integration/uncaught_missing_suite_callback_type_error.js @@ -0,0 +1,4 @@ + +describe('testing', '123') + +