You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.
Imaging we have a task and use default value for its argument like
module.exports=(on,config)=>{// `on` is used to hook into various events Cypress emits// `config` is the resolved Cypress configon('task',{hello(name='world'){console.log('hello ',name)returnnull}})}
When we call cy.task('hello') I expect the terminal to print hello world but it prints
ET /__cypress/tests?p=cypress/integration/spec.js-609 200 2.326 ms - 619
GET /__cypress/tests?p=cypress/support/index.js-949 200 1.387 ms - -
hello null
Expected behavior
cy.task methods should respect default arguments (we should not be passing null values)
The text was updated successfully, but these errors were encountered:
The code for this is done in cypress-io/cypress#8600, but has yet to be released.
We'll update this issue and reference the changelog when it's released.
Seems
cy.task
calls task withnull
value instead ofundefined
if the argument was NOT specified in the spec callCypress v3.7.0
Reproduction in https://github.com/cypress-io/cypress-test-tiny/tree/default-arg-in-task cypress-io/cypress-test-tiny@c899a79
Imaging we have a task and use default value for its argument like
When we call
cy.task('hello')
I expect the terminal to printhello world
but it printsExpected behavior
cy.task
methods should respect default arguments (we should not be passingnull
values)The text was updated successfully, but these errors were encountered: