UNPKG

html-reporter

Version:

Html-reporter and GUI for viewing and managing results of a tests run. Currently supports Testplane and Hermione.

29 lines 1.12 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const json_stringify_safe_1 = __importDefault(require("json-stringify-safe")); const ipc_1 = __importDefault(require("./ipc")); const constants_1 = require("../../../gui/constants"); class MyReporter { onTestBegin(test, result) { ipc_1.default.emit(constants_1.ClientEvents.BEGIN_STATE, getEmittedData(test, result)); } onTestEnd(test, result) { ipc_1.default.emit(constants_1.ClientEvents.TEST_RESULT, getEmittedData(test, result)); } onEnd() { ipc_1.default.emit(constants_1.ClientEvents.END); } } exports.default = MyReporter; function getEmittedData(test, result) { return { test: JSON.parse((0, json_stringify_safe_1.default)(test)), result: JSON.parse((0, json_stringify_safe_1.default)(result)), browserName: test.parent.project()?.name || '', titlePath: test.titlePath() }; } //# sourceMappingURL=reporter.js.map