-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Move files argument to api.run()
#536
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
Conversation
|
By analyzing the blame information on this pull request, we identified @novemberborn, @ariporad and @jokeyrhyme to be potential reviewers |
|
Sadly this breaks
|
|
Exporting Some more exploration/updates: This makes the watcher work:
exports.start = function (logger, api, files, excludePatterns, sources, stdin) {
var isTest = makeTestMatcher(files, excludePatterns);
var patterns = getChokidarPatterns(sources, files);
...
}
var files = cli.input.length ? cli.input : arrify(conf.files);
if (files.length === 0) {
files = [
'test.js',
'test-*.js',
'test'
];
}
var excludePatterns = [
'!**/node_modules/**',
'!**/fixtures/**',
'!**/helpers/**'
];
...
watcher.start(logger, api, files, excludePatterns, arrify(cli.flags.source), process.stdin);Again, just exploring/messing around. It "works" but the tests for watcher still fail. Will look into it this night. |
Those patterns where hidden away inside a function before
Yup that should do it. Just need to provide compatible values in https://github.com/sindresorhus/ava/blob/bdb8b6ebaa05f1dc31cdab7c84aed7d92317b8ed/test/watcher.js#L23 and https://github.com/sindresorhus/ava/blob/bdb8b6ebaa05f1dc31cdab7c84aed7d92317b8ed/test/watcher.js#L95. |
|
In files = [
'test.js',
'test-*.js',
'test'
];
excludePatterns = [
'!**/node_modules/**',
'!**/fixtures/**',
'!**/helpers/**'
];
...
var start = function (sources) {
subject.start(logger, api, files, excludePatterns, sources || [], stdin);
};Under the "Chokidar is installed tests" I get |
|
@sotojuan hard to say. Could you push some code so I can debug it here? |
|
Done, let me know if you can help! |
|
@sotojuan just had to declare the variables and update more |
|
I think you should keep the default Still need to resolve whether we always want to prefix test titles (even if there's only a single test file) or only when tests are rerun via the watcher. How about making it an option on the API itself, and if |
Sure, that makes sense.
Also makes sense to me, doesn't seem that hard to implement. I'm interested in what the other mantainers think though. If they're on board with it, I'll work on it tonight. // @sindresorhus @jamestalmage @vdemedes |
|
👍 Sounds good. I would still want minimal output in non-watch mode. |
|
All right, I think I got it but I feel like I am missing something. Let me know! |
api.js
Outdated
| this[key] = this[key].bind(this); | ||
| }, this); | ||
|
|
||
| this._reset(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you look at the overall diff you'll see that these lines were moved above this.excludePatterns. Would be nice to leave them undisturbed.
Getting close! The code is now doing a little bit of the old behavior, and a little bit of the new behavior.
|
|
Okay, I'll give these a shot throughout the day. One thing I am confused about though, look at this test. Supposedly it's testing for prefixes, but it's a single file, so it fails with the changes since by default there's no explicit titles for just one file. Should I update the test so it sets the It's the same case with a couple of the tests in |
Yes.
Push away! :) |
|
Builds and tests pass fine in my Macbook, not sure what's up with AppVeyor. |
test/watcher.js
Outdated
|
|
||
| try { | ||
| subject.start({}, {files: [], excludePatterns: []}, []); | ||
| subject.start({}, {}, [], []); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice to keep {exludePatterns: []} here, even though the test doesn't fail without it.
|
OK, well for now I fixed all the small stuff. Like I mentioned earlier, the test for I'm not very experienced with conflicts so any instructions on how to deal with that would be great! |
Yes but if you check the full diff you'll notice you added those prefixes in this PR ;-) |
test/watcher.js
Outdated
| '!**/node_modules/**', | ||
| '!**/fixtures/**', | ||
| '!**/helpers/**' | ||
| ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to remove this now.
https://help.github.com/articles/resolving-a-merge-conflict-from-the-command-line/ may help. This will pull in the new watcher test in |
Haha I totally forgot I did that! It's been a while! |
|
@novemberborn When you are not busy, can you review? Thanks! |
Oh didn't notice you fixed the merge conflict. Next time ping me more explicitly when you've updated the PR 😄 The watcher test in |
|
LGTM otherwise. |
|
Thanks, um should I just copy what's in that commit you linked me to or is that something that will be merged? |
|
@sotojuan copy yea. It only lives within my fork :) |
|
@sotojuan are you running all tests? |
|
I had some stuff I hadn't merged with master yet, should be good now. |
|
Phew, all green on Travis (AppVeyor will take longer), finally! |
|
Great! |
|
LGTM |
|
LGTM! |
|
Thanks @sotojuan! |
|
Thank you @sotojuan! Good work as usual. |
This fixes #534. Of course, it requires everyone to be on board with the idea of moving
filestoapi.run()instead of the constructor. In case everyone agrees, then this should help. Let me know if I missed anything.