aft-mocha-reporter
Advanced tools
Comparing version 11.2.1 to 12.0.0
@@ -44,3 +44,3 @@ "use strict"; | ||
// clear all previously cached test results | ||
aft_core_1.FileSystemMap.removeCacheFile(aft_mocha_test_1.AftMochaTest.name); | ||
aft_core_1.FileSystemMap.removeMapFile(aft_mocha_test_1.AftMochaTest.name); | ||
}) | ||
@@ -52,5 +52,5 @@ .on(EVENT_TEST_PENDING, (test) => __awaiter(this, void 0, void 0, function* () { | ||
*/ | ||
const t = new aft_mocha_test_1.AftMochaTest({ test }); | ||
const t = new aft_mocha_test_1.AftMochaTest({ test }, null, { _preventCacheClear: true }); | ||
if (t.results.length === 0) { | ||
yield t.pending(); | ||
yield aft_core_1.Err.handleAsync(() => t.pending(), { errLevel: 'none' }); | ||
} | ||
@@ -60,5 +60,5 @@ })) | ||
// conditionally handle `passing` test when not using aftMochaTest | ||
const t = new aft_mocha_test_1.AftMochaTest({ test }); | ||
const t = new aft_mocha_test_1.AftMochaTest({ test }, null, { _preventCacheClear: true }); | ||
if (t.results.length === 0) { | ||
yield t.pass(); | ||
yield aft_core_1.Err.handleAsync(() => t.pass(), { errLevel: 'none' }); | ||
} | ||
@@ -69,3 +69,3 @@ })) | ||
// conditionally handle `failing` test when not using aftMochaTest | ||
const t = new aft_mocha_test_1.AftMochaTest({ test }); | ||
const t = new aft_mocha_test_1.AftMochaTest({ test }, null, { _preventCacheClear: true }); | ||
if (t.results.length === 0) { | ||
@@ -76,3 +76,3 @@ if (typeof err !== 'string') { | ||
} | ||
yield t.fail(err); | ||
yield aft_core_1.Err.handleAsync(() => t.fail(err), { errLevel: 'none' }); | ||
} | ||
@@ -79,0 +79,0 @@ })); |
@@ -45,3 +45,2 @@ import Mocha = require("mocha"); | ||
constructor(scope?: any, testFunction?: AftTestFunction, options?: AftTestOptions); | ||
pending(message?: string, ...testIds: Array<string>): Promise<void>; | ||
protected _generateTestResult(status: TestStatus, resultMessage: string, testId?: string): Promise<TestResult>; | ||
@@ -71,2 +70,2 @@ } | ||
*/ | ||
export declare const aftMochaTest: (context: Mocha.Context | string, testFunction: Func<AftMochaTest, void | PromiseLike<void>>, options?: AftTestOptions) => Promise<void>; | ||
export declare const aftMochaTest: (context: Mocha.Context | string, testFunction: Func<AftMochaTest, void | PromiseLike<void>>, options?: AftTestOptions) => Promise<AftMochaTest>; |
@@ -50,3 +50,3 @@ "use strict"; | ||
options !== null && options !== void 0 ? options : (options = {}); | ||
options.cacheResultsToFile = true; | ||
options._cacheResultsToFile = true; | ||
let description; | ||
@@ -65,12 +65,2 @@ if ((_a = scope === null || scope === void 0 ? void 0 : scope.test) === null || _a === void 0 ? void 0 : _a.fullTitle) { | ||
} | ||
pending(message, ...testIds) { | ||
const _super = Object.create(null, { | ||
pending: { get: () => super.pending } | ||
}); | ||
var _a, _b; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield _super.pending.call(this, message, ...testIds); | ||
(_b = (_a = this.test) === null || _a === void 0 ? void 0 : _a.skip) === null || _b === void 0 ? void 0 : _b.call(_a); | ||
}); | ||
} | ||
_generateTestResult(status, resultMessage, testId) { | ||
@@ -77,0 +67,0 @@ const _super = Object.create(null, { |
@@ -38,3 +38,3 @@ "use strict"; | ||
if (!shouldRun.result) { | ||
yield t.pending(shouldRun.message); | ||
this.skip(); | ||
} | ||
@@ -62,3 +62,19 @@ (0, chai_1.expect)(true).to.be.false; | ||
}); | ||
it('[C9999] allows retry to be wrapped around the aftMochaTest', function () { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
let index = 0; | ||
yield (0, aft_core_1.retry)((r) => (0, src_1.aftMochaTest)(this, (t) => __awaiter(this, void 0, void 0, function* () { | ||
yield t.verify(index++, 2, '[C9999]'); | ||
}), { | ||
additionalMetadata: { | ||
attempt: r.totalAttempts | ||
} | ||
}), { | ||
delay: 10, | ||
backOffType: 'linear', | ||
maxDuration: 5000 | ||
}).until((t) => t.status === 'passed'); | ||
}); | ||
}); | ||
}); | ||
//# sourceMappingURL=aft-mocha-reporter.spec.js.map |
@@ -1,1 +0,1 @@ | ||
[["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"}}]}]] | ||
[["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":1715778579326,"resultId":"02cd2567-5c1b-494c-b740-865bee38d1ac","status":"passed","metadata":{"durationMs":0,"buildName":"RUNNER_FVAZ714234","buildNumber":"20240515"}}]}],["AftMochaReporter can skip a test during execution",{"validUntil":-1,"data":[{"testName":"AftMochaReporter can skip a test during execution","created":1715778579327,"resultId":"275177e4-cd0d-4ed2-ad02-27545e9ed40f","resultMessage":"test skipped","status":"skipped","metadata":{"durationMs":0,"buildName":"RUNNER_FVAZ714234","buildNumber":"20240515"}}]}],["AftMochaTest_S172ZXPA",{"validUntil":-1,"data":[]}],["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":1715778579010,"resultId":"f8a0b773-a220-451f-ae44-f1ca467959ff","status":"passed","metadata":{"durationMs":23,"buildName":"RUNNER_FVAZ714234","buildNumber":"20240515"}},{"testName":"AftMochaReporter [C1234] provides a AftMochaTest instance for use in test control","created":1715778579038,"resultId":"3630575f-a4cc-4e40-a3f9-f1158f9ee0e1","resultMessage":"expected to parse test ID from description","status":"passed","metadata":{"durationMs":51,"buildName":"RUNNER_FVAZ714234","buildNumber":"20240515"}},{"testName":"AftMochaReporter [C1234] provides a AftMochaTest instance for use in test control","testId":"C1234","created":1715778579071,"resultId":"b8372352-1b4d-43e5-b98b-7edc8f3b6ec0","status":"passed","metadata":{"durationMs":77,"buildName":"RUNNER_FVAZ714234","buildNumber":"20240515"}}]}],["AftMochaReporter [C9999] allows retry to be wrapped around the aftMochaTest",{"validUntil":-1,"data":[{"testName":"AftMochaReporter [C9999] allows retry to be wrapped around the aftMochaTest","testId":"C9999","created":1715778579183,"resultId":"736145f6-347a-4b48-949a-a435f35a7750","resultMessage":"[C9999]","status":"passed","metadata":{"attempt":3,"durationMs":9,"buildName":"RUNNER_FVAZ714234","buildNumber":"20240515"}}]}],["AftMochaReporter still works if using an arrow function",{"validUntil":-1,"data":[{"testName":"AftMochaReporter still works if using an arrow function","created":1715778579327,"resultId":"4a6034cc-9d9e-486f-ad6b-93dc34de78aa","status":"passed","metadata":{"durationMs":0,"buildName":"RUNNER_FVAZ714234","buildNumber":"20240515"}}]}]] |
@@ -1,1 +0,1 @@ | ||
[["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 - "]}]]] | ||
[["AftMochaReporter [C1234] provides a AftMochaTest instance for use in test control",[{"testName":"AftMochaReporter [C1234] provides a AftMochaTest instance for use in test control","created":1715778579010,"resultId":"f8a0b773-a220-451f-ae44-f1ca467959ff","status":"passed","metadata":{"durationMs":23,"buildName":"RUNNER_FVAZ714234","buildNumber":"20240515"},"logs":["pass - "]},{"testName":"AftMochaReporter [C1234] provides a AftMochaTest instance for use in test control","created":1715778579038,"resultId":"3630575f-a4cc-4e40-a3f9-f1158f9ee0e1","resultMessage":"expected to parse test ID from description","status":"passed","metadata":{"durationMs":51,"buildName":"RUNNER_FVAZ714234","buildNumber":"20240515"},"logs":["pass - expected to parse test ID from description"]},{"testName":"AftMochaReporter [C1234] provides a AftMochaTest instance for use in test control","testId":"C1234","created":1715778579071,"resultId":"b8372352-1b4d-43e5-b98b-7edc8f3b6ec0","status":"passed","metadata":{"durationMs":77,"buildName":"RUNNER_FVAZ714234","buildNumber":"20240515"},"logs":["pass - C1234"]}]],["AftMochaReporter [C9999] allows retry to be wrapped around the aftMochaTest",[{"testName":"AftMochaReporter [C9999] allows retry to be wrapped around the aftMochaTest","testId":"C9999","created":1715778579097,"resultId":"bfb50ace-d52d-43bf-b834-e2becb992c43","resultMessage":"Error: [C9999] - expected '2' to equal '0'\n at AftMochaTest.<anonymous> (/home/runner/work/automated-functional-testing/automated-functional-testing/packages/aft-core/dist/src/verification/aft-test.js:250:27)\n at Generator.next (<anonymous>)\n at /home/runner/work/automated-functional-testing/automated-functional-testing/packages/aft-core/dist/src/verification/aft-test.js:8:71\n at new Promise (<anonymous>)\n at __awaiter (/home/runner/work/automated-functional-testing/automated-functional-testing/packages/aft-core/dist/src/verification/aft-test.js:4:12)\n at AftMochaTest.verify (/home/runner/work/automated-functional-testing/automated-functional-testing/packages/aft-core/dist/src/verification/aft-test.js:216:16)\n at Context.<anonymous> (/home/runner/work/automated-functional-testing/automated-functional-testing/packages/aft-mocha-reporter/dist/test/aft-mocha-reporter.spec.js:65:25)\n at Generator.next (<anonymous>)\n at /home/runner/work/automated-functional-testing/automated-functional-testing/packages/aft-mocha-reporter/dist/test/aft-mocha-reporter.spec.js:8:71\n at new Promise (<anonymous>)","status":"failed","metadata":{"attempt":1,"durationMs":8,"buildName":"RUNNER_FVAZ714234","buildNumber":"20240515"},"logs":["fail - C9999 - Error: [C9999] - expected '2' to equal '0'\n at AftMochaTest.<anonymous> (/home/runner/work/automated-functional-testing/automated-functional-testing/packages/aft-core/dist/src/verification/aft-test.js:250:27)\n at Generator.next (<anonymous>)\n at /home/runner/work/automated-functional-testing/automated-functional-testing/packages/aft-core/dist/src/verification/aft-test.js:8:71\n at new Promise (<anonymous>)\n at __awaiter (/home/runner/work/automated-functional-testing/automated-functional-testing/packages/aft-core/dist/src/verification/aft-test.js:4:12)\n at AftMochaTest.verify (/home/runner/work/automated-functional-testing/automated-functional-testing/packages/aft-core/dist/src/verification/aft-test.js:216:16)\n at Context.<anonymous> (/home/runner/work/automated-functional-testing/automated-functional-testing/packages/aft-mocha-reporter/dist/test/aft-mocha-reporter.spec.js:65:25)\n at Generator.next (<anonymous>)\n at /home/runner/work/automated-functional-testing/automated-functional-testing/packages/aft-mocha-reporter/dist/test/aft-mocha-reporter.spec.js:8:71\n at new Promise (<anonymous>)"]},{"testName":"AftMochaReporter [C9999] allows retry to be wrapped around the aftMochaTest","testId":"C9999","created":1715778579133,"resultId":"d62b61e6-018c-477d-a33f-4ce91c2ba48f","resultMessage":"Error: [C9999] - expected '2' to equal '1'\n at AftMochaTest.<anonymous> (/home/runner/work/automated-functional-testing/automated-functional-testing/packages/aft-core/dist/src/verification/aft-test.js:250:27)\n at Generator.next (<anonymous>)\n at /home/runner/work/automated-functional-testing/automated-functional-testing/packages/aft-core/dist/src/verification/aft-test.js:8:71\n at new Promise (<anonymous>)\n at __awaiter (/home/runner/work/automated-functional-testing/automated-functional-testing/packages/aft-core/dist/src/verification/aft-test.js:4:12)\n at AftMochaTest.verify (/home/runner/work/automated-functional-testing/automated-functional-testing/packages/aft-core/dist/src/verification/aft-test.js:216:16)\n at Context.<anonymous> (/home/runner/work/automated-functional-testing/automated-functional-testing/packages/aft-mocha-reporter/dist/test/aft-mocha-reporter.spec.js:65:25)\n at Generator.next (<anonymous>)\n at /home/runner/work/automated-functional-testing/automated-functional-testing/packages/aft-mocha-reporter/dist/test/aft-mocha-reporter.spec.js:8:71\n at new Promise (<anonymous>)","status":"failed","metadata":{"attempt":2,"durationMs":7,"buildName":"RUNNER_FVAZ714234","buildNumber":"20240515"},"logs":["fail - C9999 - Error: [C9999] - expected '2' to equal '1'\n at AftMochaTest.<anonymous> (/home/runner/work/automated-functional-testing/automated-functional-testing/packages/aft-core/dist/src/verification/aft-test.js:250:27)\n at Generator.next (<anonymous>)\n at /home/runner/work/automated-functional-testing/automated-functional-testing/packages/aft-core/dist/src/verification/aft-test.js:8:71\n at new Promise (<anonymous>)\n at __awaiter (/home/runner/work/automated-functional-testing/automated-functional-testing/packages/aft-core/dist/src/verification/aft-test.js:4:12)\n at AftMochaTest.verify (/home/runner/work/automated-functional-testing/automated-functional-testing/packages/aft-core/dist/src/verification/aft-test.js:216:16)\n at Context.<anonymous> (/home/runner/work/automated-functional-testing/automated-functional-testing/packages/aft-mocha-reporter/dist/test/aft-mocha-reporter.spec.js:65:25)\n at Generator.next (<anonymous>)\n at /home/runner/work/automated-functional-testing/automated-functional-testing/packages/aft-mocha-reporter/dist/test/aft-mocha-reporter.spec.js:8:71\n at new Promise (<anonymous>)"]},{"testName":"AftMochaReporter [C9999] allows retry to be wrapped around the aftMochaTest","testId":"C9999","created":1715778579183,"resultId":"736145f6-347a-4b48-949a-a435f35a7750","resultMessage":"[C9999]","status":"passed","metadata":{"attempt":3,"durationMs":9,"buildName":"RUNNER_FVAZ714234","buildNumber":"20240515"},"logs":["pass - C9999 - [C9999]"]}]],["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":1715778579326,"resultId":"02cd2567-5c1b-494c-b740-865bee38d1ac","status":"passed","metadata":{"durationMs":0,"buildName":"RUNNER_FVAZ714234","buildNumber":"20240515"},"logs":["pass - "]}]],["AftMochaReporter can skip a test during execution",[{"testName":"AftMochaReporter can skip a test during execution","created":1715778579327,"resultId":"275177e4-cd0d-4ed2-ad02-27545e9ed40f","resultMessage":"test skipped","status":"skipped","metadata":{"durationMs":0,"buildName":"RUNNER_FVAZ714234","buildNumber":"20240515"},"logs":["warn - test skipped"]}]],["AftMochaReporter still works if using an arrow function",[{"testName":"AftMochaReporter still works if using an arrow function","created":1715778579327,"resultId":"4a6034cc-9d9e-486f-ad6b-93dc34de78aa","status":"passed","metadata":{"durationMs":0,"buildName":"RUNNER_FVAZ714234","buildNumber":"20240515"},"logs":["pass - "]}]]] |
{ | ||
"name": "aft-mocha-reporter", | ||
"version": "11.2.1", | ||
"version": "12.0.0", | ||
"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.1", | ||
"aft-core": "^12.0.0", | ||
"mocha": "^10.3.0" | ||
@@ -44,4 +44,4 @@ }, | ||
"@typescript-eslint/parser": "^7.4.0", | ||
"aft-reporting-filesystem": "^11.2.1", | ||
"aft-reporting-html": "^11.2.1", | ||
"aft-reporting-filesystem": "^12.0.0", | ||
"aft-reporting-html": "^12.0.0", | ||
"chai": "^4.4.1", | ||
@@ -55,3 +55,3 @@ "eslint": "^8.57.0", | ||
}, | ||
"gitHead": "285f8cbfc76c2e1921b0a0227ca39a41963acfbf" | ||
"gitHead": "7e6c8c80a3c0d5c79588fd11ca7c657ab11f1705" | ||
} |
@@ -44,3 +44,3 @@ import * as Mocha from 'mocha'; | ||
// clear all previously cached test results | ||
FileSystemMap.removeCacheFile(AftMochaTest.name); | ||
FileSystemMap.removeMapFile(AftMochaTest.name); | ||
}) | ||
@@ -52,5 +52,5 @@ .on(EVENT_TEST_PENDING, async (test: Mocha.Test) => { | ||
*/ | ||
const t = new AftMochaTest({test}); | ||
const t = new AftMochaTest({test}, null, {_preventCacheClear: true}); | ||
if (t.results.length === 0) { | ||
await t.pending(); | ||
await Err.handleAsync(() => t.pending(), {errLevel: 'none'}); | ||
} | ||
@@ -60,5 +60,5 @@ }) | ||
// conditionally handle `passing` test when not using aftMochaTest | ||
const t = new AftMochaTest({test}); | ||
const t = new AftMochaTest({test}, null, {_preventCacheClear: true}); | ||
if (t.results.length === 0) { | ||
await t.pass(); | ||
await Err.handleAsync(() => t.pass(), {errLevel: 'none'}); | ||
} | ||
@@ -68,3 +68,3 @@ }) | ||
// conditionally handle `failing` test when not using aftMochaTest | ||
const t = new AftMochaTest({test}); | ||
const t = new AftMochaTest({test}, null, {_preventCacheClear: true}); | ||
if (t.results.length === 0) { | ||
@@ -75,3 +75,3 @@ if (typeof err !== 'string') { | ||
} | ||
await t.fail(err); | ||
await Err.handleAsync(() => t.fail(err), {errLevel: 'none'}); | ||
} | ||
@@ -78,0 +78,0 @@ }); |
@@ -49,3 +49,3 @@ import Mocha = require("mocha"); | ||
options ??= {}; | ||
options.cacheResultsToFile = true; | ||
options._cacheResultsToFile = true; | ||
let description: string; | ||
@@ -63,7 +63,2 @@ if (scope?.test?.fullTitle) { | ||
override async pending(message?: string, ...testIds: Array<string>): Promise<void> { | ||
await super.pending(message, ...testIds); | ||
this.test?.skip?.(); | ||
} | ||
protected override async _generateTestResult(status: TestStatus, resultMessage: string, testId?: string): Promise<TestResult> { | ||
@@ -100,4 +95,4 @@ const result = await super._generateTestResult(status, resultMessage, testId); | ||
*/ | ||
export const aftMochaTest = async (context: Mocha.Context | string, testFunction: Func<AftMochaTest, void | PromiseLike<void>>, options?: AftTestOptions): Promise<void> => { | ||
export const aftMochaTest = async (context: Mocha.Context | string, testFunction: Func<AftMochaTest, void | PromiseLike<void>>, options?: AftTestOptions): Promise<AftMochaTest> => { | ||
return new AftMochaTest(context, testFunction, options).run(); | ||
}; |
import { expect } from "chai"; | ||
import { AftMochaTest, aftMochaTest } from "../src"; | ||
import * as sinon from "sinon"; | ||
import { containing } from "aft-core"; | ||
import { Retry, containing, retry } from "aft-core"; | ||
@@ -27,3 +27,3 @@ describe('AftMochaReporter', () => { | ||
if (!shouldRun.result) { | ||
await t.pending(shouldRun.message); | ||
this.skip(); | ||
} | ||
@@ -53,2 +53,17 @@ | ||
}); | ||
it('[C9999] allows retry to be wrapped around the aftMochaTest', async function() { | ||
let index = 0; | ||
await retry((r: Retry<AftMochaTest>) => aftMochaTest(this, async (t: AftMochaTest) => { | ||
await t.verify(index++, 2, '[C9999]'); | ||
}, { | ||
additionalMetadata: { | ||
attempt: r.totalAttempts | ||
} | ||
}), { | ||
delay: 10, | ||
backOffType: 'linear', | ||
maxDuration: 5000 | ||
}).until((t: AftMochaTest) => t.status === 'passed'); | ||
}); | ||
}); |
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
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
124422
34
607
+ Addedaft-core@12.1.1(transitive)
- Removedaft-core@11.2.1(transitive)
Updatedaft-core@^12.0.0