Open
Description
Current behavior
When overwritten cy.log
, cy.task
can not be called because it fails with >
cy.task() must only be invoked from the spec file or support file.
Cypress.Commands.overwrite('log', (subject, message) =>
cy.task('cyLog', message)
);
Desired behavior
That code can be used as it was before.
Test code to reproduce
on commands.ts
:
Cypress.Commands.overwrite('log', (subject, message) =>
cy.task('cyLog', message)
);
on index-ts
on(`task`, {
cyLog(message) {
// eslint-disable-next-line no-console
console.log(ansi.magenta('cy.log:'), ansi.magenta(message));
return null;
},
});
Cypress Version
13.6.4
Node version
v20.11.0
Operating System
macOS 14.4
Debug Logs
No response
Other
This issue should be similar to the closed #28336.