" + escapeText(document.title) + ' (original) (raw)
Running...
appendInterface(beginDetails); }); function getRerunFailedHtml(failedTests) { if (failedTests.length === 0) { return ''; } var href = setUrl({ testId: failedTests }); return ["
[", failedTests.length === 1 ? 'Rerun 1 failed test' : 'Rerun ' + failedTests.length + ' failed tests', '](" + escapeText%28href%29 + ")'].join(''); } QUnit.on('runEnd', function (runEnd) { var banner = id('qunit-banner'); var tests = id('qunit-tests'); var abortButton = id('qunit-abort-tests-button'); var assertPassed = config.stats.all - config.stats.bad; var html = [runEnd.testCounts.total, ' tests completed in ', runEnd.runtime, ' milliseconds, with ', runEnd.testCounts.failed, ' failed, ', runEnd.testCounts.skipped, ' skipped, and ', runEnd.testCounts.todo, ' todo.
', "", assertPassed, " assertions of ", config.stats.all, " passed, ", config.stats.bad, ' failed.', getRerunFailedHtml(stats.failedTests)].join(''); var test; var assertLi; var assertList; // Update remaining tests to aborted if (abortButton && abortButton.disabled) { html = 'Tests aborted after ' + runEnd.runtime + ' milliseconds.'; for (var i = 0; i < tests.children.length; i++) { test = tests.children[i]; if (test.className === '' || test.className === 'running') { test.className = 'aborted'; assertList = test.getElementsByTagName('ol')[0]; assertLi = document.createElement('li'); assertLi.className = 'fail'; assertLi.innerHTML = 'Test aborted.'; assertList.appendChild(assertLi); } } } if (banner && (!abortButton || abortButton.disabled === false)) { banner.className = runEnd.status === 'failed' ? 'qunit-fail' : 'qunit-pass'; } if (abortButton) { abortButton.parentNode.removeChild(abortButton); } if (tests) { id('qunit-testresult-display').innerHTML = html; } if (config.altertitle && document.title) { // Show ✖ for good, ✔ for bad suite result in title // use escape sequences in case file gets loaded with non-utf-8 // charset document.title = [runEnd.status === 'failed' ? "\u2716" : "\u2714", document.title.replace(/^[\u2714\u2716] /i, '')].join(' '); } // Scroll back to top to show results if (config.scrolltop && window$1.scrollTo) { window$1.scrollTo(0, 0); } }); function getNameHtml(name, module) { var nameHtml = ''; if (module) { nameHtml = "" + escapeText(module) + ': '; } nameHtml += "" + escapeText(name) + ''; return nameHtml; } function getProgressHtml(stats) { return [stats.completed, ' / ', stats.defined, ' tests completed.
'].join(''); } QUnit.testStart(function (details) { var running, bad; appendTest(details.name, details.testId, details.module); running = id('qunit-testresult-display'); if (running) { addClass(running, 'running'); bad = QUnit.config.reorder && details.previousFailure; running.innerHTML = [getProgressHtml(stats), bad ? 'Rerunning previously failed test:
' : 'Running: ', getNameHtml(details.name, details.module), getRerunFailedHtml(stats.failedTests)].join(''); } }); function stripHtml(string) { // Strip tags, html entity and whitespaces return string.replace(/<\/?[^>]+(>|$)/g, '').replace(/"/g, '').replace(/\s+/g, ''); } QUnit.log(function (details) { var testItem = id('qunit-test-output-' + details.testId); if (!testItem) { return; } var message = escapeText(details.message) || (details.result ? 'okay' : 'failed'); message = "" + message + ''; message += "@ " + details.runtime + ' ms'; var expected; var actual; var diff; var showDiff = false; // When pushFailure() is called, it is implied that no expected value // or diff should be shown, because both expected and actual as undefined. // // This must check details.expected existence. If it exists as undefined, // that's a regular assertion for which to render actual/expected and a diff. var showAnyValues = !details.result && (details.expected !== undefined || details.actual !== undefined); if (showAnyValues) { if (details.negative) { expected = 'NOT ' + QUnit.dump.parse(details.expected); } else { expected = QUnit.dump.parse(details.expected); } actual = QUnit.dump.parse(details.actual); message += "'; if (actual !== expected) { message += "'; if (typeof details.actual === 'number' && typeof details.expected === 'number') { if (!isNaN(details.actual) && !isNaN(details.expected)) { showDiff = true; diff = details.actual - details.expected; diff = (diff > 0 ? '+' : '') + diff; } } else if (typeof details.actual !== 'boolean' && typeof details.expected !== 'boolean') { diff = QUnit.diff(expected, actual); // don't show diff if there is zero overlap showDiff = stripHtml(diff).length !== stripHtml(expected).length + stripHtml(actual).length; } if (showDiff) { message += "'; } } else if (expected.indexOf('[object Array]') !== -1 || expected.indexOf('[object Object]') !== -1) { message += "'; } else { message += "'; } if (details.source) { message += "'; } message += '
Expected: | " + escapeText(expected) + ' |
---|---|
Result: | " + escapeText(actual) + ' |
Diff: | " + diff + ' |
Message: | " + 'Diff suppressed as the depth of object is more than current max depth (' + QUnit.dump.maxDepth + ').Hint: Use QUnit.dump.maxDepth to ' + " run with a higher max depth or [" + 'Rerun without max depth](" + escapeText%28setUrl%28{ maxDepth: 0 }%29%29 + "). |
Message: | " + 'Diff suppressed as the expected and actual results have an equivalent' + ' serialization |
Source: | " + escapeText(details.source) + ' |
'; // This occurs when pushFailure is set and we have an extracted stack trace } else if (!details.result && details.source) { message += '' + "' + '
Source: | " + escapeText(details.source) + ' |
---|
'; } var assertList = testItem.getElementsByTagName('ol')[0]; var assertLi = document.createElement('li'); assertLi.className = details.result ? 'pass' : 'fail'; assertLi.innerHTML = message; assertList.appendChild(assertLi); }); QUnit.testDone(function (details) { var tests = id('qunit-tests'); var testItem = id('qunit-test-output-' + details.testId); if (!tests || !testItem) { return; } removeClass(testItem, 'running'); var status; if (details.failed > 0) { status = 'failed'; } else if (details.todo) { status = 'todo'; } else { status = details.skipped ? 'skipped' : 'passed'; } var assertList = testItem.getElementsByTagName('ol')[0]; var good = details.passed; var bad = details.failed; // This test passed if it has no unexpected failed assertions var testPassed = details.failed > 0 ? details.todo : !details.todo; if (testPassed) { // Collapse the passing tests addClass(assertList, 'qunit-collapsed'); } else { stats.failedTests.push(details.testId); if (config.collapse) { if (!collapseNext) { // Skip collapsing the first failing test collapseNext = true; } else { // Collapse remaining tests addClass(assertList, 'qunit-collapsed'); } } } // The testItem.firstChild is the test name var testTitle = testItem.firstChild; var testCounts = bad ? "" + bad + ', ' + "" + good + ', ' : ''; testTitle.innerHTML += " (" + testCounts + details.assertions.length + ')'; stats.completed++; if (details.skipped) { testItem.className = 'skipped'; var skipped = document.createElement('em'); skipped.className = 'qunit-skipped-label'; skipped.innerHTML = 'skipped'; testItem.insertBefore(skipped, testTitle); } else { addEvent(testTitle, 'click', function () { toggleClass(assertList, 'qunit-collapsed'); }); testItem.className = testPassed ? 'pass' : 'fail'; if (details.todo) { var todoLabel = document.createElement('em'); todoLabel.className = 'qunit-todo-label'; todoLabel.innerHTML = 'todo'; testItem.className += ' todo'; testItem.insertBefore(todoLabel, testTitle); } var time = document.createElement('span'); time.className = 'runtime'; time.innerHTML = details.runtime + ' ms'; testItem.insertBefore(time, assertList); } // Show the source of the test when showing assertions if (details.source) { var sourceName = document.createElement('p'); sourceName.innerHTML = 'Source: ' + escapeText(details.source); addClass(sourceName, 'qunit-source'); if (testPassed) { addClass(sourceName, 'qunit-collapsed'); } addEvent(testTitle, 'click', function () { toggleClass(sourceName, 'qunit-collapsed'); }); testItem.appendChild(sourceName); } if (config.hidepassed && (status === 'passed' || details.skipped)) { // use removeChild instead of remove because of support hiddenTests.push(testItem); tests.removeChild(testItem); } }); QUnit.on('error', function (error) { var testItem = appendTest('global failure'); if (!testItem) { // HTML Reporter is probably disabled or not yet initialized. return; } // Render similar to a failed assertion (see above QUnit.log callback) var message = escapeText(errorString(error)); message = "" + message + ''; if (error && error.stack) { message += '' + "' + '
Source: | " + escapeText(error.stack) + ' |
---|
'; } var assertList = testItem.getElementsByTagName('ol')[0]; var assertLi = document.createElement('li'); assertLi.className = 'fail'; assertLi.innerHTML = message; assertList.appendChild(assertLi); // Make it visible testItem.className = 'fail'; }); // Avoid readyState issue with phantomjs // Ref: #818 var usingPhantom = function (p) { return p && p.version && p.version.major > 0; }(window$1.phantom); if (usingPhantom) { console$1.warn('Support for PhantomJS is deprecated and will be removed in QUnit 3.0.'); } if (!usingPhantom && document.readyState === 'complete') { QUnit.autostart(); } else { addEvent(window$1, 'load', QUnit.autostart); } // Wrap window.onerror. We will call the original window.onerror to see if // the existing handler fully handles the error; if not, we will call the // QUnit.onError function. var originalWindowOnError = window$1.onerror; // Cover uncaught exceptions // Returning true will suppress the default browser handler, // returning false will let it run. window$1.onerror = function (message, fileName, lineNumber, columnNumber, errorObj) { var ret = false; if (originalWindowOnError) { for (var _len = arguments.length, args = new Array(_len > 5 ? _len - 5 : 0), _key = 5; _key < _len; _key++) { args[_key - 5] = arguments[_key]; } ret = originalWindowOnError.call.apply(originalWindowOnError, [this, message, fileName, lineNumber, columnNumber, errorObj].concat(args)); } // Treat return value as window.onerror itself does, // Only do our handling if not suppressed. if (ret !== true) { // If there is a current test that sets the internal `ignoreGlobalErrors` field // (such as during `assert.throws()`), then the error is ignored and native // error reporting is suppressed as well. This is because in browsers, an error // can sometimes end up in `window.onerror` instead of in the local try/catch. // This ignoring of errors does not apply to our general onUncaughtException // method, nor to our `unhandledRejection` handlers, as those are not meant // to receive an "expected" error during `assert.throws()`. if (config.current && config.current.ignoreGlobalErrors) { return true; } // According to // https://blog.sentry.io/2016/01/04/client-javascript-reporting-window-onerror, // most modern browsers support an errorObj argument; use that to // get a full stack trace if it's available. var error = errorObj || new Error(message); if (!error.stack && fileName && lineNumber) { error.stack = "".concat(fileName, ":").concat(lineNumber); } QUnit.onUncaughtException(error); } return ret; }; window$1.addEventListener('unhandledrejection', function (event) { QUnit.onUncaughtException(event.reason); }); })(); })();