Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions screenshot/errorHandler.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// A little utility to catch errors executing the test generation routines

window.addEventListener('error', errorMsg => {
window.__TEST_DATA = 'Error occurred: ' + errorMsg.message;
return false;
}, {capture: true});
1 change: 1 addition & 0 deletions screenshot/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {render} from 'react-dom';
import App, {testMetadata} from 'UI_TEST_APP_ENTRY';
import './errorHandler';
import TestChooser from './TestChooser';

const url = new URL(window.location.href);
Expand Down
4 changes: 4 additions & 0 deletions utils/runTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ const runTest = ({concurrency, filter, Page, testName, ...rest}) => {
return window.__TEST_DATA; // eslint-disable-line no-undef
});

if (typeof testCases === 'string') {
throw new Error(`Test data failed to load: ${testCases}.\n\nLoad page in a browser to view the error.`)
}

expect(testCases).to.be.an('object', 'Test data failed to load');

describe(testName, function () {
Expand Down