Skip to content
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

Support reporting coverage for tests #36

Merged
merged 1 commit into from
Nov 27, 2014
Merged

Support reporting coverage for tests #36

merged 1 commit into from
Nov 27, 2014

Conversation

SevInf
Copy link

@SevInf SevInf commented Nov 10, 2014

If coverage options is set, template files will be instrumented
before execution (can be enabled per-technology). If templates are
built with source map, there is an option to show coverage for
original files.
There is also an option to filter out some sources from report. By
default, all content of node_modules and libs will be omitted.

@andrewblond @arikon @j0tunn

CoverageObject.prototype = {
constructor: CoverageObject,

addStatement: function (start, end, counter) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

вот эти три функции(addStatement, addFunction, addBranch) несколько похожи друг на друга. Нет желания подрефакторить и убрать дублирование?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Мне кажется, что эта похожесть — совпадение

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Похожесть только видимая, на самом деле:

  • source достается из разных локаций (start для стейтментов и функций, locations[0] для бранчей)
  • индексы берутся из разных переменных (b, f, s)
  • метаданные записываются в разные объекты (branchMap, functionMap, statementMap)
  • структура метаданных везде разная (для стейтмена – просто start и end, для функции {name, loc: {start, end}}, для ветвлений {line, type, locations: [{start, end}])
  • счетчики записываются в разные объекты b, f, s.

@arikon
Copy link
Member

arikon commented Nov 13, 2014

@SevInf ping!

@SevInf
Copy link
Author

SevInf commented Nov 18, 2014

@arikon @j0tunn @andrewblond
Обновил.
@andrewblond, не сделал вариант coverage:true. Не понятно, какие значения у coverage.reportDirectory и coverage.reporters должны быть.

@blond
Copy link
Member

blond commented Nov 24, 2014

@SevInf для опций логично ожидать значений по умолчанию как в istanbul:

coverage.reportersLCOV
coverage.reportDirectorycoverage

@SevInf
Copy link
Author

SevInf commented Nov 26, 2014

@andrewblond, поправил, нужно финальное ревью.

@SevInf SevInf force-pushed the feature/coverage2 branch 2 times, most recently from 640985c to e4b9700 Compare November 27, 2014 09:17
@SevInf
Copy link
Author

SevInf commented Nov 27, 2014

@andrewblond исправил вчерашний баг

If `coverage` options is set, template files will be instrumented
before execution (can be enabled per-technology). If templates are
built with source map, there is an option to show coverage for
original files.
There is also an option to filter out some sources from report. By
default, all content of `node_modules` and `libs` will be omitted.
@blond
Copy link
Member

blond commented Nov 27, 2014

@SevInf, всё супер! =)

blond pushed a commit that referenced this pull request Nov 27, 2014
Support reporting coverage for tests
@blond blond merged commit 1051072 into master Nov 27, 2014
@blond blond deleted the feature/coverage2 branch November 27, 2014 13:04
@blond blond mentioned this pull request Nov 27, 2014
@blond
Copy link
Member

blond commented Nov 27, 2014

Вошло в версию 0.5.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants