From 48945351c2ae3dfaaf0b610889a4c683d0e04333 Mon Sep 17 00:00:00 2001 From: gkushang Date: Mon, 10 Jul 2017 12:46:30 -0400 Subject: [PATCH 1/7] fix screenshot base64 issue & sanitize the suit.name to new object --- lib/reporter.js | 6 +- package-lock.json | 213 +++++++++++++++--- .../_common/bootstrap.hierarchy/features.tmpl | 8 +- templates/bootstrap/index.tmpl | 2 +- templates/foundation/index.tmpl | 2 +- templates/hierarchy/index.tmpl | 2 +- 6 files changed, 194 insertions(+), 39 deletions(-) diff --git a/lib/reporter.js b/lib/reporter.js index dcd2f03..ec23745 100644 --- a/lib/reporter.js +++ b/lib/reporter.js @@ -47,7 +47,10 @@ var generateReport = function (options) { }; var suite = { - name: sanitize(options.name || packageJson && packageJson.name, /[^a-z|0-9]/g), + name: { + plain: options.name || packageJson && packageJson.name, + sanitized: sanitize(options.name || packageJson && packageJson.name, /[^a-z|0-9]/g) + }, brandTitle: options.brandTitle, version: packageJson && packageJson.version, time: new Date(), @@ -236,7 +239,6 @@ var generateReport = function (options) { name = name + '_' + Math.round(Math.random() * 10000) + '.png'; //randomize the file name var filename = path.join(screenshotsDirectory, name); fs.writeFileSync(filename, embedding.data, 'base64'); - step.image = filename; } } }); diff --git a/package-lock.json b/package-lock.json index cd200a1..3f1c0e9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2,6 +2,7 @@ "name": "cucumber-html-reporter", "version": "2.0.1", "lockfileVersion": 1, + "requires": true, "dependencies": { "any-promise": { "version": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", @@ -21,12 +22,21 @@ "assertion-error-formatter": { "version": "https://registry.npmjs.org/assertion-error-formatter/-/assertion-error-formatter-2.0.0.tgz", "integrity": "sha1-F6JCicyEQIibVDGObRGH6+4tVJQ=", - "dev": true + "dev": true, + "requires": { + "diff": "https://registry.npmjs.org/diff/-/diff-3.2.0.tgz", + "pad-right": "https://registry.npmjs.org/pad-right/-/pad-right-0.2.2.tgz", + "repeat-string": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz" + } }, "babel-runtime": { "version": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.23.0.tgz", "integrity": "sha1-CpSJ8UTecO+zzkMArM2zKeL8VDs=", - "dev": true + "dev": true, + "requires": { + "core-js": "https://registry.npmjs.org/core-js/-/core-js-2.4.1.tgz", + "regenerator-runtime": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz" + } }, "balanced-match": { "version": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", @@ -41,17 +51,29 @@ "brace-expansion": { "version": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", - "dev": true + "dev": true, + "requires": { + "balanced-match": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "concat-map": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz" + } }, "chai": { "version": "https://registry.npmjs.org/chai/-/chai-3.5.0.tgz", "integrity": "sha1-TQJjewZ/6Vi9v906QOxW/vc3Mkc=", - "dev": true + "dev": true, + "requires": { + "assertion-error": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.0.2.tgz", + "deep-eql": "https://registry.npmjs.org/deep-eql/-/deep-eql-0.1.3.tgz", + "type-detect": "https://registry.npmjs.org/type-detect/-/type-detect-1.0.0.tgz" + } }, "cli-table": { "version": "https://registry.npmjs.org/cli-table/-/cli-table-0.3.1.tgz", "integrity": "sha1-9TsFJmqLGguTSz0IIebi3FkUriM=", "dev": true, + "requires": { + "colors": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz" + }, "dependencies": { "colors": { "version": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", @@ -68,7 +90,10 @@ "commander": { "version": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", - "dev": true + "dev": true, + "requires": { + "graceful-readlink": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz" + } }, "concat-map": { "version": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -88,7 +113,34 @@ "cucumber": { "version": "https://registry.npmjs.org/cucumber/-/cucumber-2.3.1.tgz", "integrity": "sha1-N5GlH/0MYUYq1X/bjtER1VtRzeM=", - "dev": true + "dev": true, + "requires": { + "assertion-error-formatter": "https://registry.npmjs.org/assertion-error-formatter/-/assertion-error-formatter-2.0.0.tgz", + "babel-runtime": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.23.0.tgz", + "bluebird": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.0.tgz", + "cli-table": "https://registry.npmjs.org/cli-table/-/cli-table-0.3.1.tgz", + "colors": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", + "commander": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", + "cucumber-expressions": "https://registry.npmjs.org/cucumber-expressions/-/cucumber-expressions-3.0.0.tgz", + "cucumber-tag-expressions": "https://registry.npmjs.org/cucumber-tag-expressions/-/cucumber-tag-expressions-1.0.1.tgz", + "duration": "https://registry.npmjs.org/duration/-/duration-0.2.0.tgz", + "figures": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", + "gherkin": "https://registry.npmjs.org/gherkin/-/gherkin-4.1.3.tgz", + "glob": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "indent-string": "https://registry.npmjs.org/indent-string/-/indent-string-3.1.0.tgz", + "is-generator": "https://registry.npmjs.org/is-generator/-/is-generator-1.0.3.tgz", + "is-stream": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "lodash": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", + "mz": "https://registry.npmjs.org/mz/-/mz-2.6.0.tgz", + "progress": "https://registry.npmjs.org/progress/-/progress-2.0.0.tgz", + "resolve": "https://registry.npmjs.org/resolve/-/resolve-1.3.3.tgz", + "stack-chain": "https://registry.npmjs.org/stack-chain/-/stack-chain-1.3.7.tgz", + "stacktrace-js": "https://registry.npmjs.org/stacktrace-js/-/stacktrace-js-2.0.0.tgz", + "string-argv": "https://registry.npmjs.org/string-argv/-/string-argv-0.0.2.tgz", + "upper-case-first": "https://registry.npmjs.org/upper-case-first/-/upper-case-first-1.1.2.tgz", + "util-arity": "https://registry.npmjs.org/util-arity/-/util-arity-1.1.0.tgz", + "verror": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz" + } }, "cucumber-expressions": { "version": "https://registry.npmjs.org/cucumber-expressions/-/cucumber-expressions-3.0.0.tgz", @@ -103,12 +155,18 @@ "d": { "version": "https://registry.npmjs.org/d/-/d-0.1.1.tgz", "integrity": "sha1-2hhMU10Y2O57oqoim5FACfrhEwk=", - "dev": true + "dev": true, + "requires": { + "es5-ext": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.22.tgz" + } }, "deep-eql": { "version": "https://registry.npmjs.org/deep-eql/-/deep-eql-0.1.3.tgz", "integrity": "sha1-71WKyrjeJSBs1xOQbXTlaTDrafI=", "dev": true, + "requires": { + "type-detect": "https://registry.npmjs.org/type-detect/-/type-detect-0.1.1.tgz" + }, "dependencies": { "type-detect": { "version": "https://registry.npmjs.org/type-detect/-/type-detect-0.1.1.tgz", @@ -125,27 +183,46 @@ "duration": { "version": "https://registry.npmjs.org/duration/-/duration-0.2.0.tgz", "integrity": "sha1-X5xN+q//ZV3phhEu/iXFl43YUUY=", - "dev": true + "dev": true, + "requires": { + "d": "https://registry.npmjs.org/d/-/d-0.1.1.tgz", + "es5-ext": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.22.tgz" + } }, "error-stack-parser": { "version": "https://registry.npmjs.org/error-stack-parser/-/error-stack-parser-2.0.1.tgz", "integrity": "sha1-oyArj7AxFKqbQKDjZp5IsrZaAQo=", - "dev": true + "dev": true, + "requires": { + "stackframe": "https://registry.npmjs.org/stackframe/-/stackframe-1.0.3.tgz" + } }, "es5-ext": { "version": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.22.tgz", "integrity": "sha1-GHbFH5kHacESx4HqPr6J+E/TkHE=", - "dev": true + "dev": true, + "requires": { + "es6-iterator": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.1.tgz", + "es6-symbol": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.1.tgz" + } }, "es6-iterator": { "version": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.1.tgz", "integrity": "sha1-jjGcnwRTv1ddN0lAplWSDlnKVRI=", "dev": true, + "requires": { + "d": "https://registry.npmjs.org/d/-/d-1.0.0.tgz", + "es5-ext": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.22.tgz", + "es6-symbol": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.1.tgz" + }, "dependencies": { "d": { "version": "https://registry.npmjs.org/d/-/d-1.0.0.tgz", "integrity": "sha1-dUu1v+VUUdpppYuU1F9MWwRi1Y8=", - "dev": true + "dev": true, + "requires": { + "es5-ext": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.22.tgz" + } } } }, @@ -153,11 +230,18 @@ "version": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.1.tgz", "integrity": "sha1-vwDvT9q2uhtG7Le2KbTH7VcVzHc=", "dev": true, + "requires": { + "d": "https://registry.npmjs.org/d/-/d-1.0.0.tgz", + "es5-ext": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.22.tgz" + }, "dependencies": { "d": { "version": "https://registry.npmjs.org/d/-/d-1.0.0.tgz", "integrity": "sha1-dUu1v+VUUdpppYuU1F9MWwRi1Y8=", - "dev": true + "dev": true, + "requires": { + "es5-ext": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.22.tgz" + } } } }, @@ -174,15 +258,26 @@ "figures": { "version": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", - "dev": true + "dev": true, + "requires": { + "escape-string-regexp": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz" + } }, "find": { "version": "https://registry.npmjs.org/find/-/find-0.2.7.tgz", - "integrity": "sha1-evvQD48IxbYi+Xzab3FBc9VHuz8=" + "integrity": "sha1-evvQD48IxbYi+Xzab3FBc9VHuz8=", + "requires": { + "traverse-chain": "https://registry.npmjs.org/traverse-chain/-/traverse-chain-0.1.0.tgz" + } }, "fs-extra": { "version": "https://registry.npmjs.org/fs-extra/-/fs-extra-3.0.1.tgz", - "integrity": "sha1-N5TzeMWLNC6n27sjCVEJxLO2IpE=" + "integrity": "sha1-N5TzeMWLNC6n27sjCVEJxLO2IpE=", + "requires": { + "graceful-fs": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "jsonfile": "https://registry.npmjs.org/jsonfile/-/jsonfile-3.0.0.tgz", + "universalify": "https://registry.npmjs.org/universalify/-/universalify-0.1.0.tgz" + } }, "fs.realpath": { "version": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -197,7 +292,15 @@ "glob": { "version": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", "integrity": "sha1-wZyd+aAocC1nhhI4SmVSQExjbRU=", - "dev": true + "dev": true, + "requires": { + "fs.realpath": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "inflight": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "inherits": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "minimatch": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "once": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "path-is-absolute": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz" + } }, "graceful-fs": { "version": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", @@ -216,7 +319,11 @@ "inflight": { "version": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true + "dev": true, + "requires": { + "once": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "wrappy": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz" + } }, "inherits": { "version": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", @@ -239,7 +346,10 @@ }, "jsonfile": { "version": "https://registry.npmjs.org/jsonfile/-/jsonfile-3.0.0.tgz", - "integrity": "sha1-kufHRE5f/V+jLmqa6LhQNN+DR9A=" + "integrity": "sha1-kufHRE5f/V+jLmqa6LhQNN+DR9A=", + "requires": { + "graceful-fs": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz" + } }, "lodash": { "version": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", @@ -248,12 +358,20 @@ "minimatch": { "version": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=", - "dev": true + "dev": true, + "requires": { + "brace-expansion": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz" + } }, "mz": { "version": "https://registry.npmjs.org/mz/-/mz-2.6.0.tgz", "integrity": "sha1-yLhSHZWN8KTydoAl22nHGe5O8c4=", - "dev": true + "dev": true, + "requires": { + "any-promise": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", + "object-assign": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "thenify-all": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz" + } }, "object-assign": { "version": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -263,7 +381,10 @@ "once": { "version": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true + "dev": true, + "requires": { + "wrappy": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz" + } }, "open": { "version": "https://registry.npmjs.org/open/-/open-0.0.5.tgz", @@ -272,7 +393,10 @@ "pad-right": { "version": "https://registry.npmjs.org/pad-right/-/pad-right-0.2.2.tgz", "integrity": "sha1-b7ySQEXSRPKiokRQMGDTv8YAl3Q=", - "dev": true + "dev": true, + "requires": { + "repeat-string": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz" + } }, "path-is-absolute": { "version": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", @@ -302,7 +426,10 @@ "resolve": { "version": "https://registry.npmjs.org/resolve/-/resolve-1.3.3.tgz", "integrity": "sha1-ZVkHw0aahoDcLeOidaj91paR8OU=", - "dev": true + "dev": true, + "requires": { + "path-parse": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz" + } }, "source-map": { "version": "https://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz", @@ -317,7 +444,10 @@ "stack-generator": { "version": "https://registry.npmjs.org/stack-generator/-/stack-generator-2.0.1.tgz", "integrity": "sha1-s32LDZoqblLAbMjhhfmPGZ+2OAQ=", - "dev": true + "dev": true, + "requires": { + "stackframe": "https://registry.npmjs.org/stackframe/-/stackframe-1.0.3.tgz" + } }, "stackframe": { "version": "https://registry.npmjs.org/stackframe/-/stackframe-1.0.3.tgz", @@ -327,12 +457,21 @@ "stacktrace-gps": { "version": "https://registry.npmjs.org/stacktrace-gps/-/stacktrace-gps-3.0.1.tgz", "integrity": "sha1-Hm9Jl4QdK1vaurnmEX6WXrvmQoY=", - "dev": true + "dev": true, + "requires": { + "source-map": "https://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz", + "stackframe": "https://registry.npmjs.org/stackframe/-/stackframe-1.0.3.tgz" + } }, "stacktrace-js": { "version": "https://registry.npmjs.org/stacktrace-js/-/stacktrace-js-2.0.0.tgz", "integrity": "sha1-d2ymRqlbxsayuQd2U2p/xyxt21g=", - "dev": true + "dev": true, + "requires": { + "error-stack-parser": "https://registry.npmjs.org/error-stack-parser/-/error-stack-parser-2.0.1.tgz", + "stack-generator": "https://registry.npmjs.org/stack-generator/-/stack-generator-2.0.1.tgz", + "stacktrace-gps": "https://registry.npmjs.org/stacktrace-gps/-/stacktrace-gps-3.0.1.tgz" + } }, "string-argv": { "version": "https://registry.npmjs.org/string-argv/-/string-argv-0.0.2.tgz", @@ -342,12 +481,18 @@ "thenify": { "version": "https://registry.npmjs.org/thenify/-/thenify-3.3.0.tgz", "integrity": "sha1-5p44obq+lpsBCCB5eLn2K4hgSDk=", - "dev": true + "dev": true, + "requires": { + "any-promise": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz" + } }, "thenify-all": { "version": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz", "integrity": "sha1-GhkY1ALY/D+Y+/I02wvMjMEOlyY=", - "dev": true + "dev": true, + "requires": { + "thenify": "https://registry.npmjs.org/thenify/-/thenify-3.3.0.tgz" + } }, "traverse-chain": { "version": "https://registry.npmjs.org/traverse-chain/-/traverse-chain-0.1.0.tgz", @@ -370,7 +515,10 @@ "upper-case-first": { "version": "https://registry.npmjs.org/upper-case-first/-/upper-case-first-1.1.2.tgz", "integrity": "sha1-XXm+3P8UQZUY/S7bCgUHybaFkRU=", - "dev": true + "dev": true, + "requires": { + "upper-case": "https://registry.npmjs.org/upper-case/-/upper-case-1.1.3.tgz" + } }, "util-arity": { "version": "https://registry.npmjs.org/util-arity/-/util-arity-1.1.0.tgz", @@ -380,7 +528,12 @@ "verror": { "version": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", - "dev": true + "dev": true, + "requires": { + "assert-plus": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "core-util-is": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "extsprintf": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz" + } }, "wrappy": { "version": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", diff --git a/templates/_common/bootstrap.hierarchy/features.tmpl b/templates/_common/bootstrap.hierarchy/features.tmpl index 6d10a39..0032905 100644 --- a/templates/_common/bootstrap.hierarchy/features.tmpl +++ b/templates/_common/bootstrap.hierarchy/features.tmpl @@ -7,7 +7,7 @@

<% if (feature.tags) { %>
<% _.each(feature.tags, function(tag, featureIndex) { %> <%= tag.name %> <% }); %>
<% } %> - + <%= feature.keyword %>:<%= feature.name %> @@ -22,7 +22,7 @@

-
+
<% if (feature.description) { %>
<%= feature.description.replace(/\n/g, '
') %>
<% } %> <% _.each(feature.elements, function(element, scenarioIndex) { %> @@ -31,7 +31,7 @@

<% var scenarioTagsOnly = feature.tags ? _.drop(element.tags, feature.tags.length) : element.tags %> <% if (element.tags) { %>
<% _.each(scenarioTagsOnly, function(tag) { %> <%= tag.name %> <% }); %>
<% } %> - +

-
+
<% if (element.description) { %>
<%= element.description.trim().replace(/\n/g, '
') %>
<% } %> <% _.each(element.steps, function(step, stepIndex) { %> diff --git a/templates/bootstrap/index.tmpl b/templates/bootstrap/index.tmpl index e36d20d..0afbb4d 100644 --- a/templates/bootstrap/index.tmpl +++ b/templates/bootstrap/index.tmpl @@ -15,7 +15,7 @@