Skip to content

Commit

Permalink
fix(reporter): report event order (#2311)
Browse files Browse the repository at this point in the history
Report `onAllMutantsTested` before `onMutationTestReportReady`
  • Loading branch information
nicojs authored Jul 10, 2020
1 parent 8bd634b commit ceb73a8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/core/src/reporters/MutationTestReportHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ export class MutationTestReportHelper {

public reportAll(results: MutantResult[]) {
const report = this.mutationTestReport(results);
this.reporter.onMutationTestReportReady(report);
this.reporter.onAllMutantsTested(results);
this.reporter.onMutationTestReportReady(report);
this.determineExitCode(report);
}

Expand Down
10 changes: 10 additions & 0 deletions packages/core/test/unit/reporters/MutationTestReportHelper.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ describe(MutationTestReportHelper.name, () => {
expect(reporterMock.onMutationTestReportReady).calledOnce;
});

it('should report "onAllMutantsTested"', () => {
sut.reportAll([]);
expect(reporterMock.onAllMutantsTested).calledOnce;
});

it('should report "onAllMutantsTested" before mutationTestReportReady', () => {
sut.reportAll([]);
expect(reporterMock.onAllMutantsTested).calledBefore(reporterMock.onMutationTestReportReady);
});

it('should copy thresholds', () => {
const actualReport = actReportAll();
expect(actualReport.thresholds).eq(testInjector.options.thresholds);
Expand Down

0 comments on commit ceb73a8

Please sign in to comment.