mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-14 22:40:03 +08:00
jasmine: fix CustomReporter.jasmineDone signature (#14032)
- Extract RunDetails interface - Remove test reporter with wrong signature
This commit is contained in:
committed by
Mohamed Hegazy
parent
eef0e1ad4c
commit
f73bb9c890
26
jasmine/index.d.ts
vendored
26
jasmine/index.d.ts
vendored
@@ -370,13 +370,18 @@ declare namespace jasmine {
|
||||
}
|
||||
|
||||
interface CustomReporterResult {
|
||||
description: string,
|
||||
failedExpectations?: FailedExpectation[],
|
||||
fullName: string,
|
||||
id: string;
|
||||
passedExpectations?: PassedExpectation[],
|
||||
pendingReason?: string;
|
||||
status?: string;
|
||||
description: string,
|
||||
failedExpectations?: FailedExpectation[],
|
||||
fullName: string,
|
||||
id: string;
|
||||
passedExpectations?: PassedExpectation[],
|
||||
pendingReason?: string;
|
||||
status?: string;
|
||||
}
|
||||
|
||||
interface RunDetails {
|
||||
failedExpectations: ExpectationResult[];
|
||||
order: jasmine.Order
|
||||
}
|
||||
|
||||
interface CustomReporter {
|
||||
@@ -385,7 +390,7 @@ declare namespace jasmine {
|
||||
specStarted?(result: CustomReporterResult): void;
|
||||
specDone?(result: CustomReporterResult): void;
|
||||
suiteDone?(result: CustomReporterResult): void;
|
||||
jasmineDone?(): any;
|
||||
jasmineDone?(runDetails: RunDetails): void;
|
||||
}
|
||||
|
||||
interface Runner {
|
||||
@@ -549,10 +554,7 @@ declare namespace jasmine {
|
||||
finished: boolean;
|
||||
result: any;
|
||||
messages: any;
|
||||
runDetails: {
|
||||
failedExpectations: ExpectationResult[];
|
||||
order: jasmine.Order
|
||||
}
|
||||
runDetails: RunDetails
|
||||
|
||||
new (): any;
|
||||
|
||||
|
||||
@@ -926,7 +926,7 @@ var myReporter: jasmine.CustomReporter = {
|
||||
}
|
||||
console.log(result.passedExpectations.length);
|
||||
},
|
||||
|
||||
|
||||
suiteDone: function (result: jasmine.CustomReporterResult) {
|
||||
console.log('Suite: ' + result.description + ' was ' + result.status);
|
||||
for (var i = 0; i < result.failedExpectations.length; i++) {
|
||||
@@ -935,29 +935,14 @@ var myReporter: jasmine.CustomReporter = {
|
||||
}
|
||||
},
|
||||
|
||||
jasmineDone: function() {
|
||||
jasmineDone: function(runDetails: jasmine.RunDetails) {
|
||||
console.log('Finished suite');
|
||||
console.log('Random:', runDetails.order.random);
|
||||
}
|
||||
};
|
||||
|
||||
jasmine.getEnv().addReporter(myReporter);
|
||||
|
||||
// test for custom reporter which return ES6 Promise in jasmineDone():
|
||||
var myShortReporter: jasmine.CustomReporter = {
|
||||
jasmineDone: function() {
|
||||
return new Promise<void>(function(resolve, reject) {
|
||||
setTimeout(() => resolve(), 10000);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var jasmineDoneResolved: Promise<void> = myShortReporter.jasmineDone();
|
||||
jasmineDoneResolved.then(() => {
|
||||
console.log("[ShortReporter] : jasmineDone Resolved");
|
||||
});
|
||||
|
||||
jasmine.getEnv().addReporter(myShortReporter);
|
||||
|
||||
describe("Randomize Tests", function() {
|
||||
it("should allow randomization of the order of tests", function() {
|
||||
expect(function() {
|
||||
|
||||
Reference in New Issue
Block a user