When running a component test suite on cypress with the default setup, any console event will be printed into console recursively until there is a RangeError: Maximum call stack size exceeded.
The conditions for this behavior to occur are the following:
There need to be at least 2 component tests in the suite. The undesired behavior does not trigger if there is only one test being run.
There needs to be a one or more console events (log/info/warn/error) in the test case itself or in any component that's being rendered.
Here is a simple example of the test suite that leads to this behavior:
describe("Recursive logging on console events", () => {
const Title = () => {
return <h1>title</h1>;
};
it("Component test 1", () => {
cy.mount(<Title />);
console.warn("warning");
cy.get("h2");
});
it("Component test 2", () => {
cy.mount(<Title />);
console.warn("warning");
cy.get("h2");
});
})
Currently the only way I have of mitigating this unwanted behavior is excluding the console events setting the Collect Types option in the Install Logs Collector. Like so:
When running a component test suite on cypress with the default setup, any console event will be printed into console recursively until there is a
RangeError: Maximum call stack size exceeded
.The conditions for this behavior to occur are the following:
Here is a simple example of the test suite that leads to this behavior:
Currently the only way I have of mitigating this unwanted behavior is excluding the console events setting the Collect Types option in the Install Logs Collector. Like so: