html-reporter 9.17.2 → 9.18.0

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.
Files changed (70) hide show
  1. package/build/hermione.d.ts +2 -4
  2. package/build/hermione.js +2 -103
  3. package/build/hermione.js.map +1 -1
  4. package/build/lib/cli-commands/gui.d.ts +1 -1
  5. package/build/lib/cli-commands/gui.js +4 -4
  6. package/build/lib/cli-commands/gui.js.map +1 -1
  7. package/build/lib/cli-commands/merge-reports.d.ts +1 -1
  8. package/build/lib/cli-commands/merge-reports.js +2 -2
  9. package/build/lib/cli-commands/merge-reports.js.map +1 -1
  10. package/build/lib/cli-commands/remove-unused-screens/index.d.ts +1 -1
  11. package/build/lib/cli-commands/remove-unused-screens/index.js +18 -17
  12. package/build/lib/cli-commands/remove-unused-screens/index.js.map +1 -1
  13. package/build/lib/cli-commands/remove-unused-screens/utils.d.ts +3 -3
  14. package/build/lib/cli-commands/remove-unused-screens/utils.js +5 -5
  15. package/build/lib/cli-commands/remove-unused-screens/utils.js.map +1 -1
  16. package/build/lib/common-utils.js +1 -9
  17. package/build/lib/common-utils.js.map +1 -1
  18. package/build/lib/constants/tests.d.ts +1 -1
  19. package/build/lib/constants/tests.js +2 -2
  20. package/build/lib/constants/tests.js.map +1 -1
  21. package/build/lib/constants/tool-names.d.ts +1 -1
  22. package/build/lib/constants/tool-names.js +1 -1
  23. package/build/lib/constants/tool-names.js.map +1 -1
  24. package/build/lib/gui/api/index.d.ts +4 -4
  25. package/build/lib/gui/api/index.js +4 -4
  26. package/build/lib/gui/api/index.js.map +1 -1
  27. package/build/lib/gui/app.d.ts +3 -3
  28. package/build/lib/gui/app.js +2 -2
  29. package/build/lib/gui/app.js.map +1 -1
  30. package/build/lib/gui/index.d.ts +2 -2
  31. package/build/lib/gui/server.d.ts +1 -1
  32. package/build/lib/gui/server.js +6 -6
  33. package/build/lib/gui/server.js.map +1 -1
  34. package/build/lib/gui/tool-runner/index.d.ts +9 -9
  35. package/build/lib/gui/tool-runner/index.js +23 -23
  36. package/build/lib/gui/tool-runner/index.js.map +1 -1
  37. package/build/lib/gui/tool-runner/report-subscriber.d.ts +2 -2
  38. package/build/lib/gui/tool-runner/report-subscriber.js +12 -12
  39. package/build/lib/gui/tool-runner/report-subscriber.js.map +1 -1
  40. package/build/lib/merge-reports/index.d.ts +1 -1
  41. package/build/lib/merge-reports/index.js +3 -3
  42. package/build/lib/merge-reports/index.js.map +1 -1
  43. package/build/lib/plugin-api.js +1 -1
  44. package/build/lib/plugin-api.js.map +1 -1
  45. package/build/lib/plugin-utils.d.ts +2 -2
  46. package/build/lib/plugin-utils.js.map +1 -1
  47. package/build/lib/report-builder/gui.js +2 -2
  48. package/build/lib/report-builder/gui.js.map +1 -1
  49. package/build/lib/server-utils.d.ts +6 -5
  50. package/build/lib/server-utils.js +6 -6
  51. package/build/lib/server-utils.js.map +1 -1
  52. package/build/lib/static/gui.min.js +1 -1
  53. package/build/lib/static/report.min.js +1 -1
  54. package/build/lib/test-adapter/hermione.d.ts +1 -43
  55. package/build/lib/test-adapter/hermione.js +4 -175
  56. package/build/lib/test-adapter/hermione.js.map +1 -1
  57. package/build/lib/test-adapter/testplane.d.ts +44 -0
  58. package/build/lib/test-adapter/testplane.js +178 -0
  59. package/build/lib/test-adapter/testplane.js.map +1 -0
  60. package/build/lib/tests-tree-builder/base.js +1 -4
  61. package/build/lib/tests-tree-builder/base.js.map +1 -1
  62. package/build/lib/types.d.ts +15 -5
  63. package/build/package.json +4 -3
  64. package/build/testplane.d.ts +4 -0
  65. package/build/testplane.js +109 -0
  66. package/build/testplane.js.map +1 -0
  67. package/package.json +4 -3
  68. package/build/gemini.d.ts +0 -2
  69. package/build/gemini.js +0 -5
  70. package/build/gemini.js.map +0 -1
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const os_1 = __importDefault(require("os"));
7
+ const path_1 = __importDefault(require("path"));
8
+ const lodash_1 = __importDefault(require("lodash"));
9
+ const p_queue_1 = __importDefault(require("p-queue"));
10
+ const cli_commands_1 = require("./lib/cli-commands");
11
+ const config_1 = require("./lib/config");
12
+ const constants_1 = require("./lib/constants");
13
+ const plugin_api_1 = require("./lib/plugin-api");
14
+ const static_1 = require("./lib/report-builder/static");
15
+ const server_utils_1 = require("./lib/server-utils");
16
+ const sqlite_client_1 = require("./lib/sqlite-client");
17
+ const create_workers_1 = require("./lib/workers/create-workers");
18
+ const image_store_1 = require("./lib/image-store");
19
+ const cache_1 = require("./lib/cache");
20
+ const images_info_saver_1 = require("./lib/images-info-saver");
21
+ const testplane_1 = require("./lib/test-adapter/testplane");
22
+ exports.default = (testplane, opts) => {
23
+ if (testplane.isWorker()) {
24
+ return;
25
+ }
26
+ const config = (0, config_1.parseConfig)(opts);
27
+ if (!config.enabled) {
28
+ return;
29
+ }
30
+ const htmlReporter = plugin_api_1.HtmlReporter.create(config, { toolName: constants_1.ToolName.Testplane });
31
+ testplane.htmlReporter = htmlReporter;
32
+ let isCliCommandLaunched = false;
33
+ let handlingTestResults;
34
+ let staticReportBuilder;
35
+ const withMiddleware = (fn) => {
36
+ return (...args) => {
37
+ // If any CLI command was launched, e.g. merge-reports, we need to interrupt regular flow
38
+ if (isCliCommandLaunched) {
39
+ return;
40
+ }
41
+ return fn.call(undefined, ...args);
42
+ };
43
+ };
44
+ testplane.on(testplane.events.CLI, (commander) => {
45
+ lodash_1.default.values(cli_commands_1.cliCommands).forEach((command) => {
46
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
47
+ require(path_1.default.resolve(__dirname, 'lib/cli-commands', command))(commander, config, testplane);
48
+ commander.prependListener(`command:${command}`, () => {
49
+ isCliCommandLaunched = true;
50
+ });
51
+ });
52
+ });
53
+ testplane.on(testplane.events.INIT, withMiddleware(async () => {
54
+ const dbClient = await sqlite_client_1.SqliteClient.create({ htmlReporter, reportPath: config.path });
55
+ const imageStore = new image_store_1.SqliteImageStore(dbClient);
56
+ const expectedPathsCache = new cache_1.Cache(server_utils_1.getExpectedCacheKey);
57
+ const imagesInfoSaver = new images_info_saver_1.ImagesInfoSaver({
58
+ imageFileSaver: htmlReporter.imagesSaver,
59
+ expectedPathsCache,
60
+ imageStore,
61
+ reportPath: htmlReporter.config.path
62
+ });
63
+ staticReportBuilder = static_1.StaticReportBuilder.create(htmlReporter, config, { dbClient, imagesInfoSaver });
64
+ handlingTestResults = Promise.all([
65
+ staticReportBuilder.saveStaticFiles(),
66
+ handleTestResults(testplane, staticReportBuilder)
67
+ ]).then(async () => {
68
+ await staticReportBuilder.finalize();
69
+ }).then(async () => {
70
+ await htmlReporter.emitAsync(htmlReporter.events.REPORT_SAVED, { reportPath: config.path });
71
+ });
72
+ htmlReporter.emit(htmlReporter.events.DATABASE_CREATED, dbClient.getRawConnection());
73
+ }));
74
+ testplane.on(testplane.events.RUNNER_START, withMiddleware((runner) => {
75
+ staticReportBuilder.registerWorkers((0, create_workers_1.createWorkers)(runner));
76
+ }));
77
+ testplane.on(testplane.events.RUNNER_END, withMiddleware(async () => {
78
+ try {
79
+ await handlingTestResults;
80
+ (0, server_utils_1.logPathToHtmlReport)(config);
81
+ }
82
+ catch (e) {
83
+ (0, server_utils_1.logError)(e);
84
+ }
85
+ }));
86
+ };
87
+ async function handleTestResults(testplane, reportBuilder) {
88
+ return new Promise((resolve, reject) => {
89
+ const queue = new p_queue_1.default({ concurrency: os_1.default.cpus().length });
90
+ const promises = [];
91
+ [
92
+ { eventName: testplane.events.TEST_PASS },
93
+ { eventName: testplane.events.RETRY },
94
+ { eventName: testplane.events.TEST_FAIL },
95
+ { eventName: testplane.events.TEST_PENDING }
96
+ ].forEach(({ eventName }) => {
97
+ testplane.on(eventName, (testResult) => {
98
+ promises.push(queue.add(async () => {
99
+ const formattedResult = (0, server_utils_1.formatTestResult)(testResult, (0, testplane_1.getStatus)(eventName, testplane.events, testResult));
100
+ await reportBuilder.addTestResult(formattedResult);
101
+ }).catch(reject));
102
+ });
103
+ });
104
+ testplane.on(testplane.events.RUNNER_END, () => {
105
+ return Promise.all(promises).then(() => resolve(), reject);
106
+ });
107
+ });
108
+ }
109
+ //# sourceMappingURL=testplane.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testplane.js","sourceRoot":"","sources":["../testplane.ts"],"names":[],"mappings":";;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAGxB,oDAAuB;AACvB,sDAA6B;AAG7B,qDAA+C;AAC/C,yCAAyC;AACzC,+CAAyC;AACzC,iDAA8C;AAC9C,wDAAgE;AAChE,qDAAwG;AACxG,uDAAiD;AAEjD,iEAAgF;AAChF,mDAAmD;AACnD,uCAAkC;AAClC,+DAAwD;AACxD,4DAAuD;AAEvD,kBAAe,CAAC,SAAoB,EAAE,IAA8B,EAAQ,EAAE;IAC1E,IAAI,SAAS,CAAC,QAAQ,EAAE,EAAE;QACtB,OAAO;KACV;IAED,MAAM,MAAM,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAEjC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;QACjB,OAAO;KACV;IAED,MAAM,YAAY,GAAG,yBAAY,CAAC,MAAM,CAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,oBAAQ,CAAC,SAAS,EAAC,CAAC,CAAC;IAEhF,SAAyC,CAAC,YAAY,GAAG,YAAY,CAAC;IAEvE,IAAI,oBAAoB,GAAG,KAAK,CAAC;IACjC,IAAI,mBAAkC,CAAC;IACvC,IAAI,mBAAwC,CAAC;IAE7C,MAAM,cAAc,GAAG,CAA4C,EAAK,EACd,EAAE;QACxD,OAAO,CAAC,GAAG,IAAe,EAAE,EAAE;YAC1B,yFAAyF;YACzF,IAAI,oBAAoB,EAAE;gBACtB,OAAO;aACV;YAED,OAAO,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,IAAI,CAAkB,CAAC;QACx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,EAAC,CAAC,CAAC;QAC1D,MAAM,QAAQ,GAAuB,EAAE,CAAC;QAExC;YACI,EAAC,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC,SAAS,EAAC;YACvC,EAAC,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC,KAAK,EAAC;YACnC,EAAC,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC,SAAS,EAAC;YACvC,EAAC,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC,YAAY,EAAC;SAC7C,CAAC,OAAO,CAAC,CAAC,EAAC,SAAS,EAAC,EAAE,EAAE;YAGtB,SAAS,CAAC,EAAE,CAAC,SAAkC,EAAE,CAAC,UAA+B,EAAE,EAAE;gBACjF,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE;oBAC/B,MAAM,eAAe,GAAG,IAAA,+BAAgB,EAAC,UAAU,EAAE,IAAA,qBAAS,EAAC,SAAS,EAAE,SAAS,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;oBAEzG,MAAM,aAAa,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;gBACvD,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;YACtB,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;QAEH,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,EAAE,GAAG,EAAE;YAC3C,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE,MAAM,CAAC,CAAC;QAC/D,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "html-reporter",
3
- "version": "9.17.2",
4
- "description": "Plugin for hermione which is intended to aggregate the results of tests running into html report",
3
+ "version": "9.18.0",
4
+ "description": "Html-reporter and GUI for viewing and managing results of a tests run. Currently supports Testplane and Hermione.",
5
5
  "files": [
6
6
  "build"
7
7
  ],
8
8
  "exports": {
9
- "./gemini": "./build/gemini.js",
9
+ "./testplane": "./build/testplane.js",
10
10
  "./hermione": "./build/hermione.js",
11
11
  "./playwright": "./build/playwright.js"
12
12
  },
@@ -51,6 +51,7 @@
51
51
  "node": ">= 14"
52
52
  },
53
53
  "keywords": [
54
+ "testplane",
54
55
  "hermione",
55
56
  "plugin",
56
57
  "html-reporter"
package/build/gemini.d.ts DELETED
@@ -1,2 +0,0 @@
1
- declare function _exports(): never;
2
- export = _exports;
package/build/gemini.js DELETED
@@ -1,5 +0,0 @@
1
- 'use strict';
2
- module.exports = () => {
3
- throw new Error('html-reporter: Gemini support is removed. Migrate your Gemini test to Hermione (https://github.com/gemini-testing/hermione) or use html-reporter@4');
4
- };
5
- //# sourceMappingURL=gemini.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"gemini.js","sourceRoot":"","sources":["../gemini.js"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,MAAM,CAAC,OAAO,GAAG,GAAG,EAAE;IAClB,MAAM,IAAI,KAAK,CAAC,oJAAoJ,CAAC,CAAC;AAC1K,CAAC,CAAC"}