Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Util.promisify is not a function in Cypress when require("gmail-tester") #36

Closed
rlyttle opened this issue May 3, 2020 · 1 comment
Closed

Comments

@rlyttle
Copy link

rlyttle commented May 3, 2020

Cypress tests that require("gmail-tester") in support/index.js fail when executing a test, with the browser showing the following error

util.promisify 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.

Cypress could not associate this error to any specific test.

We dynamically generated a new test to display this failure.

Check your console for the stack trace or click this message to see where it originated from.
View stack trace
Uncaught TypeError: util.promisify 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.

Cypress could not associate this error to any specific test.

We dynamically generated a new test to display this failure.

Check your console for the stack trace or click this message to see where it originated from.
    at Object.53../apirequest (http://localhost:4201/__cypress/tests?p=cypress/support/index.js-776:9871:23)
    at o (http://localhost:4201/__cypress/tests?p=cypress/support/index.js-776:1:265)
    at http://localhost:4201/__cypress/tests?p=cypress/support/index.js-776:1:316
    at Object.55../apiIndex (http://localhost:4201/__cypress/tests?p=cypress/support/index.js-776:10147:19)
    at o (http://localhost:4201/__cypress/tests?p=cypress/support/index.js-776:1:265)
    at http://localhost:4201/__cypress/tests?p=cypress/support/index.js-776:1:316
    at Object.73../v1 (http://localhost:4201/__cypress/tests?p=cypress/support/index.js-776:11812:29)
    at o (http://localhost:4201/__cypress/tests?p=cypress/support/index.js-776:1:265)
    at http://localhost:4201/__cypress/tests?p=cypress/support/index.js-776:1:316
    at Object.318../abusiveexperiencereport (http://localhost:4201/__cypress/tests?p=cypress/support/index.js-776:200070:33)

If require("gmail-tester") is not added to the file, the issue is not present.

Investigating potential causes:
Opening chrome dev tools and following the error code link brings me to the following
image

That led me down a rabbit hole to find that this issue may be related?
googleapis/google-api-nodejs-client#1775

System Information
npm -v
6.14.4

node -v
v10.20.1

OSX Catalina & Mojave

Cypress Version 4.5.0
Happens both when cypress set to use 'system' (10.20.1) and builtin (12.13.0) nodejs versions (cypress.conf setting)

I'd really love some direction as to how to progress forward with this - I've tried different node versions, etc but nothing seems to get me any further!

@rlyttle
Copy link
Author

rlyttle commented May 5, 2020

It turns out the issue was that require("gmail-tester") was executing outside of on("task", {...}); in the browser context rather than the node context.

@rlyttle rlyttle closed this as completed May 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant