Skip to content

Commit

Permalink
test: Fail tests on browser warnings and errors (#329)
Browse files Browse the repository at this point in the history
  • Loading branch information
markdalgleish authored Feb 27, 2019
1 parent d77a018 commit e2b3043
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ SOURCE HTML:
</html>
POST HYDRATE DIFFS: NO DIFF
WARNINGS: Array []
ERRORS: Array []
`;
exports[`custom-src-paths build should generate the expected files 1`] = `
Expand Down Expand Up @@ -190,6 +188,4 @@ SOURCE HTML:
</html>
POST HYDRATE DIFFS: NO DIFF
WARNINGS: Array []
ERRORS: Array []
`;
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,4 @@ POST HYDRATE DIFFS:
</body>
</html>
WARNINGS: Array []
ERRORS: Array []
`;
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ SOURCE HTML:
</html>
POST HYDRATE DIFFS: NO DIFF
WARNINGS: Array []
ERRORS: Array []
`;
exports[`multiple-routes build should generate the expected files 1`] = `
Expand Down Expand Up @@ -554,8 +552,6 @@ POST HYDRATE DIFFS:
Some special async content
</span>
WARNINGS: Array []
ERRORS: Array []
`;
exports[`multiple-routes start should render home page correctly 1`] = `
Expand Down Expand Up @@ -632,6 +628,4 @@ SOURCE HTML:
</html>
POST HYDRATE DIFFS: NO DIFF
WARNINGS: Array []
ERRORS: Array []
`;
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,4 @@ SOURCE HTML:
</html>
POST HYDRATE DIFFS: NO DIFF
WARNINGS: Array []
ERRORS: Array []
`;
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ POST HYDRATE DIFFS:
</div>
</div>
WARNINGS: Array []
ERRORS: Array []
`;
exports[`react-css-modules should generate the expected files 1`] = `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ SOURCE HTML:
</html>
POST HYDRATE DIFFS: NO DIFF
WARNINGS: Array []
ERRORS: Array []
`;
exports[`ssr-hello-world build default port should generate a production server based on config 1`] = `
Expand Down Expand Up @@ -140,8 +138,6 @@ SOURCE HTML:
</html>
POST HYDRATE DIFFS: NO DIFF
WARNINGS: Array []
ERRORS: Array []
`;
exports[`ssr-hello-world start should start a development server 1`] = `
Expand Down Expand Up @@ -212,6 +208,4 @@ SOURCE HTML:
</html>
POST HYDRATE DIFFS: NO DIFF
WARNINGS: Array []
ERRORS: Array []
`;
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ SOURCE HTML:
</html>
POST HYDRATE DIFFS: NO DIFF
WARNINGS: Array []
ERRORS: Array []
`;
exports[`typescript-css-modules build should generate the expected files 1`] = `
Expand Down Expand Up @@ -247,8 +245,6 @@ SOURCE HTML:
</html>
POST HYDRATE DIFFS: NO DIFF
WARNINGS: Array []
ERRORS: Array []
`;
exports[`typescript-css-modules build-ssr should generate the expected files 1`] = `
Expand Down Expand Up @@ -351,6 +347,4 @@ SOURCE HTML:
</html>
POST HYDRATE DIFFS: NO DIFF
WARNINGS: Array []
ERRORS: Array []
`;
14 changes: 6 additions & 8 deletions test/utils/appSnapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ const cssSnapshotSerializer = {
};

const appSnapshotSerializer = {
print: (
{ sourceHtml, clientRenderContent, warnings, errors },
serializer
) => {
print: ({ sourceHtml, clientRenderContent }, serializer) => {
const serializedSouceHtml = serializer(sourceHtml);
const serializedClientRenderContent = serializer(clientRenderContent);

Expand All @@ -29,9 +26,7 @@ const appSnapshotSerializer = {

const snapshotItems = [
`SOURCE HTML: ${serializedSouceHtml}`,
`POST HYDRATE DIFFS: ${htmlDiff ? `\n${htmlDiff}` : 'NO DIFF'}`,
`WARNINGS: ${serializer(warnings)}`,
`ERRORS: ${serializer(errors)}`
`POST HYDRATE DIFFS: ${htmlDiff ? `\n${htmlDiff}` : 'NO DIFF'}`
];

return snapshotItems.join('\n');
Expand Down Expand Up @@ -66,7 +61,10 @@ const getAppSnapshot = async url => {
const sourceHtml = await response.text();
const clientRenderContent = await page.content();

return { sourceHtml, clientRenderContent, warnings, errors };
expect(warnings).toEqual([]);
expect(errors).toEqual([]);

return { sourceHtml, clientRenderContent };
};

module.exports = {
Expand Down
38 changes: 3 additions & 35 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4721,7 +4721,7 @@ debug@^4.0.0, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1:
dependencies:
ms "^2.1.1"

debuglog@*, debuglog@^1.0.1:
debuglog@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492"
integrity sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI=
Expand Down Expand Up @@ -7312,7 +7312,7 @@ import-local@^2.0.0:
pkg-dir "^3.0.0"
resolve-cwd "^2.0.0"

imurmurhash@*, imurmurhash@^0.1.4:
imurmurhash@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"
integrity sha1-khi5srkoojixPcT7a21XbyMUU+o=
Expand Down Expand Up @@ -8965,11 +8965,6 @@ lockfile@^1.0.4:
dependencies:
signal-exit "^3.0.2"

lodash._baseindexof@*:
version "3.1.0"
resolved "https://registry.yarnpkg.com/lodash._baseindexof/-/lodash._baseindexof-3.1.0.tgz#fe52b53a1c6761e42618d654e4a25789ed61822c"
integrity sha1-/lK1OhxnYeQmGNZU5KJXie1hgiw=

lodash._baseuniq@~4.6.0:
version "4.6.0"
resolved "https://registry.yarnpkg.com/lodash._baseuniq/-/lodash._baseuniq-4.6.0.tgz#0ebb44e456814af7905c6212fa2c9b2d51b841e8"
Expand All @@ -8978,33 +8973,11 @@ lodash._baseuniq@~4.6.0:
lodash._createset "~4.0.0"
lodash._root "~3.0.0"

lodash._bindcallback@*:
version "3.0.1"
resolved "https://registry.yarnpkg.com/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz#e531c27644cf8b57a99e17ed95b35c748789392e"
integrity sha1-5THCdkTPi1epnhftlbNcdIeJOS4=

lodash._cacheindexof@*:
version "3.0.2"
resolved "https://registry.yarnpkg.com/lodash._cacheindexof/-/lodash._cacheindexof-3.0.2.tgz#3dc69ac82498d2ee5e3ce56091bafd2adc7bde92"
integrity sha1-PcaayCSY0u5ePOVgkbr9Ktx73pI=

lodash._createcache@*:
version "3.1.2"
resolved "https://registry.yarnpkg.com/lodash._createcache/-/lodash._createcache-3.1.2.tgz#56d6a064017625e79ebca6b8018e17440bdcf093"
integrity sha1-VtagZAF2JeeevKa4AY4XRAvc8JM=
dependencies:
lodash._getnative "^3.0.0"

lodash._createset@~4.0.0:
version "4.0.3"
resolved "https://registry.yarnpkg.com/lodash._createset/-/lodash._createset-4.0.3.tgz#0f4659fbb09d75194fa9e2b88a6644d363c9fe26"
integrity sha1-D0ZZ+7CddRlPqeK4imZE02PJ/iY=

lodash._getnative@*, lodash._getnative@^3.0.0:
version "3.9.1"
resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5"
integrity sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=

lodash._reinterpolate@~3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d"
Expand Down Expand Up @@ -9060,11 +9033,6 @@ lodash.memoize@^4.1.2:
resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe"
integrity sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=

lodash.restparam@*:
version "3.6.1"
resolved "https://registry.yarnpkg.com/lodash.restparam/-/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805"
integrity sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU=

lodash.set@^4.3.2:
version "4.3.2"
resolved "https://registry.yarnpkg.com/lodash.set/-/lodash.set-4.3.2.tgz#d8757b1da807dde24816b0d6a84bea1a76230b23"
Expand Down Expand Up @@ -12195,7 +12163,7 @@ readable-stream@~1.1.10:
isarray "0.0.1"
string_decoder "~0.10.x"

readdir-scoped-modules@*, readdir-scoped-modules@^1.0.0:
readdir-scoped-modules@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/readdir-scoped-modules/-/readdir-scoped-modules-1.0.2.tgz#9fafa37d286be5d92cbaebdee030dc9b5f406747"
integrity sha1-n6+jfShr5dksuuve4DDcm19AZ0c=
Expand Down

0 comments on commit e2b3043

Please sign in to comment.