From 3512f4d9f7aea4e5d30c1d2db704201b0631fc9a Mon Sep 17 00:00:00 2001 From: KHeo Date: Mon, 13 Apr 2020 16:13:12 +0900 Subject: [PATCH] Move TypeScript tests to its own file. --- .../1_browserify_babel_es201_spec.coffee.js | 227 ------------------ .../1_typescript_support_spec.coffee.js | 226 +++++++++++++++++ .../1_typescript_support_spec.ts.js | 226 +++++++++++++++++ .../e2e/1_browserify_babel_es201_spec.coffee | 24 -- .../test/e2e/1_typescript_support_spec.ts | 30 +++ 5 files changed, 482 insertions(+), 251 deletions(-) create mode 100644 packages/server/__snapshots__/1_typescript_support_spec.coffee.js create mode 100644 packages/server/__snapshots__/1_typescript_support_spec.ts.js create mode 100644 packages/server/test/e2e/1_typescript_support_spec.ts diff --git a/packages/server/__snapshots__/1_browserify_babel_es201_spec.coffee.js b/packages/server/__snapshots__/1_browserify_babel_es201_spec.coffee.js index becec41f7ff9..aa760b12e4a9 100644 --- a/packages/server/__snapshots__/1_browserify_babel_es201_spec.coffee.js +++ b/packages/server/__snapshots__/1_browserify_babel_es201_spec.coffee.js @@ -1,92 +1,3 @@ -exports['e2e typescript project passes 1'] = ` - -==================================================================================================== - - (Run Starting) - - ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ - │ Cypress: 1.2.3 │ - │ Browser: FooBrowser 88 │ - │ Specs: 2 found (app_spec.ts, math.ts) │ - └────────────────────────────────────────────────────────────────────────────────────────────────┘ - - -──────────────────────────────────────────────────────────────────────────────────────────────────── - - Running: app_spec.ts (1 of 2) - - - ✓ is true - - 1 passing - - - (Results) - - ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ - │ Tests: 1 │ - │ Passing: 1 │ - │ Failing: 0 │ - │ Pending: 0 │ - │ Skipped: 0 │ - │ Screenshots: 0 │ - │ Video: true │ - │ Duration: X seconds │ - │ Spec Ran: app_spec.ts │ - └────────────────────────────────────────────────────────────────────────────────────────────────┘ - - - (Video) - - - Started processing: Compressing to 32 CRF - - Finished processing: /XXX/XXX/XXX/cypress/videos/app_spec.ts.mp4 (X second) - - -──────────────────────────────────────────────────────────────────────────────────────────────────── - - Running: math.ts (2 of 2) - - - 0 passing - - - (Results) - - ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ - │ Tests: 0 │ - │ Passing: 0 │ - │ Failing: 0 │ - │ Pending: 0 │ - │ Skipped: 0 │ - │ Screenshots: 0 │ - │ Video: true │ - │ Duration: X seconds │ - │ Spec Ran: math.ts │ - └────────────────────────────────────────────────────────────────────────────────────────────────┘ - - - (Video) - - - Started processing: Compressing to 32 CRF - - Finished processing: /XXX/XXX/XXX/cypress/videos/math.ts.mp4 (X second) - - -==================================================================================================== - - (Run Finished) - - - Spec Tests Passing Failing Pending Skipped - ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ - │ ✔ app_spec.ts XX:XX 1 1 - - - │ - ├────────────────────────────────────────────────────────────────────────────────────────────────┤ - │ ✔ math.ts XX:XX - - - - - │ - └────────────────────────────────────────────────────────────────────────────────────────────────┘ - ✔ All specs passed! XX:XX 1 1 - - - - - -` - exports['e2e browserify, babel, es2015 passes 1'] = ` ==================================================================================================== @@ -225,141 +136,3 @@ Fix the error in your code and re-run your tests. ` - -exports['e2e typescript spec passes 1'] = ` - -==================================================================================================== - - (Run Starting) - - ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ - │ Cypress: 1.2.3 │ - │ Browser: FooBrowser 88 │ - │ Specs: 1 found (browserify_typescript_passing_spec.ts) │ - │ Searched: cypress/integration/browserify_typescript_passing_spec.ts │ - └────────────────────────────────────────────────────────────────────────────────────────────────┘ - - -──────────────────────────────────────────────────────────────────────────────────────────────────── - - Running: browserify_typescript_passing_spec.ts (1 of 1) - - - imports work - ✓ foo coffee - ✓ bar babel - ✓ dom jsx - - - 3 passing - - - (Results) - - ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ - │ Tests: 3 │ - │ Passing: 3 │ - │ Failing: 0 │ - │ Pending: 0 │ - │ Skipped: 0 │ - │ Screenshots: 0 │ - │ Video: true │ - │ Duration: X seconds │ - │ Spec Ran: browserify_typescript_passing_spec.ts │ - └────────────────────────────────────────────────────────────────────────────────────────────────┘ - - - (Video) - - - Started processing: Compressing to 32 CRF - - Finished processing: /XXX/XXX/XXX/cypress/videos/browserify_typescript_passing_s (X second) - pec.ts.mp4 - - -==================================================================================================== - - (Run Finished) - - - Spec Tests Passing Failing Pending Skipped - ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ - │ ✔ browserify_typescript_passing_spec. XX:XX 3 3 - - - │ - │ ts │ - └────────────────────────────────────────────────────────────────────────────────────────────────┘ - ✔ All specs passed! XX:XX 3 3 - - - - - -` - -exports['e2e typescript spec fails 1'] = ` - -==================================================================================================== - - (Run Starting) - - ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ - │ Cypress: 1.2.3 │ - │ Browser: FooBrowser 88 │ - │ Specs: 1 found (browserify_typescript_failing_spec.ts) │ - │ Searched: cypress/integration/browserify_typescript_failing_spec.ts │ - └────────────────────────────────────────────────────────────────────────────────────────────────┘ - - -──────────────────────────────────────────────────────────────────────────────────────────────────── - - Running: browserify_typescript_failing_spec.ts (1 of 1) - -Oops...we found an error preparing this test file: - - /foo/bar/.projects/e2e/cypress/integration/browserify_typescript_failing_spec.ts - -The error was: - -/foo/bar/.projects/e2e/cypress/integration/browserify_typescript_failing_spec.ts:3 -describe('fail', - > ); - ^ -ParseError: Unexpected token - -This occurred while Cypress was compiling and bundling your test code. This is usually caused by: - -- A missing file or dependency -- A syntax error in the file or one of its dependencies - -Fix the error in your code and re-run your tests. - - (Results) - - ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ - │ Tests: 0 │ - │ Passing: 0 │ - │ Failing: 1 │ - │ Pending: 0 │ - │ Skipped: 0 │ - │ Screenshots: 0 │ - │ Video: true │ - │ Duration: X seconds │ - │ Spec Ran: browserify_typescript_failing_spec.ts │ - └────────────────────────────────────────────────────────────────────────────────────────────────┘ - - - (Video) - - - Started processing: Compressing to 32 CRF - - Finished processing: /XXX/XXX/XXX/cypress/videos/browserify_typescript_failing_s (X second) - pec.ts.mp4 - - -==================================================================================================== - - (Run Finished) - - - Spec Tests Passing Failing Pending Skipped - ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ - │ ✖ browserify_typescript_failing_spec. XX:XX - - 1 - - │ - │ ts │ - └────────────────────────────────────────────────────────────────────────────────────────────────┘ - ✖ 1 of 1 failed (100%) XX:XX - - 1 - - - - -` diff --git a/packages/server/__snapshots__/1_typescript_support_spec.coffee.js b/packages/server/__snapshots__/1_typescript_support_spec.coffee.js new file mode 100644 index 000000000000..fe53ebdc7c7f --- /dev/null +++ b/packages/server/__snapshots__/1_typescript_support_spec.coffee.js @@ -0,0 +1,226 @@ +exports['e2e typescript spec passes 1'] = ` + +==================================================================================================== + + (Run Starting) + + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ Cypress: 1.2.3 │ + │ Browser: FooBrowser 88 │ + │ Specs: 1 found (browserify_typescript_passing_spec.ts) │ + │ Searched: cypress/integration/browserify_typescript_passing_spec.ts │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ + + +──────────────────────────────────────────────────────────────────────────────────────────────────── + + Running: browserify_typescript_passing_spec.ts (1 of 1) + + + imports work + ✓ foo coffee + ✓ bar babel + ✓ dom jsx + + + 3 passing + + + (Results) + + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ Tests: 3 │ + │ Passing: 3 │ + │ Failing: 0 │ + │ Pending: 0 │ + │ Skipped: 0 │ + │ Screenshots: 0 │ + │ Video: true │ + │ Duration: X seconds │ + │ Spec Ran: browserify_typescript_passing_spec.ts │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ + + + (Video) + + - Started processing: Compressing to 32 CRF + - Finished processing: /XXX/XXX/XXX/cypress/videos/browserify_typescript_passing_s (X second) + pec.ts.mp4 + + +==================================================================================================== + + (Run Finished) + + + Spec Tests Passing Failing Pending Skipped + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ ✔ browserify_typescript_passing_spec. XX:XX 3 3 - - - │ + │ ts │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ + ✔ All specs passed! XX:XX 3 3 - - - + + +` + +exports['e2e typescript spec fails 1'] = ` + +==================================================================================================== + + (Run Starting) + + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ Cypress: 1.2.3 │ + │ Browser: FooBrowser 88 │ + │ Specs: 1 found (browserify_typescript_failing_spec.ts) │ + │ Searched: cypress/integration/browserify_typescript_failing_spec.ts │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ + + +──────────────────────────────────────────────────────────────────────────────────────────────────── + + Running: browserify_typescript_failing_spec.ts (1 of 1) + +Oops...we found an error preparing this test file: + + /foo/bar/.projects/e2e/cypress/integration/browserify_typescript_failing_spec.ts + +The error was: + +/foo/bar/.projects/e2e/cypress/integration/browserify_typescript_failing_spec.ts:3 +describe('fail', - > ); + ^ +ParseError: Unexpected token + +This occurred while Cypress was compiling and bundling your test code. This is usually caused by: + +- A missing file or dependency +- A syntax error in the file or one of its dependencies + +Fix the error in your code and re-run your tests. + + (Results) + + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ Tests: 0 │ + │ Passing: 0 │ + │ Failing: 1 │ + │ Pending: 0 │ + │ Skipped: 0 │ + │ Screenshots: 0 │ + │ Video: true │ + │ Duration: X seconds │ + │ Spec Ran: browserify_typescript_failing_spec.ts │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ + + + (Video) + + - Started processing: Compressing to 32 CRF + - Finished processing: /XXX/XXX/XXX/cypress/videos/browserify_typescript_failing_s (X second) + pec.ts.mp4 + + +==================================================================================================== + + (Run Finished) + + + Spec Tests Passing Failing Pending Skipped + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ ✖ browserify_typescript_failing_spec. XX:XX - - 1 - - │ + │ ts │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ + ✖ 1 of 1 failed (100%) XX:XX - - 1 - - + + +` + +exports['e2e typescript project passes 1'] = ` + +==================================================================================================== + + (Run Starting) + + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ Cypress: 1.2.3 │ + │ Browser: FooBrowser 88 │ + │ Specs: 2 found (app_spec.ts, math.ts) │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ + + +──────────────────────────────────────────────────────────────────────────────────────────────────── + + Running: app_spec.ts (1 of 2) + + + ✓ is true + + 1 passing + + + (Results) + + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ Tests: 1 │ + │ Passing: 1 │ + │ Failing: 0 │ + │ Pending: 0 │ + │ Skipped: 0 │ + │ Screenshots: 0 │ + │ Video: true │ + │ Duration: X seconds │ + │ Spec Ran: app_spec.ts │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ + + + (Video) + + - Started processing: Compressing to 32 CRF + - Finished processing: /XXX/XXX/XXX/cypress/videos/app_spec.ts.mp4 (X second) + + +──────────────────────────────────────────────────────────────────────────────────────────────────── + + Running: math.ts (2 of 2) + + + 0 passing + + + (Results) + + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ Tests: 0 │ + │ Passing: 0 │ + │ Failing: 0 │ + │ Pending: 0 │ + │ Skipped: 0 │ + │ Screenshots: 0 │ + │ Video: true │ + │ Duration: X seconds │ + │ Spec Ran: math.ts │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ + + + (Video) + + - Started processing: Compressing to 32 CRF + - Finished processing: /XXX/XXX/XXX/cypress/videos/math.ts.mp4 (X second) + + +==================================================================================================== + + (Run Finished) + + + Spec Tests Passing Failing Pending Skipped + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ ✔ app_spec.ts XX:XX 1 1 - - - │ + ├────────────────────────────────────────────────────────────────────────────────────────────────┤ + │ ✔ math.ts XX:XX - - - - - │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ + ✔ All specs passed! XX:XX 1 1 - - - + + +` diff --git a/packages/server/__snapshots__/1_typescript_support_spec.ts.js b/packages/server/__snapshots__/1_typescript_support_spec.ts.js new file mode 100644 index 000000000000..fe53ebdc7c7f --- /dev/null +++ b/packages/server/__snapshots__/1_typescript_support_spec.ts.js @@ -0,0 +1,226 @@ +exports['e2e typescript spec passes 1'] = ` + +==================================================================================================== + + (Run Starting) + + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ Cypress: 1.2.3 │ + │ Browser: FooBrowser 88 │ + │ Specs: 1 found (browserify_typescript_passing_spec.ts) │ + │ Searched: cypress/integration/browserify_typescript_passing_spec.ts │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ + + +──────────────────────────────────────────────────────────────────────────────────────────────────── + + Running: browserify_typescript_passing_spec.ts (1 of 1) + + + imports work + ✓ foo coffee + ✓ bar babel + ✓ dom jsx + + + 3 passing + + + (Results) + + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ Tests: 3 │ + │ Passing: 3 │ + │ Failing: 0 │ + │ Pending: 0 │ + │ Skipped: 0 │ + │ Screenshots: 0 │ + │ Video: true │ + │ Duration: X seconds │ + │ Spec Ran: browserify_typescript_passing_spec.ts │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ + + + (Video) + + - Started processing: Compressing to 32 CRF + - Finished processing: /XXX/XXX/XXX/cypress/videos/browserify_typescript_passing_s (X second) + pec.ts.mp4 + + +==================================================================================================== + + (Run Finished) + + + Spec Tests Passing Failing Pending Skipped + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ ✔ browserify_typescript_passing_spec. XX:XX 3 3 - - - │ + │ ts │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ + ✔ All specs passed! XX:XX 3 3 - - - + + +` + +exports['e2e typescript spec fails 1'] = ` + +==================================================================================================== + + (Run Starting) + + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ Cypress: 1.2.3 │ + │ Browser: FooBrowser 88 │ + │ Specs: 1 found (browserify_typescript_failing_spec.ts) │ + │ Searched: cypress/integration/browserify_typescript_failing_spec.ts │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ + + +──────────────────────────────────────────────────────────────────────────────────────────────────── + + Running: browserify_typescript_failing_spec.ts (1 of 1) + +Oops...we found an error preparing this test file: + + /foo/bar/.projects/e2e/cypress/integration/browserify_typescript_failing_spec.ts + +The error was: + +/foo/bar/.projects/e2e/cypress/integration/browserify_typescript_failing_spec.ts:3 +describe('fail', - > ); + ^ +ParseError: Unexpected token + +This occurred while Cypress was compiling and bundling your test code. This is usually caused by: + +- A missing file or dependency +- A syntax error in the file or one of its dependencies + +Fix the error in your code and re-run your tests. + + (Results) + + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ Tests: 0 │ + │ Passing: 0 │ + │ Failing: 1 │ + │ Pending: 0 │ + │ Skipped: 0 │ + │ Screenshots: 0 │ + │ Video: true │ + │ Duration: X seconds │ + │ Spec Ran: browserify_typescript_failing_spec.ts │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ + + + (Video) + + - Started processing: Compressing to 32 CRF + - Finished processing: /XXX/XXX/XXX/cypress/videos/browserify_typescript_failing_s (X second) + pec.ts.mp4 + + +==================================================================================================== + + (Run Finished) + + + Spec Tests Passing Failing Pending Skipped + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ ✖ browserify_typescript_failing_spec. XX:XX - - 1 - - │ + │ ts │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ + ✖ 1 of 1 failed (100%) XX:XX - - 1 - - + + +` + +exports['e2e typescript project passes 1'] = ` + +==================================================================================================== + + (Run Starting) + + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ Cypress: 1.2.3 │ + │ Browser: FooBrowser 88 │ + │ Specs: 2 found (app_spec.ts, math.ts) │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ + + +──────────────────────────────────────────────────────────────────────────────────────────────────── + + Running: app_spec.ts (1 of 2) + + + ✓ is true + + 1 passing + + + (Results) + + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ Tests: 1 │ + │ Passing: 1 │ + │ Failing: 0 │ + │ Pending: 0 │ + │ Skipped: 0 │ + │ Screenshots: 0 │ + │ Video: true │ + │ Duration: X seconds │ + │ Spec Ran: app_spec.ts │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ + + + (Video) + + - Started processing: Compressing to 32 CRF + - Finished processing: /XXX/XXX/XXX/cypress/videos/app_spec.ts.mp4 (X second) + + +──────────────────────────────────────────────────────────────────────────────────────────────────── + + Running: math.ts (2 of 2) + + + 0 passing + + + (Results) + + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ Tests: 0 │ + │ Passing: 0 │ + │ Failing: 0 │ + │ Pending: 0 │ + │ Skipped: 0 │ + │ Screenshots: 0 │ + │ Video: true │ + │ Duration: X seconds │ + │ Spec Ran: math.ts │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ + + + (Video) + + - Started processing: Compressing to 32 CRF + - Finished processing: /XXX/XXX/XXX/cypress/videos/math.ts.mp4 (X second) + + +==================================================================================================== + + (Run Finished) + + + Spec Tests Passing Failing Pending Skipped + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ ✔ app_spec.ts XX:XX 1 1 - - - │ + ├────────────────────────────────────────────────────────────────────────────────────────────────┤ + │ ✔ math.ts XX:XX - - - - - │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ + ✔ All specs passed! XX:XX 1 1 - - - + + +` diff --git a/packages/server/test/e2e/1_browserify_babel_es201_spec.coffee b/packages/server/test/e2e/1_browserify_babel_es201_spec.coffee index d573f1578ca3..a6402a77e9d8 100644 --- a/packages/server/test/e2e/1_browserify_babel_es201_spec.coffee +++ b/packages/server/test/e2e/1_browserify_babel_es201_spec.coffee @@ -20,27 +20,3 @@ describe "e2e browserify, babel, es2015", -> expectedExitCode: 1 noTypeScript: true }) - -describe "e2e typescript", -> - e2e.setup({npmInstall: true}) - - it "spec passes", -> - e2e.exec(@, { - spec: "browserify_typescript_passing_spec.ts" - snapshot: true - }) - - it "spec fails", -> - e2e.exec(@, { - spec: "browserify_typescript_failing_spec.ts" - snapshot: true - expectedExitCode: 1 - }) - - it "project passes", -> - projPath = Fixtures.projectPath("ts-proj") - - e2e.exec(@, { - project: projPath - snapshot: true - }) \ No newline at end of file diff --git a/packages/server/test/e2e/1_typescript_support_spec.ts b/packages/server/test/e2e/1_typescript_support_spec.ts new file mode 100644 index 000000000000..a35736db1b82 --- /dev/null +++ b/packages/server/test/e2e/1_typescript_support_spec.ts @@ -0,0 +1,30 @@ +const e2e = require('../support/helpers/e2e') +const Fixtures = require('../support/helpers/fixtures') + +describe('e2e typescript', function () { + e2e.setup({ npmInstall: true }) + + it('spec passes', function () { + return e2e.exec(this, { + spec: 'browserify_typescript_passing_spec.ts', + snapshot: true, + }) + }) + + it('spec fails', function () { + return e2e.exec(this, { + spec: 'browserify_typescript_failing_spec.ts', + snapshot: true, + expectedExitCode: 1, + }) + }) + + it('project passes', function () { + const projPath = Fixtures.projectPath('ts-proj') + + return e2e.exec(this, { + project: projPath, + snapshot: true, + }) + }) +})