Skip to content
This repository was archived by the owner on Oct 1, 2020. It is now read-only.

Crashes when preprocessing 24 Typescript tests (but sometimes works) #79

Closed
mike-hogan opened this issue May 6, 2020 · 6 comments
Closed

Comments

@mike-hogan
Copy link

mike-hogan commented May 6, 2020

  • Operating System: OS X 10.14.6
  • Cypress Version: 4.5.0
  • Browser Version: Chrome 81.0.4044.122
  • Node Version: 14.1.0
    "@cypress/webpack-preprocessor": "^5.1.2",
    "ts-loader": "^7.0.1",
    "typescript": "^3.8.3",
    "webpack": "^4.43.0"

Current behavior:

  1. npx cypress open
  2. Click "Run all specs"
  3. Observe a lot of output as exampled below in [1] streaming in the terminal cypress was launched from. Also observe a couple of mentions of
    (node:90085) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 close listeners added to [EventEmitter]. Use emitter.setMaxListeners() to increase limit
    
  4. Process crashes with
write EPIPE
GET /__cypress/iframes/__all 200 16.952 ms - -
Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
    at ServerResponse.setHeader (_http_outgoing.js:485:11)
    at ServerResponse.header (/Users/mikehogan/Library/Caches/Cypress/4.5.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/express/lib/response.js:767:10)
    at ServerResponse.send (/Users/mikehogan/Library/Caches/Cypress/4.5.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/express/lib/response.js:170:12)
    at /Users/mikehogan/Library/Caches/Cypress/4.5.0/Cypress.app/Contents/Resources/app/packages/server/lib/controllers/spec.js:37:20
    at tryCatcher (/Users/mikehogan/Library/Caches/Cypress/4.5.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/Users/mikehogan/Library/Caches/Cypress/4.5.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:547:31)
    at Promise._settlePromise (/Users/mikehogan/Library/Caches/Cypress/4.5.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:604:18)
    at Promise._settlePromise0 (/Users/mikehogan/Library/Caches/Cypress/4.5.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:649:10)
    at Promise._settlePromises (/Users/mikehogan/Library/Caches/Cypress/4.5.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:725:18)
    at _drainQueueStep (/Users/mikehogan/Library/Caches/Cypress/4.5.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/async.js:93:12)
    at _drainQueue (/Users/mikehogan/Library/Caches/Cypress/4.5.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/async.js:86:9)
    at Async._drainQueues (/Users/mikehogan/Library/Caches/Cypress/4.5.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/async.js:102:5)
    at Immediate.Async.drainQueues [as _onImmediate] (/Users/mikehogan/Library/Caches/Cypress/4.5.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/async.js:15:14)
    at processImmediate (internal/timers.js:439:21) {
  code: 'ERR_HTTP_HEADERS_SENT'
}
Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
    at ServerResponse.setHeader (_http_outgoing.js:485:11)
    at ServerResponse.header (/Users/mikehogan/Library/Caches/Cypress/4.5.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/express/lib/response.js:767:10)
    at ServerResponse.send (/Users/mikehogan/Library/Caches/Cypress/4.5.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/express/lib/response.js:170:12)
    at /Users/mikehogan/Library/Caches/Cypress/4.5.0/Cypress.app/Contents/Resources/app/packages/server/lib/controllers/spec.js:37:20
    at tryCatcher (/Users/mikehogan/Library/Caches/Cypress/4.5.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/Users/mikehogan/Library/Caches/Cypress/4.5.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:547:31)
    at Promise._settlePromise (/Users/mikehogan/Library/Caches/Cypress/4.5.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:604:18)
    at Promise._settlePromise0 (/Users/mikehogan/Library/Caches/Cypress/4.5.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:649:10)
    at Promise._settlePromises (/Users/mikehogan/Library/Caches/Cypress/4.5.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:725:18)
    at _drainQueueStep (/Users/mikehogan/Library/Caches/Cypress/4.5.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/async.js:93:12)
    at _drainQueue (/Users/mikehogan/Library/Caches/Cypress/4.5.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/async.js:86:9)
    at Async._drainQueues (/Users/mikehogan/Library/Caches/Cypress/4.5.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/async.js:102:5)
    at Immediate.Async.drainQueues [as _onImmediate] (/Users/mikehogan/Library/Caches/Cypress/4.5.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/async.js:15:14)
    at processImmediate (internal/timers.js:439:21)

[1] Here is what I was referring to as a lot of output streaming:

GET /__cypress/iframes/__all 200 8.021 ms - -
GET /__cypress/tests?p=cypress/support/index.js-279 200 107.993 ms - -
GET /__cypress/tests?p=cypress/integration/can_create_new_types_when_creating_lookup_properties.ts-722 200 94.992 ms - -
GET /__cypress/tests?p=cypress/integration/auto_number_ids.ts-487 200 103.373 ms - -
GET /__cypress/tests?p=cypress/integration/can_delete_relationships.ts-207 200 94.464 ms - -
GET /__cypress/tests?p=cypress/integration/can_change_property_type.ts-580 200 99.629 ms - -
GET /__cypress/tests?p=cypress/integration/booking_form_example.ts-520 200 101.593 ms - -
GET /__cypress/tests?p=cypress/integration/can_reorder_properties.ts-887 200 171.030 ms - -
GET /__cypress/tests?p=cypress/integration/focus_when_adding_new_row.ts-281 200 77.302 ms - -
GET /__cypress/tests?p=cypress/integration/can_delete_rows.ts-996 200 309.110 ms - -
GET /__cypress/tests?p=cypress/integration/cross_linking_of_models.ts-054 200 170.616 ms - -
GET /__cypress/tests?p=cypress/integration/keyboard_shortcuts.ts-193 200 151.043 ms - -
GET /__cypress/tests?p=cypress/integration/model_edits_must_preserve_model_integrity.ts-101 200 146.098 ms - -
GET /__cypress/tests?p=cypress/integration/formula_properties.ts-123 200 237.230 ms - -
GET /__cypress/tests?p=cypress/integration/model_tagging_and_filtering.ts-838 200 133.924 ms - -
GET /__cypress/tests?p=cypress/integration/properties_can_link_to_other_models.ts-132 200 81.594 ms - -
GET /__cypress/tests?p=cypress/integration/selectors.ts-733 200 507.636 ms - -
GET /__cypress/tests?p=cypress/integration/spreadsheet_like_data_entry_submission_and_navigation.ts-606 200 426.558 ms - -
GET /__cypress/tests?p=cypress/integration/supporting_airtable_tables.ts-890 200 70.363 ms - -
GET /__cypress/tests?p=cypress/integration/supporting_colour.ts-098 200 47.577 ms - -
GET /__cypress/tests?p=cypress/integration/reporting-to-other-models.ts-382 - - ms - -
GET /__cypress/tests?p=cypress/integration/prompted_values_in_text_inputs.ts-833 200 4124.871 ms - -
GET /__cypress/tests?p=cypress/integration/data_entry_formats.ts-809 - - ms - -
GET /__cypress/tests?p=cypress/integration/multiple_instances_of_same_value_type.ts-148 - - ms - -
GET /__cypress/tests?p=cypress/integration/what_signature_requires.ts-276 - - ms - -
GET /__cypress/tests?p=cypress/integration/what_tom_requires.ts-603 200 2558.794 ms - -

If I do the above 4 or 5 or 6 times, sometimes all the tests come up in the GUI and I can run them all. We're talking about 24 tests, none of which are especially long or complex.

Desired behavior:

Tests preprocess and run in the GUI

How to reproduce:

As per above

Additional Info (images, stack traces, etc)

Here is my plugins/index.js:

    const wp = require('@cypress/webpack-preprocessor')
    
    module.exports = (on, config) => {
        const options = {
            webpackOptions: {
                resolve: {
                    extensions: [".ts", ".tsx", ".mjs",".js"]
                },
                module: {
                    rules: [
                        {
                            test: /\.tsx?$/,
                            loader: "ts-loader",
                            options: { transpileOnly: true }
                        }
                    ]
                }
            },
        }
        on('file:preprocessor', wp(options))
    }

Here is my tsconfig.json:

    {
      "compilerOptions": {
        "strict": true,
        "baseUrl": "../node_modules",
        "esModuleInterop": true,
        "target": "es5",
        "lib": ["es5", "dom"],
        "types": ["cypress"]
      },
      "include": [
        "**/*.ts",
        "../src/**/*.ts"
      ]
    }

This is my cypress.json:

{
  "nodeVersion": "system",
  "video": false,
  "numTestsKeptInMemory": 1
}
@mike-hogan mike-hogan changed the title Crashes when preprocessing 24 Typescripts (but some times works) Crashes when preprocessing 24 Typescript tests (but some times works) May 6, 2020
@mike-hogan mike-hogan changed the title Crashes when preprocessing 24 Typescript tests (but some times works) Crashes when preprocessing 24 Typescript tests (but sometimes works) May 6, 2020
@mike-hogan
Copy link
Author

Maybe useful observation. I can get all the tests to preprocess and run if I do this:

  1. npx cypress open
  2. Run a single test using the GUI
  3. Enter http://localhost:57091/__/#/tests/__all into the address bar of the browser
  4. The 24 tests all preprocess quickly, and run fine

So its clicking "Run all specs" that seems to send the software down a weird path.

@mike-hogan
Copy link
Author

Sorry, the above statement is bogus. The tests ran when I tried that just because sometimes they do.

@jennifer-shehane
Copy link
Member

@mike-hogan You shouldn't need to use a preprocessor for TypeScript since Cypress 4.4.0. Have you tried removing this altogether?

@mike-hogan
Copy link
Author

mike-hogan commented May 8, 2020

Thanks @jennifer-shehane . When I remove the preprocessor, I get this error message:

Error: Parsing file /Users/mikehogan/repos/personal/docsndata-ts/src/model/Model.ts: Unexpected token (167:16)

The offending line is

    isColoured() {
        return this.getColourSource().getPropertyId() !== null;
    }

My IDE, tsc and the preprocessor are all fine with this line, and I don't see any more explanatory error messages any place.

How do you recommend I proceed?

Thanks.

@jennifer-shehane
Copy link
Member

Looks like @chrisbreiding opened an issue about the error your encountering now cypress-io/cypress-browserify-preprocessor#47

@chrisbreiding
Copy link
Collaborator

The [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client error should have been fixed by #103 and released in 5.4.4. Going to close this under the assumption, but please re-open if it's still an issue.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants