Skip to content

fix(cli): Remove default files from CLI #876

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

Closed

Conversation

kentcdodds
Copy link
Contributor

WIP: Not sure where to put tests/how to test this.

@kentcdodds
Copy link
Contributor Author

I hope this could be patch-released soonish because the feature was advertized as part of the most recent release but does not actually work :-/

@jamestalmage
Copy link
Contributor

Yes. I want to land this ASAP (i.e. add some tests then let's publish).

Here is the test from ava-files I was thinking you should replicate: https://github.com/avajs/ava/blob/master/test/ava-files.js#L99-L106

Also, see these tests. Those launch a new process for the CLI (which in turn launches test processes), so they aren't fast tests. We could do one or two just to verify it's all glued together correctly, but we should build up a more thorough set of faster tests that fully exercise ava-files directly.

For now, let's just land one of each and ship a patch release.

@kentcdodds kentcdodds force-pushed the pr/remove-default-from-cli branch from 9c88f3a to ce6a22d Compare May 25, 2016 21:10
@kentcdodds
Copy link
Contributor Author

I updated with one test. I think it's pretty solid. Let me know if you want an integration test with the CLI as well.

@kentcdodds kentcdodds force-pushed the pr/remove-default-from-cli branch from ce6a22d to 79d6104 Compare May 25, 2016 21:19
@jamestalmage
Copy link
Contributor

Linter errors!

@kentcdodds
Copy link
Contributor Author

How embarrassing!

The default files should be in one place (`ava-files.js`).
Right now the defaults provided in `ava-files.js` aren't being used
because the CLI pre-populates them.

Closes avajs#875
@kentcdodds kentcdodds force-pushed the pr/remove-default-from-cli branch from 79d6104 to 4e22ee1 Compare May 25, 2016 21:30
@kentcdodds
Copy link
Contributor Author

Fixed!

@@ -104,3 +104,29 @@ test('findFiles - does not return duplicates of the same file', function (t) {
t.end();
});
});

test('findFiles - finds the correct files by default', function (t) {
var avaFiles = new AvaFiles(['**/ava-files/default-patterns/**']);
Copy link
Contributor

Choose a reason for hiding this comment

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

Argh. I'm realizing this is actually kinda hard to test.

This will actually find every file in the default-patterns folder.

Instead of this argument, can you just process.chdir() to the default-patterns folder, and drop the constructor argument?

You are technically overriding the default here.

#863 introduce cwd and resolveTestsFrom options, that would make this doable without changing the directory.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, you should sprinkle in a few files that should NOT be found (and ensure they are not).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can do that. Unfortunately I've run out of time. Someone can feel free to branch off of my branch and make the improvements in another PR if it needs to be fixed sooner than I can get to it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry Kent,
I see why you did it this way - It's exactly like the test I told you to copy. I'm updating your PR now. Expect a new PR and release soon.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. It's family time for me now. Sorry I didn't quite get to it.

@kentcdodds
Copy link
Contributor Author

I'm not sure what's wrong with the windows build. It does look my test is causing the issue, but I'm not sure why...

avaFiles.findTestFiles().then(function (files) {
var allFilesFound = filesToFind.every(function (fileToFind) {
return files.some(function (file) {
return endsWith(file, fileToFind);
Copy link
Contributor

Choose a reason for hiding this comment

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

Use slash to convert the results from \ results, to / results (I think).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

jamestalmage added a commit to jamestalmage/ava that referenced this pull request May 25, 2016
@jamestalmage
Copy link
Contributor

Closing in favor of #878

Thanks @kentcdodds

jamestalmage added a commit that referenced this pull request May 25, 2016
* fix(cli): Remove default files from CLI

The default files should be in one place (`ava-files.js`).
Right now the defaults provided in `ava-files.js` aren't being used
because the CLI pre-populates them.

Closes #875

* Fixup #876
@kentcdodds kentcdodds deleted the pr/remove-default-from-cli branch May 26, 2016 04:23
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