Files
react/test/lib/reportTestResults.browser.js
T
Benjamin Woodruff c089eece50 Switch to using comma-dangle: always-multiline
This is a machine-generated codemod, but it's pretty safe since it was
generated by hooking into eslint's own report.

A few files had to be touched up by hand because there were existing
formatting issues with nested arrays/objects:

src/shared/utils/__tests__/OrderedMap-test.js
src/shared/utils/__tests__/Transaction-test.js
src/shared/utils/__tests__/traverseAllChildren-test.js
src/isomorphic/children/__tests__/ReactChildren-test.js
2015-06-02 16:57:26 -07:00

61 lines
1.4 KiB
JavaScript

var __DEBUG__ = location.search.substring(1).indexOf('debug') !== -1;
if (typeof console === 'undefined') {
console = {
log: function() {},
warn: function() {},
error: function() {},
};
}
var __consoleReport__ = [];
console._log = console.log;
console.log = function(message) {
console._log(message);
if (__DEBUG__) {
postDataToURL({type:'log', message:message}, '/reportTestResults');
} else {
__consoleReport__.push({type:'log', message:message});
}
};
console._error = console.error;
console.error = function(message) {
console._error(message);
if (__DEBUG__) {
postDataToURL({type:'error', message:message}, '/reportTestResults');
} else {
__consoleReport__.push({type:'error', message:message});
}
};
console._flush = function() {
postDataToURL(__consoleReport__, '/console');
__consoleReport__.length = 0;
};
(function(env) {
env.addReporter(new jasmine.JSReporter());
env.addReporter(new TAPReporter(console.log.bind(console)));
function report() {
if (typeof jasmine.getJSReport !== 'function') {
return setTimeout(report, 100);
}
if (!__DEBUG__) {
console.log('DONE\t' + navigator.userAgent);
console._flush();
}
}
var oldCallback = env.currentRunner().finishCallback;
env.currentRunner().finishCallback = function() {
if (oldCallback) {
oldCallback.apply(this, arguments);
}
report();
};
}(window.jasmine.getEnv()));