aft-mocha-reporter
Advanced tools
Comparing version 11.2.0 to 11.2.1
import Mocha = require("mocha"); | ||
import { AftTest, AftTestFunction, AftTestOptions, Func } from "aft-core"; | ||
import { AftTest, AftTestFunction, AftTestOptions, Func, TestResult, TestStatus } from "aft-core"; | ||
/** | ||
@@ -46,2 +46,3 @@ * expects to be passed the scope from an executing Mocha | ||
pending(message?: string, ...testIds: Array<string>): Promise<void>; | ||
protected _generateTestResult(status: TestStatus, resultMessage: string, testId?: string): Promise<TestResult>; | ||
} | ||
@@ -48,0 +49,0 @@ /** |
@@ -74,2 +74,15 @@ "use strict"; | ||
} | ||
_generateTestResult(status, resultMessage, testId) { | ||
const _super = Object.create(null, { | ||
_generateTestResult: { get: () => super._generateTestResult } | ||
}); | ||
var _a, _b; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const result = yield _super._generateTestResult.call(this, status, resultMessage, testId); | ||
if (((_a = result === null || result === void 0 ? void 0 : result.metadata) === null || _a === void 0 ? void 0 : _a['durationMs']) && ((_b = this.test) === null || _b === void 0 ? void 0 : _b.duration) > 0) { | ||
result.metadata['durationMs'] = this.test.duration; | ||
} | ||
return result; | ||
}); | ||
} | ||
} | ||
@@ -76,0 +89,0 @@ exports.AftMochaTest = AftMochaTest; |
@@ -1,1 +0,1 @@ | ||
[["AftMochaReporter can skip a test during execution",{"validUntil":-1,"data":[{"testName":"AftMochaReporter can skip a test during execution","created":1715276733817,"resultId":"a3ba1bdb-57a9-4c3d-bddf-baa482a5a0b8","resultMessage":"fake","status":"skipped","metadata":{"durationMs":null,"buildName":"RUNNER_FVAZ700560","buildNumber":"20240509"}}]}],["AftMochaReporter [C1234] provides a AftMochaTest instance for use in test control",{"validUntil":-1,"data":[{"testName":"AftMochaReporter [C1234] provides a AftMochaTest instance for use in test control","created":1715276733842,"resultId":"8b72b8c7-82ff-4762-8336-c78513bfd21a","status":"passed","metadata":{"durationMs":6,"buildName":"RUNNER_FVAZ700560","buildNumber":"20240509"}},{"testName":"AftMochaReporter [C1234] provides a AftMochaTest instance for use in test control","created":1715276733859,"resultId":"1b8c7738-5cfa-4632-93bb-f42a5486c67e","status":"passed","metadata":{"durationMs":23,"buildName":"RUNNER_FVAZ700560","buildNumber":"20240509"}},{"testName":"AftMochaReporter [C1234] provides a AftMochaTest instance for use in test control","testId":"C1234","created":1715276733875,"resultId":"3776d756-ec80-4d89-a529-fb18a16ee8b5","resultMessage":null,"status":"passed","metadata":{"durationMs":39,"buildName":"RUNNER_FVAZ700560","buildNumber":"20240509"}}]}],["AftMochaReporter passes a Mocha Test to the test that can be used by AftMochaTest",{"validUntil":-1,"data":[{"testName":"AftMochaReporter passes a Mocha Test to the test that can be used by AftMochaTest","created":1715276734004,"resultId":"e67220e4-e327-459d-b5e0-763c011dfdf5","resultMessage":null,"status":"passed","metadata":{"durationMs":null,"buildName":"RUNNER_FVAZ700560","buildNumber":"20240509"}}]}],["AftMochaReporter still works if using an arrow function",{"validUntil":-1,"data":[{"testName":"AftMochaReporter still works if using an arrow function","created":1715276734005,"resultId":"01fe3cfb-1c66-4eef-a299-c89362377a09","resultMessage":null,"status":"passed","metadata":{"durationMs":null,"buildName":"RUNNER_FVAZ700560","buildNumber":"20240509"}}]}]] | ||
[["AftMochaReporter can skip a test during execution",{"validUntil":-1,"data":[{"testName":"AftMochaReporter can skip a test during execution","created":1715347401132,"resultId":"4fbbb175-0853-471e-8efa-092665364e4c","resultMessage":"fake","status":"skipped","metadata":{"durationMs":0,"buildName":"RUNNER_FVAZ1245112","buildNumber":"20240510"}}]}],["AftMochaReporter [C1234] provides a AftMochaTest instance for use in test control",{"validUntil":-1,"data":[{"testName":"AftMochaReporter [C1234] provides a AftMochaTest instance for use in test control","created":1715347401156,"resultId":"65f5567f-19ce-4b63-86e7-d53f70057642","status":"passed","metadata":{"durationMs":6,"buildName":"RUNNER_FVAZ1245112","buildNumber":"20240510"}},{"testName":"AftMochaReporter [C1234] provides a AftMochaTest instance for use in test control","created":1715347401174,"resultId":"c615db9d-abbe-42b1-83da-79b0fc6ccf82","resultMessage":"expected to parse test ID from description","status":"passed","metadata":{"durationMs":24,"buildName":"RUNNER_FVAZ1245112","buildNumber":"20240510"}},{"testName":"AftMochaReporter [C1234] provides a AftMochaTest instance for use in test control","testId":"C1234","created":1715347401191,"resultId":"57bd5659-2e16-4800-a28f-cd7c090966c2","resultMessage":null,"status":"passed","metadata":{"durationMs":41,"buildName":"RUNNER_FVAZ1245112","buildNumber":"20240510"}}]}],["AftMochaReporter passes a Mocha Test to the test that can be used by AftMochaTest",{"validUntil":-1,"data":[{"testName":"AftMochaReporter passes a Mocha Test to the test that can be used by AftMochaTest","created":1715347401305,"resultId":"91b66e43-a6cd-4cd5-83d4-4b7793669314","resultMessage":null,"status":"passed","metadata":{"durationMs":0,"buildName":"RUNNER_FVAZ1245112","buildNumber":"20240510"}}]}],["AftMochaReporter still works if using an arrow function",{"validUntil":-1,"data":[{"testName":"AftMochaReporter still works if using an arrow function","created":1715347401306,"resultId":"ccd54d23-53df-413d-aa0c-e37e901bea37","resultMessage":null,"status":"passed","metadata":{"durationMs":0,"buildName":"RUNNER_FVAZ1245112","buildNumber":"20240510"}}]}]] |
@@ -1,1 +0,1 @@ | ||
[["AftMochaReporter can skip a test during execution",[{"testName":"AftMochaReporter can skip a test during execution","created":1715276733817,"resultId":"a3ba1bdb-57a9-4c3d-bddf-baa482a5a0b8","resultMessage":"fake","status":"skipped","metadata":{"durationMs":null,"buildName":"RUNNER_FVAZ700560","buildNumber":"20240509"},"logs":["warn - fake"]}]],["AftMochaReporter [C1234] provides a AftMochaTest instance for use in test control",[{"testName":"AftMochaReporter [C1234] provides a AftMochaTest instance for use in test control","created":1715276733842,"resultId":"8b72b8c7-82ff-4762-8336-c78513bfd21a","status":"passed","metadata":{"durationMs":6,"buildName":"RUNNER_FVAZ700560","buildNumber":"20240509"},"logs":["pass - "]},{"testName":"AftMochaReporter [C1234] provides a AftMochaTest instance for use in test control","created":1715276733859,"resultId":"1b8c7738-5cfa-4632-93bb-f42a5486c67e","status":"passed","metadata":{"durationMs":23,"buildName":"RUNNER_FVAZ700560","buildNumber":"20240509"},"logs":["pass - "]},{"testName":"AftMochaReporter [C1234] provides a AftMochaTest instance for use in test control","testId":"C1234","created":1715276733875,"resultId":"3776d756-ec80-4d89-a529-fb18a16ee8b5","resultMessage":null,"status":"passed","metadata":{"durationMs":39,"buildName":"RUNNER_FVAZ700560","buildNumber":"20240509"},"logs":["pass - C1234"]}]],["AftMochaReporter passes a Mocha Test to the test that can be used by AftMochaTest",[{"testName":"AftMochaReporter passes a Mocha Test to the test that can be used by AftMochaTest","created":1715276734004,"resultId":"e67220e4-e327-459d-b5e0-763c011dfdf5","resultMessage":null,"status":"passed","metadata":{"durationMs":null,"buildName":"RUNNER_FVAZ700560","buildNumber":"20240509"},"logs":["pass - "]}]],["AftMochaReporter still works if using an arrow function",[{"testName":"AftMochaReporter still works if using an arrow function","created":1715276734005,"resultId":"01fe3cfb-1c66-4eef-a299-c89362377a09","resultMessage":null,"status":"passed","metadata":{"durationMs":null,"buildName":"RUNNER_FVAZ700560","buildNumber":"20240509"},"logs":["pass - "]}]]] | ||
[["AftMochaReporter can skip a test during execution",[{"testName":"AftMochaReporter can skip a test during execution","created":1715347401132,"resultId":"4fbbb175-0853-471e-8efa-092665364e4c","resultMessage":"fake","status":"skipped","metadata":{"durationMs":0,"buildName":"RUNNER_FVAZ1245112","buildNumber":"20240510"},"logs":["warn - fake"]}]],["AftMochaReporter [C1234] provides a AftMochaTest instance for use in test control",[{"testName":"AftMochaReporter [C1234] provides a AftMochaTest instance for use in test control","created":1715347401156,"resultId":"65f5567f-19ce-4b63-86e7-d53f70057642","status":"passed","metadata":{"durationMs":6,"buildName":"RUNNER_FVAZ1245112","buildNumber":"20240510"},"logs":["pass - "]},{"testName":"AftMochaReporter [C1234] provides a AftMochaTest instance for use in test control","created":1715347401174,"resultId":"c615db9d-abbe-42b1-83da-79b0fc6ccf82","resultMessage":"expected to parse test ID from description","status":"passed","metadata":{"durationMs":24,"buildName":"RUNNER_FVAZ1245112","buildNumber":"20240510"},"logs":["pass - expected to parse test ID from description"]},{"testName":"AftMochaReporter [C1234] provides a AftMochaTest instance for use in test control","testId":"C1234","created":1715347401191,"resultId":"57bd5659-2e16-4800-a28f-cd7c090966c2","resultMessage":null,"status":"passed","metadata":{"durationMs":41,"buildName":"RUNNER_FVAZ1245112","buildNumber":"20240510"},"logs":["pass - C1234"]}]],["AftMochaReporter passes a Mocha Test to the test that can be used by AftMochaTest",[{"testName":"AftMochaReporter passes a Mocha Test to the test that can be used by AftMochaTest","created":1715347401305,"resultId":"91b66e43-a6cd-4cd5-83d4-4b7793669314","resultMessage":null,"status":"passed","metadata":{"durationMs":0,"buildName":"RUNNER_FVAZ1245112","buildNumber":"20240510"},"logs":["pass - "]}]],["AftMochaReporter still works if using an arrow function",[{"testName":"AftMochaReporter still works if using an arrow function","created":1715347401306,"resultId":"ccd54d23-53df-413d-aa0c-e37e901bea37","resultMessage":null,"status":"passed","metadata":{"durationMs":0,"buildName":"RUNNER_FVAZ1245112","buildNumber":"20240510"},"logs":["pass - "]}]]] |
{ | ||
"name": "aft-mocha-reporter", | ||
"version": "11.2.0", | ||
"version": "11.2.1", | ||
"description": "Automated Functional Testing (AFT) Reporter for use with Mocha Test Framework", | ||
@@ -34,3 +34,3 @@ "main": "./dist/src/index.js", | ||
"dependencies": { | ||
"aft-core": "^11.2.0", | ||
"aft-core": "^11.2.1", | ||
"mocha": "^10.3.0" | ||
@@ -44,4 +44,4 @@ }, | ||
"@typescript-eslint/parser": "^7.4.0", | ||
"aft-reporting-filesystem": "^11.2.0", | ||
"aft-reporting-html": "^11.2.0", | ||
"aft-reporting-filesystem": "^11.2.1", | ||
"aft-reporting-html": "^11.2.1", | ||
"chai": "^4.4.1", | ||
@@ -55,3 +55,3 @@ "eslint": "^8.57.0", | ||
}, | ||
"gitHead": "375c5e2d8a29cbbd1cece49977a40c3c718d9629" | ||
"gitHead": "285f8cbfc76c2e1921b0a0227ca39a41963acfbf" | ||
} |
import Mocha = require("mocha"); | ||
import { AftTest, AftTestFunction, AftTestOptions, Func, rand } from "aft-core"; | ||
import { AftTest, AftTestFunction, AftTestOptions, Func, TestResult, TestStatus, rand } from "aft-core"; | ||
@@ -66,2 +66,10 @@ /** | ||
} | ||
protected override async _generateTestResult(status: TestStatus, resultMessage: string, testId?: string): Promise<TestResult> { | ||
const result = await super._generateTestResult(status, resultMessage, testId); | ||
if (result?.metadata?.['durationMs'] && this.test?.duration > 0) { | ||
result.metadata['durationMs'] = this.test.duration; | ||
} | ||
return result; | ||
} | ||
} | ||
@@ -68,0 +76,0 @@ |
import { expect } from "chai"; | ||
import { AftMochaTest, aftMochaTest } from "../src"; | ||
import * as sinon from "sinon"; | ||
import { AftTest, containing, equivalent } from "aft-core"; | ||
import { containing } from "aft-core"; | ||
@@ -6,0 +6,0 @@ describe('AftMochaReporter', () => { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
104501
592
Updatedaft-core@^11.2.1