question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incorrect/misleading error messages when passing wrong arguments

See original GitHub issue

Current behavior

Cypress schedules actions that would be executed later during actual testing. This in turn causes an issue where the parameters for those actions are validated only during the execution step, rather than the scheduling step. As a result, when passing invalid argument types (object for a string, ex.) cypress outputs internal stacktrace, rather than pointing to the user written test.

Desired behavior

Cypress would save a stacktrace of place that scheduled the action, and output that instead of internal stacktrace.

Test code to reproduce

beforeEach(() => {
    cy.fixture(document, "binary"). then((file) => {});
})
describe("misleading error message", () => {
  it("I shall now output misleading error", () => {

  });
});

Cypress Version

Cypress/included:8.6.0 docker image

Node version

Cypress/included:8.6.0 docker image

Operating System

Cypress/included:8.6.0 docker image

Debug Logs

cypress_1               |      TypeError: The "path" argument must be of type string. Received an instance of Object
cypress_1               | 
cypress_1               | Because this error occurred during a `before each` hook we are skipping the remaining tests in the current suite: `I shall now output...`
cypress_1               |   TypeError [ERR_INVALID_ARG_TYPE] [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received an instance of Object
cypress_1               |       at validateString (internal/validators.js:124:11)
cypress_1               |       at Object.join (path.js:1110:7)
cypress_1               |       at Object.get (/root/.cache/Cypress/8.6.0/Cypress/resources/app/packages/server/lib/fixture.js:38:20)
cypress_1               |       at getFixture (/root/.cache/Cypress/8.6.0/Cypress/resources/app/packages/server/lib/socket-base.js:129:62)
cypress_1               |       at backendRequest (/root/.cache/Cypress/8.6.0/Cypress/resources/app/packages/server/lib/socket-base.js:276:36)
cypress_1               |       at tryCatcher (/root/.cache/Cypress/8.6.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/util.js:16:23)
cypress_1               |       at Function.Promise.attempt.Promise.try (/root/.cache/Cypress/8.6.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/method.js:39:29)
cypress_1               |       at Socket.<anonymous> (/root/.cache/Cypress/8.6.0/Cypress/resources/app/packages/server/lib/socket-base.js:314:46)
cypress_1               |       at Socket.emit (events.js:376:20)
cypress_1               |       at Socket.emitUntyped (/root/.cache/Cypress/8.6.0/Cypress/resources/app/packages/socket/node_modules/socket.io/dist/typed-events.js:69:22)
cypress_1               |       at /root/.cache/Cypress/8.6.0/Cypress/resources/app/packages/socket/node_modules/socket.io/dist/socket.js:428:39
cypress_1               |       at processTicksAndRejections (internal/process/task_queues.js:77:11)

Other

No response

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
Dragascommented, Nov 28, 2022

I’m afraid I can’t upgrade cypress in our current project, but i’ll try reproducing in the newer versions.

On Mon, Nov 28, 2022, 17:05 Ben M @.***> wrote:

Hi @Dragas https://github.com/Dragas I see you are using an older version of Cypress. Do you see the same issues on the latest version of Cypress?

— Reply to this email directly, view it on GitHub https://github.com/cypress-io/cypress/issues/24826#issuecomment-1329261566, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABOMALGY3GXJC2X4NU2KF4DWKTC5DANCNFSM6AAAAAASMAPKVU . You are receiving this because you were mentioned.Message ID: @.***>

0reactions
nagash77commented, Dec 5, 2022

Unfortunately we have to close this issue due to inactivity. Please comment if there is new information to provide concerning the original issue and we can reopen.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Logical Fallacies – Definition and Fallacy Examples
A logical fallacy is an error in reasoning that makes your argument less effective and convincing. And you want to be able to...
Read more >
Demystifying “Bad” Error Messages in Data Science Libraries
Most error-message issues are fixed by updating source code logics, instead of by updating the phrasing of message content.
Read more >
Some common Hugs error messages
An error like this occurs when grouping is incorrect or, if you are using records, in record syntax. The problem here is not...
Read more >
[Python-Dev] Reasons behind misleading TypeError message ...
... message when passing the wrong number of arguments to a method ... Referring to self in any such error message is going...
Read more >
Python: Wrong function argument? [closed] - Stack Overflow
The error given is slightly misleading to you, because you have got your arguments passed in the wrong order. The instructions ask for....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found