-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added htmlDiffer
option
#72
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,19 @@ | ||
var util = require('util'), | ||
HtmlDiffer = require('html-differ').HtmlDiffer, | ||
htmlDiffer = new HtmlDiffer('bem'), | ||
diffLogger = require('html-differ/lib/logger'), | ||
ms = require('mocha/lib/ms'), | ||
SpecReporter = require('mocha/lib/reporters/spec'), | ||
color = require('mocha/lib/reporters/base').color; | ||
|
||
exports = module.exports = Reporter; | ||
|
||
function Reporter(runner) { | ||
function Reporter(runner, diffOpts) { | ||
diffOpts || (diffOpts = {}); | ||
|
||
diffOpts.preset || (diffOpts.preset = 'bem'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. А зачем нам еще одна проверка, если мы уже получили опции и установили их. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Да, наверное, не стоит злоупотреблять ;-) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Репортер можно захотеть использовать как-то отдельно/сбоку. Поэтому он не должен расчитывать на то, что опции уже инициализированны. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ну тут разработчику виднее ;) |
||
|
||
this._htmlDiffer = new HtmlDiffer(diffOpts); | ||
|
||
SpecReporter.call(this, runner); | ||
} | ||
|
||
|
@@ -44,6 +49,8 @@ Reporter.prototype.epilogue = function () { | |
}; | ||
|
||
Reporter.prototype.list = function (failures) { | ||
var htmlDiffer = this._htmlDiffer; | ||
|
||
console.error(); | ||
failures.forEach(function (test, i) { | ||
var fmt = color('error title', ' %s) %s:\n') + color('error message', ' %s\n'), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Вот тут же мы вроде как уже обработали все.