-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix all tests that were silently passing in spite of AMP runtime errors #14406
Comments
Pinging several folks for maximum visibility. (Sorry about the GitHub notifications this might generate.) Attention (in no particular order): @jridgewell @alanorozco @dvoytenko @keithwrightbos @aghassemi @cvializ @bradfrizzell @zhouyx @lannka @choumx @charliereams @glevitzky @avimehta @jonkeller @nainar @danielrozenberg @mkhatib @cathyxz @prateekbh @TienDao @newmuis You were mentioned in this issue because you wrote, edited, or reviewed a test that had to be skipped because it contained console errors from the AMP runtime that are now being surfaced as test failures. If you see a skipped test with |
Update: With #14432, there are a few changes to note:
|
Update: With #14549, all the tests that were skipped in #14336 are now re-enabled. When a test contains a Once all errors are cleaned up, we will go back to failing tests with unexpected errors. |
Should this be closed now that the TODOs are removed and console errors fail locally? |
@choumx We still have about 700 unfixed / uncaught errors when all unit tests are run: https://travis-ci.org/ampproject/amphtml/jobs/383335338#L2306. This is why we still warn on Travis. I was going to keep this issue open until all those are fixed, and we move from warning to failing tests on Travis. WDYT? |
With #15621, there's a new construct called |
I found The current console error stub somehow completely shielded the exception from One solution is to stub |
@lannka Nice find! Would it make sense to throw the error synchronously during tests? That way, we won't lose the error information, and we will have a complete call stack in the test logs. |
@rsimha agreed. The only concern is that then there is no way to verify a fallback logic of such an error.
We will not be able to have a test to verify "fallback". |
We no longer rethrow (synchronously or asynchronously) when an uncaught console error is detected in a test. |
Background:
In #7381, @cramforce brought up the issue that several of our tests were silently passing in spite of errors being logged by the AMP runtime.
#14336 added a stub for
console.error
totest/_init_tests.js
so that AMP runtime errors during tests would now be surfaced asmocha
test errors. It also skipped about 6% of the existing AMP tests that were erroring out due to this change.Update: Due to the sheer number of tests with errors, #14549 unskipped all the tests that were skipped in #14336. Now, when a test contains a
console.error
that's not wrapped inallowConsoleError
, a warning will be printed with instructions, and the test will continue to pass.Update: With #15621, there's a new construct called
expectAsyncConsoleError('message')
that can be used for async errors.Action item:
Now, it's time to fix these tests. I'm assigning this issue to all component owners whose tests were skipped by #14336. (GH only allows 10 assignees for issues, but I'm assuming the list here will cover all components.)
Instructions:
#14336
in the test files you own.gulp test --unit
orgulp test --integration
orgulp test --local-changes
console.error
) when run with other tests. This is typically a symptom of the test relying on dirty global state.allowConsoleError
block around the test step that generates the error.expectAsyncConsoleError(message)
at the top of the testExamples (UPDATED, based on #14432 and #15609):
Fails:
Fails:
Fails:
Passes:
Passes:
Related to #14360
The text was updated successfully, but these errors were encountered: