chore: remove rogue console logs while running tests

This commit is contained in:
Thomas Allmer 2020-08-17 16:22:34 +02:00
parent 4a228e671d
commit 42c68a66c6
5 changed files with 31 additions and 26 deletions

View file

@ -9,7 +9,7 @@
"build:docs": "wca analyze \"packages/tabs/**/*.js\"", "build:docs": "wca analyze \"packages/tabs/**/*.js\"",
"build:types": "tsc -p tsconfig.build.types.json", "build:types": "tsc -p tsconfig.build.types.json",
"bundlesize": "rollup -c bundlesize/rollup.config.js && bundlesize", "bundlesize": "rollup -c bundlesize/rollup.config.js && bundlesize",
"debug": "web-test-runner \"packages/form-integrations/test/**/*.test.js\" --watch", "debug": "web-test-runner \"packages/dialog/test/**/*.test.js\" --watch",
"dev-server": "es-dev-server", "dev-server": "es-dev-server",
"format": "npm run format:eslint && npm run format:prettier", "format": "npm run format:eslint && npm run format:prettier",
"format:eslint": "eslint --ext .js,.html . --fix", "format:eslint": "eslint --ext .js,.html . --fix",
@ -48,7 +48,7 @@
"@storybook/addon-a11y": "~5.0.0", "@storybook/addon-a11y": "~5.0.0",
"@types/chai-dom": "^0.0.8", "@types/chai-dom": "^0.0.8",
"@web/dev-server-legacy": "^0.1.1", "@web/dev-server-legacy": "^0.1.1",
"@web/test-runner": "^0.7.2", "@web/test-runner": "^0.7.3",
"@web/test-runner-browserstack": "^0.1.1", "@web/test-runner-browserstack": "^0.1.1",
"@web/test-runner-playwright": "^0.5.1", "@web/test-runner-playwright": "^0.5.1",
"@webcomponents/webcomponentsjs": "^2.4.4", "@webcomponents/webcomponentsjs": "^2.4.4",

View file

@ -77,8 +77,8 @@ describe('<lion-accordion>', () => {
expect(spy).to.have.been.calledOnce; expect(spy).to.have.been.calledOnce;
}); });
it('throws warning if unequal amount of invokers and contents', async () => { it('logs warning if unequal amount of invokers and contents', async () => {
const spy = sinon.spy(console, 'warn'); const stub = sinon.stub(console, 'warn');
await fixture(html` await fixture(html`
<lion-accordion> <lion-accordion>
<h2 slot="invoker"><button>invoker</button></h2> <h2 slot="invoker"><button>invoker</button></h2>
@ -86,8 +86,10 @@ describe('<lion-accordion>', () => {
<div slot="content">content 2</div> <div slot="content">content 2</div>
</lion-accordion> </lion-accordion>
`); `);
expect(spy.callCount).to.equal(1); expect(stub).to.be.calledOnceWithExactly(
console.warn.restore(); `The amount of invokers (1) doesn't match the amount of contents (2).`,
);
stub.restore();
}); });
}); });

View file

@ -79,13 +79,13 @@ describe('<lion-collapsible>', () => {
describe('Accessibility', () => { describe('Accessibility', () => {
it('[collapsed] is a11y AXE accessible', async () => { it('[collapsed] is a11y AXE accessible', async () => {
const collapsible = await fixture(defaultCollapsible); const collapsible = await fixture(defaultCollapsible);
expect(collapsible).to.be.accessible(); await expect(collapsible).to.be.accessible();
}); });
it('[expanded] is a11y AXE accessible', async () => { it('[expanded] is a11y AXE accessible', async () => {
const collapsible = await fixture(defaultCollapsible); const collapsible = await fixture(defaultCollapsible);
collapsible.show(); collapsible.show();
expect(collapsible).to.be.accessible(); await expect(collapsible).to.be.accessible();
}); });
describe('Invoker', () => { describe('Invoker', () => {

View file

@ -66,8 +66,8 @@ describe('<lion-tabs>', () => {
expect(spy).to.have.been.calledOnce; expect(spy).to.have.been.calledOnce;
}); });
it('throws warning if unequal amount of tabs and panels', async () => { it('logs warning if unequal amount of tabs and panels', async () => {
const spy = sinon.spy(console, 'warn'); const stub = sinon.stub(console, 'warn');
await fixture(html` await fixture(html`
<lion-tabs> <lion-tabs>
<button slot="tab">tab</button> <button slot="tab">tab</button>
@ -75,8 +75,10 @@ describe('<lion-tabs>', () => {
<div slot="panel">panel 2</div> <div slot="panel">panel 2</div>
</lion-tabs> </lion-tabs>
`); `);
expect(spy.callCount).to.equal(1); expect(stub).to.be.calledOnceWithExactly(
spy.restore(); `The amount of tabs (1) doesn't match the amount of panels (2).`,
);
stub.restore();
}); });
}); });

View file

@ -2502,10 +2502,10 @@
chrome-launcher "^0.13.3" chrome-launcher "^0.13.3"
puppeteer-core "^5.0.0" puppeteer-core "^5.0.0"
"@web/test-runner-cli@^0.5.1": "@web/test-runner-cli@^0.5.2":
version "0.5.1" version "0.5.2"
resolved "https://registry.yarnpkg.com/@web/test-runner-cli/-/test-runner-cli-0.5.1.tgz#a0ad9c933dac80e71bb697370c4924ab56397948" resolved "https://registry.yarnpkg.com/@web/test-runner-cli/-/test-runner-cli-0.5.2.tgz#870a9bd62a342ccc4994e9873ca1018d73fa8009"
integrity sha512-gTKbMB1dqLSnhI3pZ8ZZ2oaeszTGGII+m6QdwaNgyxGpfb5XLtrtqfGpbG532tu/OnzuHf1IwGh0LvkFM1uhVQ== integrity sha512-igy0lujUzquD9JrXFLEN/HSjhVxIESlvZVlNsYWDfBoZpj1MzURNdGiZJi6GCsyadbEhHsIWVyhu71/h3XwVOQ==
dependencies: dependencies:
"@babel/code-frame" "^7.10.4" "@babel/code-frame" "^7.10.4"
"@types/babel__code-frame" "^7.0.1" "@types/babel__code-frame" "^7.0.1"
@ -2516,6 +2516,7 @@
chalk "^4.1.0" chalk "^4.1.0"
cli-cursor "^3.1.0" cli-cursor "^3.1.0"
command-line-args "^5.1.1" command-line-args "^5.1.1"
command-line-usage "^6.1.0"
convert-source-map "^1.7.0" convert-source-map "^1.7.0"
deepmerge "^4.2.2" deepmerge "^4.2.2"
diff "^4.0.2" diff "^4.0.2"
@ -2527,10 +2528,10 @@
portfinder "^1.0.26" portfinder "^1.0.26"
source-map "^0.7.3" source-map "^0.7.3"
"@web/test-runner-commands@^0.1.1": "@web/test-runner-commands@^0.1.2":
version "0.1.1" version "0.1.2"
resolved "https://registry.yarnpkg.com/@web/test-runner-commands/-/test-runner-commands-0.1.1.tgz#c842d3a5b60ad9bc78124a9eb37eda88a53a4ae9" resolved "https://registry.yarnpkg.com/@web/test-runner-commands/-/test-runner-commands-0.1.2.tgz#8a9405cb8fb177a2c5a05f299e699e0da9c36515"
integrity sha512-zRocZ/6yAhpjmTgDdOOka70vbkUusuuGxCkjZsQpvMnvrkPA9zr4mvYLHU1KSEKk51ILRgQYyrST4bwmcefCog== integrity sha512-apAvibdIxw5dRXwXP8P3To0fSqfIdP6qxaxOgQx8/RJdksL1s7rZCFmsme6lmEVGbf35I+Cu0QUqbsGWOIWA1A==
dependencies: dependencies:
"@web/test-runner-core" "^0.7.1" "@web/test-runner-core" "^0.7.1"
@ -2585,16 +2586,16 @@
"@web/test-runner-core" "^0.7.1" "@web/test-runner-core" "^0.7.1"
selenium-webdriver "^4.0.0-alpha.7" selenium-webdriver "^4.0.0-alpha.7"
"@web/test-runner@^0.7.2": "@web/test-runner@^0.7.3":
version "0.7.2" version "0.7.3"
resolved "https://registry.yarnpkg.com/@web/test-runner/-/test-runner-0.7.2.tgz#b8abc38a1d8180e68d881032e152af2a961c9be9" resolved "https://registry.yarnpkg.com/@web/test-runner/-/test-runner-0.7.3.tgz#b52325e8ce0c967df72631e8faf22d1f09c49fab"
integrity sha512-zdEfn+0lvLAfkcvx1hWlj8Wge4JaOW3WSmqZYnDvSbGHFxSrQToZ3So5dQwrvJsR/lluZcYmBazXRR72Ml3AMA== integrity sha512-SzdP4efXdP56bZFvGer0Zc0SI2QR5xgGxLK2s9v9xZ6M4g31CiKd6/mHp33G3jxW4ABdJObfmCAL7Fq6N34Byg==
dependencies: dependencies:
"@rollup/plugin-node-resolve" "^8.1.0" "@rollup/plugin-node-resolve" "^8.1.0"
"@web/dev-server-rollup" "^0.2.1" "@web/dev-server-rollup" "^0.2.1"
"@web/test-runner-chrome" "^0.6.1" "@web/test-runner-chrome" "^0.6.1"
"@web/test-runner-cli" "^0.5.1" "@web/test-runner-cli" "^0.5.2"
"@web/test-runner-commands" "^0.1.1" "@web/test-runner-commands" "^0.1.2"
"@web/test-runner-core" "^0.7.1" "@web/test-runner-core" "^0.7.1"
"@web/test-runner-mocha" "^0.3.1" "@web/test-runner-mocha" "^0.3.1"
command-line-args "^5.1.1" command-line-args "^5.1.1"