-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: replace handlebars with template strings.
- Loading branch information
Showing
17 changed files
with
1,074 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
enableTemplateStringHTMLReporter: 'true' | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
'use strict'; | ||
|
||
const Hoek = require('@hapi/hoek'); | ||
|
||
exports.replace = (str, from, to, flags) => { | ||
|
||
return str.replace(new RegExp(from, flags), to); | ||
}; | ||
|
||
// Display all valid numbers except zeros | ||
exports.number = (number) => { | ||
|
||
return +number || ''; | ||
}; | ||
|
||
exports.join = (array, separator) => { | ||
|
||
return array.join(separator); | ||
}; | ||
|
||
exports.lintJoin = (array) => { | ||
|
||
let str = ''; | ||
|
||
for (let i = 0; i < array.length; ++i) { | ||
if (str) { | ||
str += '
'; // This is a line break | ||
} | ||
|
||
str += Hoek.escapeHtml(array[i]); | ||
} | ||
|
||
return `${str}`; | ||
}; | ||
|
||
exports.errorMessage = (err) => { | ||
|
||
return `${Hoek.escapeHtml('' + err.message)}`; | ||
}; | ||
|
||
exports.errorStack = (err) => { | ||
|
||
const stack = err.stack.slice(err.stack.indexOf('\n') + 1).replace(/^\s*/gm, ' '); | ||
return `${Hoek.escapeHtml(stack)}`; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
'use strict'; | ||
|
||
const { file } = require('./file'); | ||
|
||
exports.cov = (coverage) => { | ||
|
||
return `<div id="coverage"> | ||
<h1>Code Coverage Report</h1> | ||
<div class="stats ${coverage.percentClass}"> | ||
<div class="percentage">${coverage.percent}%</div> | ||
<div class="sloc">${coverage.cov.sloc}</div> | ||
<div class="hits">${coverage.cov.hits}</div> | ||
<div class="misses">${coverage.cov.misses}</div> | ||
</div> | ||
<div id="filters"> | ||
<input type="checkbox" checked="" onchange="filter(this)" value="generated" id="show-generated"> | ||
<label for="show-generated">Show generated files</label> | ||
</div> | ||
<div id="files"> | ||
${coverage.cov.files.map((item, i) => { | ||
return file(item); | ||
})} | ||
</div> | ||
</div>`; | ||
}; |
Oops, something went wrong.