cypress-fail-on-console-error icon indicating copy to clipboard operation
cypress-fail-on-console-error copied to clipboard

setConfig() are not working for component test runner

Open nils-hoyer opened this issue 1 year ago • 0 comments

When using FailOnConsoleError setConfig() it gives unexpected result.

TestCase: set consoleTypes to 'info' and raise console.error() should pass the test. Given is it fails with console.error()

Example Code: describe('shouldFailOnConsoleError', () => { it('should throw AssertionError on console.error', () => { cy.setConfig({ consoleTypes: ['info'] }).then(() => { cy.then(() => { cy.mount(WithError, 'with-error'); // cy.mount(WithInfo, 'with-info'); }); }); }); // });

class WithError extends HTMLElement { connectedCallback() { console.error('anyErrorMessage'); } }

class WithInfo extends HTMLElement { connectedCallback() { console.info('consoleInfoMessage'); } }

nils-hoyer avatar Jan 06 '24 12:01 nils-hoyer