ignore coverage for code branches where error objects are not crerated

master
Evgeny Poberezkin 2015-12-12 18:27:57 +00:00
parent 8114a2b442
commit b5e3e7da6e
2 changed files with 4 additions and 2 deletions

View File

@ -1,5 +1,5 @@
{{## def._error:_rule:
{{ /* istanbul ignore else */ }}
{{ 'istanbul ignore else'; }}
{{? it.createErrors !== false }}
{
keyword: '{{=_rule}}'

View File

@ -19,6 +19,7 @@ console.log('\n\nCompiling:');
var FUNCTION_NAME = /function\s+anonymous\s*\(it[^)]*\)\s*{/;
var OUT_EMPTY_STRING = /out\s*\+=\s*'\s*';/g;
var ISTANBUL = /\'(istanbul[^']+)\';/g;
files.forEach(function (f) {
var keyword = path.basename(f, '.jst');
@ -27,7 +28,8 @@ files.forEach(function (f) {
var code = doT.compile(template, defs);
code = code.toString()
.replace(OUT_EMPTY_STRING, '')
.replace(FUNCTION_NAME, 'function generate_' + keyword + '(it) {');
.replace(FUNCTION_NAME, 'function generate_' + keyword + '(it) {')
.replace(ISTANBUL, '/* $1 */');
code = "'use strict';\nmodule.exports = " + code;
code = beautify(code, { indent_size: 2 }) + '\n';
fs.writeFileSync(targetPath, code);