Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 28x 28x 5x 2x 2x 5x 207x 208x 207x 208x 1x 532x 1x 535x 1x 1068x 2x 3x 3x 3x 1x 2x 1x 1x 2x 4x 3x 2x 3x 3x 4x 4x 3x 3x 3x 2x 208x 3x 2x 2x 1x 1x | "use strict"; /** * Allure reporter. * * @module */ require("colors"); const allure = require("../allure"); const CONF = require("../config"); const TestCase = require("../testing").TestCase; module.exports = { start: () => { allure.startSuite(CONF.allure.suiteName); }, end: () => { reportSkippedTests(); allure.endSuite(); console.log(); const reportMsg = "Allure report is " + CONF.allure.dir; console.log(Array(reportMsg.length + 1).join("-").yellow); console.log(reportMsg.yellow); }, suite: suite => { allure.startSuite(suite.title); }, suiteEnd: () => { allure.endSuite(); }, scope: scope => { if (!allure.isTestStarted()) return; allure.startStep(scope.title); allure.getCurrentSuite().currentStep.isScope = true; // small hack }, scopeEnd: () => { if (allure.isTestStarted()) allure.endStep(); }, test: test => { allure.startCase(test.title); }, testEnd: () => { if (CONF.test.curCase.status === TestCase.PASSED) { allure.endCase(allure.PASSED); } if (CONF.test.curCase.status === TestCase.FAILED) { allure.endCase(allure.FAILED, getErrors(CONF.test.curCase)); } }, chunk: chunk => { allure.startStep(chunk.title); }, skip: () => { while (allureNotScope()) allure.endStep(allure.SKIPPED); }, pass: () => { while (allureNotScope()) allure.endStep(allure.PASSED); }, fail: () => { while (allureNotScope()) allure.endStep(allure.FAILED); }, }; const allureNotScope = () => allure.hasSteps() && !allure.getCurrentSuite().currentStep.isScope; const getErrors = testCase => { const result = {}; const errMsgs = getErrMsgs(testCase.errors); if (errMsgs.length === 0) { result.message = "Show details ➤"; } else if (errMsgs.length === 1) { result.message = errMsgs[0]; } else { let n = 0; result.message = errMsgs.map(i => `${++n}. ${i}`).join("\r"); } result.stack = testCase.errors.map(e => e.split("\n").join("\r")).join("\n\r"); return result; }; const getErrMsgs = errs => { const result = []; for (const err of errs) { for (const line of err.split("\n")) { if (line.startsWith("message: ")) { result.push(line.substr(9)); break; }; } } return result; }; const reportSkippedTests = () => { const skipped = CONF.test.cases.filter(t => t.status === TestCase.SKIPPED); for (const skip of skipped) { allure.startCase(skip.name); if (skip.rawInfo[0]) { allure.endCase(allure.SKIPPED, { message: skip.rawInfo[0] }); } else { allure.endCase(allure.SKIPPED); } } }; |