Skip to content

Commit

Permalink
feat(ProgressReporter): add new line after report (#193)
Browse files Browse the repository at this point in the history
* Add IntelliJ project files to gitignore
* feat(ProgressReporter): add new line after report
  • Loading branch information
Kattoor authored and nicojs committed Dec 27, 2016
1 parent da99041 commit 931c35f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ typings
src/**/*.js
test/**/*.js
src/**/*.d.ts
test/**/*.d.ts
test/**/*.d.ts
.idea
*.iml
5 changes: 5 additions & 0 deletions src/reporters/ProgressReporter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {Reporter, MutantResult, MutantStatus} from 'stryker-api/report';
import * as chalk from 'chalk';
import * as os from 'os';

export default class ProgressReporter implements Reporter {
onMutantTested(result: MutantResult) {
Expand All @@ -23,4 +24,8 @@ export default class ProgressReporter implements Reporter {
}
process.stdout.write(toLog);
}

onAllMutantsTested(): void {
process.stdout.write(os.EOL);
}
}
18 changes: 12 additions & 6 deletions test/unit/reporters/ProgressReporterSpec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as sinon from 'sinon';
import {MutantStatus, MutantResult} from 'stryker-api/report';
import {expect} from 'chai';
import * as chalk from 'chalk';
import * as os from 'os';

describe('ProgressReporter', () => {

Expand All @@ -22,35 +23,40 @@ describe('ProgressReporter', () => {
beforeEach(() => {
sut.onMutantTested(mutantResult(MutantStatus.Killed));
});

it('should log "."', () => {
expect(process.stdout.write).to.have.been.calledWith('.');
});
});

describe('when status is TIMEDOUT', () => {

beforeEach(() => {
sut.onMutantTested(mutantResult(MutantStatus.TimedOut));
});

it('should log "T"', () => {
expect(process.stdout.write).to.have.been.calledWith(chalk.yellow('T'));
});
});

describe('when status is SURVIVED', () => {

beforeEach(() => {
sut.onMutantTested(mutantResult(MutantStatus.Survived));
});

it('should log "S"', () => {
expect(process.stdout.write).to.have.been.calledWith(chalk.bold.red('S'));
});
});
});


describe('onAllMutantsTested()', () => {
it('should write a new line', () => {
sut.onAllMutantsTested();
expect(process.stdout.write).to.have.been.calledWith(os.EOL);
});
});

afterEach(() => {
Expand Down

0 comments on commit 931c35f

Please sign in to comment.