mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 16:47:49 +00:00
Add underscore tests to sauce.
This commit is contained in:
@@ -33,6 +33,46 @@
|
||||
global_test_results = results;
|
||||
});
|
||||
|
||||
// skip tests we intentionally fail or those with problems
|
||||
(function() {
|
||||
var skipped = {
|
||||
'Backbone.Collection': {
|
||||
'set with many models does not overflow the stack': true
|
||||
}
|
||||
};
|
||||
|
||||
QUnit.testStart(function(details) {
|
||||
var test = QUnit.config.current,
|
||||
skippedTests = skipped[details.module],
|
||||
skippedAsserts = skippedTests && skippedTests[details.name];
|
||||
|
||||
if (!skippedAsserts) {
|
||||
return;
|
||||
}
|
||||
if (skippedAsserts === true) {
|
||||
test.expected = 0;
|
||||
test.callback = _.noop;
|
||||
return;
|
||||
}
|
||||
test.finish = _.wrap(test.finish, function(func) {
|
||||
_.each(this.assertions, function(assert) {
|
||||
var message = _.unescape(_.result(/^<span class='test-message'>([\s\S]*?)<\/span>/.exec(assert.message), 1)),
|
||||
died = _.result(/^Died on test #\d+/.exec(message), 0),
|
||||
expected = _.unescape(_.result(/Expected: *<\/th><td><pre>([\s\S]*?)<\/pre>/.exec(assert.message), 1));
|
||||
|
||||
if ((message && _.contains(skippedAsserts, message)) ||
|
||||
(died && _.contains(skippedAsserts, died)) ||
|
||||
(expected && (_.contains(skippedAsserts, expected) ||
|
||||
_.contains(skippedAsserts, expected.replace(/\s+/g, '')))
|
||||
)) {
|
||||
assert.result = true;
|
||||
}
|
||||
});
|
||||
func.call(this);
|
||||
});
|
||||
});
|
||||
}());
|
||||
|
||||
// load Lo-Dash again to overwrite the existing `_` value
|
||||
document.write('<script src="' + ui.buildPath + '"><\/script>');
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user