mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-06 20:11:38 +08:00
This CL extracts some functions from hook.ts that are related to stdout/stderr and general exception handling. The most important goal of the refactoring is that we can re-use the logic for more than one DevTools frontend puppeteer.Pages. R=jacktfranklin@chromium.org Bug: 1297458 Change-Id: I7a0272e3618e22bc600a358e34fb8696f569bc7b Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3461559 Reviewed-by: Jack Franklin <jacktfranklin@chromium.org> Commit-Queue: Simon Zünd <szuend@chromium.org>
37 lines
1.3 KiB
TypeScript
37 lines
1.3 KiB
TypeScript
// Copyright 2020 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
import {assert} from 'chai';
|
|
|
|
import {expectedErrors} from '../../conductor/events.js';
|
|
import {getBrowserAndPages, goToResource, step} from '../../shared/helper.js';
|
|
import {describe, it} from '../../shared/mocha-extensions.js';
|
|
|
|
describe('Assertions', async function() {
|
|
it('console.assert', async () => {
|
|
const {frontend} = getBrowserAndPages();
|
|
await step('Check the evaluation results from console', async () => {
|
|
await frontend.evaluate(() => {
|
|
console.assert(false, 'expected failure 1');
|
|
});
|
|
});
|
|
await goToResource('cross_tool/default.html');
|
|
assert.ok(expectedErrors.some(error => error.includes('expected failure 1')));
|
|
});
|
|
|
|
it('console.error', async () => {
|
|
const {frontend} = getBrowserAndPages();
|
|
await step('Check the evaluation results from console', async () => {
|
|
await frontend.evaluate(() => {
|
|
function foo() {
|
|
console.error('expected failure 2');
|
|
}
|
|
foo();
|
|
});
|
|
});
|
|
await goToResource('cross_tool/default.html');
|
|
assert.ok(expectedErrors.some(error => error.includes('expected failure 2')));
|
|
});
|
|
});
|