Skip to content

Commit f2c46d7

Browse files
committed
feat: Upgrade to the reporter v2.2.0
* Allow generating page titles from file names without directory
1 parent d74ec1b commit f2c46d7

File tree

7 files changed

+1122
-8
lines changed

7 files changed

+1122
-8
lines changed

Gruntfile.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ module.exports = function (grunt) {
4949
src: 'tests/expected/report.json',
5050
dest: 'tests/actual/'
5151
},
52+
showFileNameOnly: {
53+
options: {
54+
showFileNameOnly: true
55+
},
56+
src: 'tests/expected/report.json',
57+
dest: 'tests/extra/'
58+
},
5259
includeUnreported: {
5360
options: {
5461
includeUnreported: true

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Default options support the most usual usage scenario:
4040
options: {
4141
targetExtension: '.html',
4242
ignoreMissing: false,
43+
showFileNameOnly: false,
4344
force: false
4445
},
4546
all: {
@@ -80,6 +81,12 @@ Default: ".html:
8081

8182
If the `dest` property specified only the target directory, the converted report file will be stored there with the file extension replaced to ".html" or to the extesion specified by this property.
8283

84+
#### showFileNameOnly
85+
Type: `Boolean`
86+
Default value: `false`
87+
88+
Cuts the directory from tested HTML files, when creating page titles from in the report. If you use unique names for files alone, you will not get too long page titles, if you flip this flag tp `true`.
89+
8390
### Task Data
8491

8592
The configuration consists of `src` and `dest` property pairs. The `src`
@@ -191,6 +198,8 @@ your code using Grunt.
191198

192199
## Release History
193200

201+
* 2018-03-05 v2.2.0 Upgrade to the reporter v2.2.0, allow generating
202+
page titles from file names without directory
194203
* 2018-03-04 v2.1.0 Upgrade to the reporter v2.1.0
195204
* 2018-03-01 v2.0.0 Upgrade to the reporter v2.0.0
196205
* 2018-03-01 v1.0.0 Upgrade to the reporter v1.0.0

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
},
3333
"dependencies": {
3434
"chalk": "^2.3.2",
35-
"grunt-html-html-reporter": "^2.1.1"
35+
"grunt-html-html-reporter": "^2.2.0"
3636
},
3737
"devDependencies": {
3838
"grunt": "^1.0.2",

tasks/grunt-html-html-report-converter.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@ module.exports = function (grunt) {
1616
targetExtension: '.html',
1717
ignoreMissing: false,
1818
includeUnreported: false,
19+
showFileNameOnly: false,
1920
force: false
2021
})
2122
const targetExtension = options.targetExtension
2223
const ignoreMissing = options.ignoreMissing
2324
const includeUnreported = options.includeUnreported
25+
const showFileNameOnly = options.showFileNameOnly
2426
const force = options.force
2527
const warn = force ? grunt.log.warn : grunt.fail.warn
2628
var files = this.files
@@ -113,7 +115,10 @@ module.exports = function (grunt) {
113115
chalk.cyan(dest) + '.')
114116
try {
115117
const results = JSON.parse(fs.readFileSync(src, 'utf-8'))
116-
fs.writeFileSync(dest, report(results), 'utf-8')
118+
const generated = report(results, {
119+
showFileNameOnly: showFileNameOnly
120+
})
121+
fs.writeFileSync(dest, generated, 'utf-8')
117122
++converted
118123
} catch (error) {
119124
grunt.verbose.error(error.stack)
File renamed without changes.

0 commit comments

Comments
 (0)