Skip to content

Commit

Permalink
Merge pull request #100 from GannettDigital/issue-73
Browse files Browse the repository at this point in the history
Issue 73: Updated Basic Reporter
  • Loading branch information
scottgunther authored Jun 1, 2018
2 parents 4b7d214 + 3c36b27 commit 7f3045c
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 13 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Pending Version

## 0.5.1

* Tom Dale
* Added action identifier to basic report for test print out errors

## 0.5.0

* Scott Gunther
Expand Down
5 changes: 5 additions & 0 deletions docs/_pages/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ title: 'Release Notes'
toc_label: 'Version Number'
---

## 0.5.1

* Tom Dale
* Added action identifier to basic report for test print out errors

## 0.5.0

* Scott Gunther
Expand Down
5 changes: 5 additions & 0 deletions lib/runner/reporters/basic-reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ module.exports = {
if (report.errorLocation) {
let failedStep = report.actions[report.errorLocation.actionIndex].steps[report.errorLocation.step];
console.log('\n' + failedStep.error.stack);
let failedAction = report.actions[report.errorLocation.actionIndex];
console.log(`\n\x1b[31m` +
`Action: ${failedAction.component}-${failedAction.action} ` +
`\nStep: ${report.errorLocation.step} ` +
`\nActionIndex: ${report.errorLocation.actionIndex}\x1b[0m`);
if (failedStep.stateCompare) {
console.log(failedStep.stateCompare + '\n');
}
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simulato",
"version": "0.5.0",
"version": "0.5.1",
"description": "A model based testing tool",
"main": "index.js",
"bin": {
Expand Down
23 changes: 18 additions & 5 deletions test/unit/lib/runner/reporters/basic-reporter-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ describe('lib/runner/reporters/basic-reporter.js', function() {
},
actions: [
{
component: 'componentName',
action: 'ACTION_NAME',
steps: {
preconditions: {
error: {
Expand Down Expand Up @@ -115,13 +117,24 @@ describe('lib/runner/reporters/basic-reporter.js', function() {
]);
});

it('should call console.log twice', function() {
it('should call console.log to print out the action details', function() {
report.status = 'fail';
delete report.actions[0].steps.preconditions.stateCompare;

basicReporter.printTestResult(report);

expect(console.log.callCount).to.equal(2);
expect(console.log.args[2]).to.deep.equal([
`\n\u001b[31mAction: componentName-ACTION_NAME \nStep: preconditions \nActionIndex: 0\u001b[0m`,
]);
});

it('should call console.log three times', function() {
report.status = 'fail';
delete report.actions[0].steps.preconditions.stateCompare;

basicReporter.printTestResult(report);

expect(console.log.callCount).to.equal(3);
});

describe('if the failedStep has stateCompare', function() {
Expand All @@ -130,17 +143,17 @@ describe('lib/runner/reporters/basic-reporter.js', function() {

basicReporter.printTestResult(report);

expect(console.log.args[2]).to.deep.equal([
expect(console.log.args[3]).to.deep.equal([
`state compare string\n`,
]);
});

it('should call console.log thrice', function() {
it('should call console.log four times', function() {
report.status = 'fail';

basicReporter.printTestResult(report);

expect(console.log.callCount).to.equal(3);
expect(console.log.callCount).to.equal(4);
});
});
});
Expand Down

0 comments on commit 7f3045c

Please sign in to comment.