Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed unused code in mini reporter #1169

Merged

Conversation

jarlehansen
Copy link
Contributor

@jarlehansen jarlehansen commented Jan 4, 2017

This PR increases code coverage #161 in mini-reporter by removing unused code and added a new test to verify the behaviour.
The removed if-statement seems to be unnecessary because the same value is check in the beginning of the function.

@jarlehansen jarlehansen changed the title Removed unused code and added test to verify behaviour #161 Removed unused code and added test to verify behaviour Jan 4, 2017
@jarlehansen jarlehansen changed the title Removed unused code and added test to verify behaviour Removed unused code in mini reporter and added test to verify behaviour Jan 4, 2017
Copy link
Contributor

@vadimdemedes vadimdemedes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

var reporter = miniReporter();
reporter.failCount = 2;

var err1 = new Error('failure one');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just err?

compareLineOutput.SKIP_UNTIL_EMPTY_LINE,
'',
''
].concat(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

=> .concat(expectedStack.split('\n'))

var output = reporter.finish(runStatus);

var expectedStack = colors.error(' failure two\n') + colors.errorStack('stack line with trailing whitespace');
expectedStack = expectedStack.split('\n');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this and see comment below.

err1.stack = beautifyStack(err1.stack);

var runStatus = {
errors: [{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be:

errors: [
  {title: 'failed one', error: err},
  {title: 'failed two'}
]

@jarlehansen jarlehansen force-pushed the improve-coverage-mini-reporter branch from 37b46e4 to d78f63c Compare January 4, 2017 20:58
@jarlehansen
Copy link
Contributor Author

@vadimdemedes all good suggestions for improvements, I have updated the pull request.
Thanks!

@vadimdemedes vadimdemedes merged commit c84694b into avajs:master Jan 5, 2017
@vadimdemedes
Copy link
Contributor

Thank you, @jarlehansen!

@vadimdemedes vadimdemedes changed the title Removed unused code in mini reporter and added test to verify behaviour Removed unused code in mini reporter Jan 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants