@samitouri / QOS-React / commits / 39671ba45b

Move some tests from failing to passing except dev (#9711)

These throw because we're asserting on the warnings. Make this not throw so that they instead only fail to assert the warnings.

Sebastian Markbåge committed May 17, 2017 at 23:54 UTC 39671ba45bf42caa370db5aab4be267e717221f3
3 files changed +20 -19
scripts/fiber/tests-failing.txt
-5
@@ -1,8 +1,3 @@
1 -src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js
2 -* gives source code refs for unknown prop warning (ssr)
3 -* gives source code refs for unknown prop warning for exact elements (ssr)
4 -* gives source code refs for unknown prop warning for exact elements in composition (ssr)
5 -
1 src/renderers/dom/shared/__tests__/ReactDOMServerIntegration-test.js
2 * renders a blank div with client render on top of good server markup
3 * renders a div with inline styles with client render on top of good server markup
scripts/fiber/tests-passing-except-dev.txt
+3
@@ -1,4 +1,7 @@
1 src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js
2 +* gives source code refs for unknown prop warning (ssr)
3 +* gives source code refs for unknown prop warning for exact elements (ssr)
4 +* gives source code refs for unknown prop warning for exact elements in composition (ssr)
5 * should suggest property name if available (ssr)
6
7 src/renderers/dom/shared/__tests__/ReactDOMServerIntegration-test.js
src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js
+17 -14
@@ -1592,10 +1592,10 @@ describe('ReactDOMComponent', () => {
1592 ReactTestUtils.renderIntoDocument(<div class="paladin" />);
1593 ReactTestUtils.renderIntoDocument(<input type="text" onclick="1" />);
1594 expectDev(console.error.calls.count()).toBe(2);
1595 - expect(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toBe(
1595 + expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toBe(
1596 'Warning: Unknown DOM property class. Did you mean className?\n in div (at **)',
1597 );
1598 - expect(normalizeCodeLocInfo(console.error.calls.argsFor(1)[0])).toBe(
1598 + expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(1)[0])).toBe(
1599 'Warning: Unknown event handler property onclick. Did you mean ' +
1600 '`onClick`?\n in input (at **)',
1601 );
@@ -1606,10 +1606,10 @@ describe('ReactDOMComponent', () => {
1606 ReactDOMServer.renderToString(<div class="paladin" />);
1607 ReactDOMServer.renderToString(<input type="text" onclick="1" />);
1608 expectDev(console.error.calls.count()).toBe(2);
1609 - expect(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toBe(
1609 + expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toBe(
1610 'Warning: Unknown DOM property class. Did you mean className?\n in div (at **)',
1611 );
1612 - expect(normalizeCodeLocInfo(console.error.calls.argsFor(1)[0])).toBe(
1612 + expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(1)[0])).toBe(
1613 'Warning: Unknown event handler property onclick. Did you mean ' +
1614 '`onClick`?\n in input (at **)',
1615 );
@@ -1624,7 +1624,7 @@ describe('ReactDOMComponent', () => {
1624
1625 ReactTestUtils.renderIntoDocument(<div class="paladin" />, container);
1626 expectDev(console.error.calls.count()).toBe(1);
1627 - expect(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toBe(
1627 + expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toBe(
1628 'Warning: Unknown DOM property class. Did you mean className?\n in div (at **)',
1629 );
1630 });
@@ -1674,15 +1674,16 @@ describe('ReactDOMComponent', () => {
1674
1675 expectDev(console.error.calls.argsFor(0)[0]).toContain('className');
1676 var matches = console.error.calls.argsFor(0)[0].match(/.*\(.*:(\d+)\).*/);
1677 - var previousLine = matches[1];
1677 + var previousLine = (matches || [])[1];
1678
1679 expectDev(console.error.calls.argsFor(1)[0]).toContain('onClick');
1680 - matches = console.error.calls.argsFor(1)[0].match(/.*\(.*:(\d+)\).*/);
1681 - var currentLine = matches[1];
1680 + matches = console.error.calls.argsFor(1)[0].match(/.*\(.*:(\d+)\).*/) || {
1681 + };
1682 + var currentLine = (matches || [])[1];
1683
1684 //verify line number has a proper relative difference,
1685 //since hard coding the line number would make test too brittle
1685 - expect(parseInt(previousLine, 10) + 2).toBe(parseInt(currentLine, 10));
1686 + expectDev(parseInt(previousLine, 10) + 2).toBe(parseInt(currentLine, 10));
1687 });
1688
1689 it('gives source code refs for unknown prop warning for exact elements in composition', () => {
@@ -1725,11 +1726,11 @@ describe('ReactDOMComponent', () => {
1726
1727 expectDev(console.error.calls.argsFor(0)[0]).toContain('className');
1728 var matches = console.error.calls.argsFor(0)[0].match(/.*\(.*:(\d+)\).*/);
1728 - var previousLine = matches[1];
1729 + var previousLine = (matches || [])[1];
1730
1731 expectDev(console.error.calls.argsFor(1)[0]).toContain('onClick');
1732 matches = console.error.calls.argsFor(1)[0].match(/.*\(.*:(\d+)\).*/);
1732 - var currentLine = matches[1];
1733 + var currentLine = (matches || [])[1];
1734
1735 //verify line number has a proper relative difference,
1736 //since hard coding the line number would make test too brittle
@@ -1776,15 +1777,17 @@ describe('ReactDOMComponent', () => {
1777
1778 expectDev(console.error.calls.argsFor(0)[0]).toContain('className');
1779 var matches = console.error.calls.argsFor(0)[0].match(/.*\(.*:(\d+)\).*/);
1779 - var previousLine = matches[1];
1780 + var previousLine = (matches || [])[1];
1781
1782 expectDev(console.error.calls.argsFor(1)[0]).toContain('onClick');
1783 matches = console.error.calls.argsFor(1)[0].match(/.*\(.*:(\d+)\).*/);
1783 - var currentLine = matches[1];
1784 + var currentLine = (matches || [])[1];
1785
1786 //verify line number has a proper relative difference,
1787 //since hard coding the line number would make test too brittle
1787 - expect(parseInt(previousLine, 10) + 12).toBe(parseInt(currentLine, 10));
1788 + expectDev(parseInt(previousLine, 10) + 12).toBe(
1789 + parseInt(currentLine, 10),
1790 + );
1791 });
1792
1793 it('should suggest property name if available', () => {