chore(tests): redirect debugError to the output category of tests (#2969)

I have seen some flaky test failures where it would be nice to have run the tests with `DEBUG=puppeteer:error`. Instead of always running tests like that, I am redirecting `debugError` to the output category of the test. This is the same thing that we do for Chromium's stderr.

As a drive-by, I added an additional `debugError` where we were usually a try..finally pattern.
This commit is contained in:
Joel Einbinder
2018-07-30 11:16:12 -07:00
committed by Andrey Lushnikov
parent 12e3510eca
commit c5fe1dbdbb
2 changed files with 11 additions and 2 deletions

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const {helper, assert} = require('./helper');
const {helper, assert, debugError} = require('./helper');
const fs = require('fs');
const openAsync = helper.promisify(fs.open);
@@ -89,6 +89,8 @@ class Tracing {
let resultBuffer = null;
try {
resultBuffer = Buffer.concat(bufs);
} catch (error) {
debugError(error);
} finally {
return resultBuffer;
}