Bug 1586189 - Provide useful assertion messages. r=ttung

Differential Revision: https://phabricator.services.mozilla.com/D48712

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Simon Giesecke 2019-10-10 07:17:16 +00:00
Родитель 05480d5b8b
Коммит 49db1f8c5f
1 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -71,8 +71,14 @@
// eslint-disable-next-line no-eval
let message = eval(event.data);
is(message.source, "iframe", "Good source");
is(message.result, testData[testIndex].expectedResult, "Good result");
// TODO: This is an ad-hoc solution to get a useful assertion message.
// It would be desirable that the test framework provides the ability
// to capture context information and provide it on assertion failures,
// automatically stringified.
let testContext = `testData[${testIndex}] == ${JSON.stringify(testData[testIndex])}`;
is(message.source, "iframe", `Good source for ${testContext}`);
is(message.result, testData[testIndex].expectedResult, `Good result for ${testContext}`);
openedWindow.close();