chore: clean test logs

This commit is contained in:
Thijs Louisse 2024-12-18 23:31:00 +01:00 committed by Thijs Louisse
parent 2823940ece
commit fef94cd016
3 changed files with 12 additions and 5 deletions

View file

@ -140,7 +140,7 @@ describe('ScopedElementsMixin', () => {
} }
customElements.define('scoped-elements-host-no-reg-2', ScopedElementsHostNoReg2); customElements.define('scoped-elements-host-no-reg-2', ScopedElementsHostNoReg2);
const errorSpy = sinon.spy(console, 'error'); const errorStub = sinon.stub(console, 'error');
/** @type {ScopedElementsHostNoReg2} */ ( /** @type {ScopedElementsHostNoReg2} */ (
await fixture(html`<scoped-elements-host-no-reg></scoped-elements-host-no-reg>`) await fixture(html`<scoped-elements-host-no-reg></scoped-elements-host-no-reg>`)
); );
@ -148,7 +148,7 @@ describe('ScopedElementsMixin', () => {
await fixture(html`<scoped-elements-host-no-reg-2></scoped-elements-host-no-reg-2>`) await fixture(html`<scoped-elements-host-no-reg-2></scoped-elements-host-no-reg-2>`)
); );
expect(errorSpy.args[0][0]).to.equal( expect(errorStub.args[0][0]).to.equal(
[ [
'You are trying to re-register the "scoped-elements-child-no-reg" custom element with a different class via ScopedElementsMixin.', 'You are trying to re-register the "scoped-elements-child-no-reg" custom element with a different class via ScopedElementsMixin.',
'This is only possible with a CustomElementRegistry.', 'This is only possible with a CustomElementRegistry.',
@ -158,7 +158,7 @@ describe('ScopedElementsMixin', () => {
'For more details you can visit https://open-wc.org/docs/development/scoped-elements/', 'For more details you can visit https://open-wc.org/docs/development/scoped-elements/',
].join('\n'), ].join('\n'),
); );
errorSpy.restore(); errorStub.restore();
}); });
}); });
}); });

View file

@ -9,6 +9,7 @@ import { html } from 'lit';
import { isActiveElement } from '../../core/test-helpers/isActiveElement.js'; import { isActiveElement } from '../../core/test-helpers/isActiveElement.js';
import { getAllTagNames } from './helpers/helpers.js'; import { getAllTagNames } from './helpers/helpers.js';
import './helpers/umbrella-form.js'; import './helpers/umbrella-form.js';
/** /**
* @typedef {import('./helpers/umbrella-form.js').UmbrellaForm} UmbrellaForm * @typedef {import('./helpers/umbrella-form.js').UmbrellaForm} UmbrellaForm
* @typedef {import('../../dialog/src/LionDialog.js').LionDialog} LionDialog * @typedef {import('../../dialog/src/LionDialog.js').LionDialog} LionDialog
@ -25,10 +26,12 @@ describe('Form inside dialog Integrations', () => {
</lion-dialog>`, </lion-dialog>`,
); );
// @ts-ignore // @ts-expect-error [allow-protected-in-tests]
const formEl = /** @type {LionForm} */ (el._overlayCtrl.contentNode._lionFormNode); const umbrellaEl = el._overlayCtrl.contentNode;
const formEl = /** @type {LionForm} */ (umbrellaEl._lionFormNode);
await formEl.registrationComplete; await formEl.registrationComplete;
const registeredEls = getAllTagNames(formEl); const registeredEls = getAllTagNames(formEl);
await umbrellaEl.waitForAllChildrenUpdates();
expect(registeredEls).to.eql([ expect(registeredEls).to.eql([
'lion-fieldset', 'lion-fieldset',
@ -86,6 +89,7 @@ describe('Form inside dialog Integrations', () => {
</div> </div>
</lion-dialog> </lion-dialog>
`); `);
// @ts-expect-error [allow-protected-in-tests] // @ts-expect-error [allow-protected-in-tests]
el._overlayInvokerNode.click(); el._overlayInvokerNode.click();
const lionInput = el.querySelector('[name="input"]'); const lionInput = el.querySelector('[name="input"]');

View file

@ -44,5 +44,8 @@ export default {
playwrightLauncher({ product: 'webkit' }), playwrightLauncher({ product: 'webkit' }),
], ],
groups, groups,
filterBrowserLogs(/** @type {{ type: 'error'|'warn'|'debug'; args: string[] }} */ log) {
return log.type === 'error' || log.type === 'debug';
},
plugins: [litSsrPlugin()], plugins: [litSsrPlugin()],
}; };