Incorrect/misleading error messages when passing wrong arguments
See original GitHub issueCurrent 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:
- Created 10 months ago
- Comments:5
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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:
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.