这是indexloc提供的服务,不要输入任何密码
Skip to content

Move main logic from bin file #9

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

Merged
merged 5 commits into from
Oct 9, 2016

Conversation

infernalmaster
Copy link

I want to use this plugin with https://github.com/infernalmaster/karma-tap-pretty-reporter. So I did some code separation (just like https://github.com/substack/faucet is made)

Copy link
Owner

@namuol namuol left a comment

Choose a reason for hiding this comment

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

This feels a little awkward:

import tapDifflet from 'tap-difflet';

const reporter = tapDifflet({
  '--pessimistic': true,
});

More likely we'd probably want to do something like this:

import tapDifflet from 'tap-difflet';

const reporter = tapDifflet({
  pessimistic: true,
});

With that change to the API and some documentation of the API in the README I'd love to merge this. 👍 💯

Copy link
Owner

@namuol namuol left a comment

Choose a reason for hiding this comment

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

Thanks for the changes! Just two more minor changes and I'll get this merged and push it to a new version. 🚀

It also can be used inside node code

~~~ text
import tapDifflet from 'tap-difflet';
Copy link
Owner

Choose a reason for hiding this comment

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

I used ES6 stuff in my example before, but we should probably use node-friendly syntax here instead:

var tapDifflet = require('tap-difflet');

var formatter = tapDifflet({
  pessimistic: true // Only output failed tests. `false` by default.
});

I also added a small comment to clarify the usage inline.

@@ -191,5 +191,7 @@ module.exports = function (options) {

});

dup.errors = errors;
Copy link
Owner

@namuol namuol Oct 9, 2016

Choose a reason for hiding this comment

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

Since this isn't officially part of the API, let's change this to dup.__errors = errors (and reflect the name change in the CLI code, too).

@@ -23,10 +23,10 @@ Options:
It also can be used inside node code

~~~ text
import tapDifflet from 'tap-difflet';
var tapDifflet = require('tap-difflet');

const formatter = tapDifflet({
Copy link
Owner

Choose a reason for hiding this comment

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

Teeny change: Let's use var here for consistency. Thanks!

Copy link
Author

Choose a reason for hiding this comment

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

done)

Copy link
Owner

@namuol namuol left a comment

Choose a reason for hiding this comment

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

LGTM -- thanks for the contribution!

@namuol namuol merged commit 22b7aa5 into namuol:master Oct 9, 2016
@namuol
Copy link
Owner

namuol commented Oct 9, 2016

Your code is now in 0.7.0 and can be installed via npm. 👍 Thanks again!

@infernalmaster
Copy link
Author

Thank you too for your fast replies and advices about code improvement👍

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