Skip to content

✅ Unskip tests that were skipped due to console errors#14549

Merged
rsimha merged 4 commits intoampproject:masterfrom
rsimha:2018-04-11-UnskipTests
Apr 12, 2018
Merged

✅ Unskip tests that were skipped due to console errors#14549
rsimha merged 4 commits intoampproject:masterfrom
rsimha:2018-04-11-UnskipTests

Conversation

@rsimha
Copy link
Copy Markdown
Contributor

@rsimha rsimha commented Apr 11, 2018

This PR unskips all the tests that were skipped earlier due to console.error. Tests will now have to use an allowConsoleError block around code that legitimately needs to generate an error. Until then, they will continue to pass, but will print a message with the console.error text, and instructions for how to fix it.

In addition, this test temporarily reverts to using sinon.stub for console.error until such time that we're ready to fail tests that contain unexpected errors. This will make testing less prone to failures until everyone fixes the errors in their tests.

Follow up to #14336
Follow up to #14432
Related to #14406
Related to #7381

@rsimha rsimha self-assigned this Apr 11, 2018
@rsimha
Copy link
Copy Markdown
Contributor Author

rsimha commented Apr 11, 2018

/to @choumx @danielrozenberg

' ⤷ If this is expected, use the following pattern to wrap the ' +
'test code that generated the error:\n' +
' \'allowConsoleError(() => { <code that generated the ' +
'error> });';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be encouraging use of allowConsoleError() or giving access to the stub and overriding its behavior?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The plan is for tests to use allowConsoleError. Once all usage of console.error is fixed (or wrapped in allowConsoleError), we can internally make the check more stringent using a mock and start failing tests that have errors. This won't need any changes on the test side.

@rsimha rsimha merged commit 97847f2 into ampproject:master Apr 12, 2018
@rsimha rsimha deleted the 2018-04-11-UnskipTests branch April 12, 2018 04:43
@rsimha rsimha restored the 2018-04-11-UnskipTests branch April 12, 2018 04:45
@rsimha rsimha deleted the 2018-04-11-UnskipTests branch April 12, 2018 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants