@serenity-js/serenity-bdd 3.1.3 → 3.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/lib/stage/crew/serenity-bdd-reporter/processors/mappers/escapeHtml.d.ts +6 -0
- package/lib/stage/crew/serenity-bdd-reporter/processors/mappers/escapeHtml.d.ts.map +1 -0
- package/lib/stage/crew/serenity-bdd-reporter/processors/mappers/escapeHtml.js +19 -0
- package/lib/stage/crew/serenity-bdd-reporter/processors/mappers/escapeHtml.js.map +1 -0
- package/lib/stage/crew/serenity-bdd-reporter/processors/mappers/index.d.ts +1 -0
- package/lib/stage/crew/serenity-bdd-reporter/processors/mappers/index.d.ts.map +1 -1
- package/lib/stage/crew/serenity-bdd-reporter/processors/mappers/index.js +1 -0
- package/lib/stage/crew/serenity-bdd-reporter/processors/mappers/index.js.map +1 -1
- package/lib/stage/crew/serenity-bdd-reporter/processors/transformations/scenarioDetailsOf.js +3 -4
- package/lib/stage/crew/serenity-bdd-reporter/processors/transformations/scenarioDetailsOf.js.map +1 -1
- package/package.json +5 -5
- package/src/stage/crew/serenity-bdd-reporter/processors/mappers/escapeHtml.ts +15 -0
- package/src/stage/crew/serenity-bdd-reporter/processors/mappers/index.ts +1 -0
- package/src/stage/crew/serenity-bdd-reporter/processors/transformations/scenarioDetailsOf.ts +4 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [3.1.5](https://github.com/serenity-js/serenity-js/compare/v3.1.4...v3.1.5) (2023-04-18)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @serenity-js/serenity-bdd
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [3.1.4](https://github.com/serenity-js/serenity-js/compare/v3.1.3...v3.1.4) (2023-04-16)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* **serenity-bdd:** escape HTML tags in scenaio name and title ([c5ca1bf](https://github.com/serenity-js/serenity-js/commit/c5ca1bfcfcc297d913208246addf84d400608245)), closes [#1630](https://github.com/serenity-js/serenity-js/issues/1630)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [3.1.3](https://github.com/serenity-js/serenity-js/compare/v3.1.2...v3.1.3) (2023-04-14)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package @serenity-js/serenity-bdd
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"escapeHtml.d.ts","sourceRoot":"","sources":["../../../../../../src/stage/crew/serenity-bdd-reporter/processors/mappers/escapeHtml.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAU/C"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.escapeHtml = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @package
|
|
6
|
+
* @param text
|
|
7
|
+
*/
|
|
8
|
+
function escapeHtml(text) {
|
|
9
|
+
const replacements = {
|
|
10
|
+
'&': '&',
|
|
11
|
+
'"': '"',
|
|
12
|
+
'\'': ''',
|
|
13
|
+
'<': '<',
|
|
14
|
+
'>': '>'
|
|
15
|
+
};
|
|
16
|
+
return text.replace(/["&'<>]/g, character => replacements[character]);
|
|
17
|
+
}
|
|
18
|
+
exports.escapeHtml = escapeHtml;
|
|
19
|
+
//# sourceMappingURL=escapeHtml.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"escapeHtml.js","sourceRoot":"","sources":["../../../../../../src/stage/crew/serenity-bdd-reporter/processors/mappers/escapeHtml.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,SAAgB,UAAU,CAAC,IAAY;IACnC,MAAM,YAAY,GAAG;QACjB,GAAG,EAAE,OAAO;QACZ,GAAG,EAAE,QAAQ;QACb,IAAI,EAAE,QAAQ;QACd,GAAG,EAAE,MAAM;QACX,GAAG,EAAE,MAAM;KACd,CAAC;IAEF,OAAO,IAAI,CAAC,OAAO,CAAE,UAAU,EAAE,SAAS,CAAC,EAAE,CAAC,YAAY,CAAC,SAAS,CAAC,CAAE,CAAC;AAC5E,CAAC;AAVD,gCAUC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/stage/crew/serenity-bdd-reporter/processors/mappers/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/stage/crew/serenity-bdd-reporter/processors/mappers/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC"}
|
|
@@ -16,5 +16,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./dashify"), exports);
|
|
18
18
|
__exportStar(require("./errorReportFrom"), exports);
|
|
19
|
+
__exportStar(require("./escapeHtml"), exports);
|
|
19
20
|
__exportStar(require("./outcomeReportFrom"), exports);
|
|
20
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/stage/crew/serenity-bdd-reporter/processors/mappers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,oDAAkC;AAClC,sDAAoC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/stage/crew/serenity-bdd-reporter/processors/mappers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,oDAAkC;AAClC,+CAA6B;AAC7B,sDAAoC"}
|
package/lib/stage/crew/serenity-bdd-reporter/processors/transformations/scenarioDetailsOf.js
CHANGED
|
@@ -10,13 +10,13 @@ function scenarioDetailsOf(details) {
|
|
|
10
10
|
return (context) => {
|
|
11
11
|
const name = (0, tiny_types_1.ensure)('scenario name', details.name.value, (0, tiny_types_1.isNotBlank)());
|
|
12
12
|
const category = (0, tiny_types_1.ensure)('scenario category', details.category.value, (0, tiny_types_1.isNotBlank)());
|
|
13
|
-
context.report.name = name;
|
|
14
|
-
context.report.title = name;
|
|
13
|
+
context.report.name = (0, mappers_1.escapeHtml)(name);
|
|
14
|
+
context.report.title = (0, mappers_1.escapeHtml)(name);
|
|
15
15
|
context.report.manual = false;
|
|
16
16
|
context.report.testSteps = [];
|
|
17
17
|
context.report.userStory = {
|
|
18
18
|
id: (0, mappers_1.dashify)(category),
|
|
19
|
-
storyName: category,
|
|
19
|
+
storyName: (0, mappers_1.escapeHtml)(category),
|
|
20
20
|
path: isFeatureFile(details.location.path)
|
|
21
21
|
? details.location.path.value
|
|
22
22
|
: '',
|
|
@@ -29,7 +29,6 @@ exports.scenarioDetailsOf = scenarioDetailsOf;
|
|
|
29
29
|
/**
|
|
30
30
|
* @package
|
|
31
31
|
* @param {Path} path
|
|
32
|
-
* @returns {boolean}
|
|
33
32
|
*/
|
|
34
33
|
function isFeatureFile(path) {
|
|
35
34
|
return path && path.value.endsWith('.feature');
|
package/lib/stage/crew/serenity-bdd-reporter/processors/transformations/scenarioDetailsOf.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scenarioDetailsOf.js","sourceRoot":"","sources":["../../../../../../src/stage/crew/serenity-bdd-reporter/processors/transformations/scenarioDetailsOf.ts"],"names":[],"mappings":";;;AAEA,2CAAgD;AAEhD,
|
|
1
|
+
{"version":3,"file":"scenarioDetailsOf.js","sourceRoot":"","sources":["../../../../../../src/stage/crew/serenity-bdd-reporter/processors/transformations/scenarioDetailsOf.ts"],"names":[],"mappings":";;;AAEA,2CAAgD;AAEhD,wCAAiD;AAGjD;;GAEG;AACH,SAAgB,iBAAiB,CAA2C,OAAwB;IAChG,OAAO,CAAC,OAAgB,EAAW,EAAE;QACjC,MAAM,IAAI,GAAQ,IAAA,mBAAM,EAAC,eAAe,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,IAAA,uBAAU,GAAE,CAAC,CAAC;QAC5E,MAAM,QAAQ,GAAI,IAAA,mBAAM,EAAC,mBAAmB,EAAE,OAAO,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAA,uBAAU,GAAE,CAAC,CAAC;QAEpF,OAAO,CAAC,MAAM,CAAC,IAAI,GAAG,IAAA,oBAAU,EAAC,IAAI,CAAC,CAAC;QACvC,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,IAAA,oBAAU,EAAC,IAAI,CAAC,CAAC;QACxC,OAAO,CAAC,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC;QAC9B,OAAO,CAAC,MAAM,CAAC,SAAS,GAAG,EAAE,CAAC;QAC9B,OAAO,CAAC,MAAM,CAAC,SAAS,GAAG;YACvB,EAAE,EAAE,IAAA,iBAAO,EAAC,QAAQ,CAAC;YACrB,SAAS,EAAE,IAAA,oBAAU,EAAC,QAAQ,CAAC;YAC/B,IAAI,EAAE,aAAa,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;gBACtC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK;gBAC7B,CAAC,CAAC,EAAE;YACR,IAAI,EAAE,SAAS;SAClB,CAAC;QAEF,OAAO,OAAO,CAAC;IACnB,CAAC,CAAA;AACL,CAAC;AApBD,8CAoBC;AAED;;;GAGG;AACH,SAAS,aAAa,CAAC,IAAU;IAC7B,OAAO,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;AACnD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serenity-js/serenity-bdd",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.5",
|
|
4
4
|
"description": "Serenity BDD reporter for Serenity/JS",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Jan Molak",
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
"npm": "^6 || ^7 || ^8 || ^9"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@serenity-js/assertions": "3.1.
|
|
49
|
-
"@serenity-js/core": "3.1.
|
|
50
|
-
"@serenity-js/rest": "3.1.
|
|
48
|
+
"@serenity-js/assertions": "3.1.5",
|
|
49
|
+
"@serenity-js/core": "3.1.5",
|
|
50
|
+
"@serenity-js/rest": "3.1.5",
|
|
51
51
|
"ansi-regex": "^5.0.1",
|
|
52
52
|
"axios": "^1.3.5",
|
|
53
53
|
"chalk": "^4.1.2",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"ts-node": "^10.9.1",
|
|
72
72
|
"typescript": "^4.9.5"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "31f621a7c827e20ba07a86a2f7c77d941784bb0a"
|
|
75
75
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @package
|
|
3
|
+
* @param text
|
|
4
|
+
*/
|
|
5
|
+
export function escapeHtml(text: string): string {
|
|
6
|
+
const replacements = {
|
|
7
|
+
'&': '&',
|
|
8
|
+
'"': '"',
|
|
9
|
+
'\'': ''',
|
|
10
|
+
'<': '<',
|
|
11
|
+
'>': '>'
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
return text.replace( /["&'<>]/g, character => replacements[character] );
|
|
15
|
+
}
|
package/src/stage/crew/serenity-bdd-reporter/processors/transformations/scenarioDetailsOf.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Path } from '@serenity-js/core/lib/io';
|
|
|
2
2
|
import { ScenarioDetails } from '@serenity-js/core/lib/model';
|
|
3
3
|
import { ensure, isNotBlank } from 'tiny-types';
|
|
4
4
|
|
|
5
|
-
import { dashify } from '../mappers';
|
|
5
|
+
import { dashify, escapeHtml } from '../mappers';
|
|
6
6
|
import { SerenityBDDReportContext } from '../SerenityBDDReportContext';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -13,13 +13,13 @@ export function scenarioDetailsOf<Context extends SerenityBDDReportContext>(deta
|
|
|
13
13
|
const name = ensure('scenario name', details.name.value, isNotBlank());
|
|
14
14
|
const category = ensure('scenario category', details.category.value, isNotBlank());
|
|
15
15
|
|
|
16
|
-
context.report.name = name;
|
|
17
|
-
context.report.title = name;
|
|
16
|
+
context.report.name = escapeHtml(name);
|
|
17
|
+
context.report.title = escapeHtml(name);
|
|
18
18
|
context.report.manual = false;
|
|
19
19
|
context.report.testSteps = [];
|
|
20
20
|
context.report.userStory = {
|
|
21
21
|
id: dashify(category),
|
|
22
|
-
storyName: category,
|
|
22
|
+
storyName: escapeHtml(category),
|
|
23
23
|
path: isFeatureFile(details.location.path)
|
|
24
24
|
? details.location.path.value
|
|
25
25
|
: '',
|
|
@@ -33,7 +33,6 @@ export function scenarioDetailsOf<Context extends SerenityBDDReportContext>(deta
|
|
|
33
33
|
/**
|
|
34
34
|
* @package
|
|
35
35
|
* @param {Path} path
|
|
36
|
-
* @returns {boolean}
|
|
37
36
|
*/
|
|
38
37
|
function isFeatureFile(path: Path): boolean {
|
|
39
38
|
return path && path.value.endsWith('.feature');
|