As the implementer of this extension to the list of default filenames I feel embarrassed that I didn't test this out sooner, but if you see this repo it follows the convention in my project. Unfortunately, running the tests (after npm install) you'll get:
1 exception
โ Couldn't find any files to test
The project has the following structure:
~/Desktop/ava-bug-test-filename-conventions (master)
๐พ $ tree -I node_modules
.
โโโ package.json
โโโ public
โโโ js
โโโ __tests__
โโโ thing.js
3 directories, 2 files
Am I doing something wrong or is there a bug here?
I've updated the project to demonstrate some other patterns that I expect should work but don't. Here's the structure now:
~/Desktop/ava-bug-test-filename-conventions (master)
๐พ $ tree -I node_modules
.
โโโ package.json
โโโ public
โย ย โโโ js
โย ย โย ย โโโ __tests__
โย ย โย ย โโโ thing.js
โย ย โโโ test-thing.js
โย ย โโโ thing.test.js
โโโ test
โย ย โโโ thing.js
โโโ test-thing.js
โโโ test.js
4 directories, 7 files
And here's the output (with --verbose):
~/Desktop/ava-bug-test-filename-conventions (master)
๐พ $ npm t
โ test โบ works
โ thing โบ works
โ test โบ thing โบ works
3 tests passed [14:07:15]
I would expect the other tests to run and the output to be more like:
~/Desktop/ava-bug-test-filename-conventions (master)
๐พ $ npm t
โ test โบ works
โ thing โบ works
โ test โบ thing โบ works
โ public โบ thing โบ works
โ public โบ thing.test โบ works
โ public โบ js โบ __tests__ โบ thing โบ works
6 tests passed [14:07:15]
Or something like that. Am I missing something?
Hmm. That's a bummer.
Can you open a PR, with a fixture directory, and a failing unit test for ava-files.
We didn't have a good example to follow when you implemented this, but there's one there now (the one about duplicates)
this is the problem I believe https://github.com/avajs/ava/blob/master/cli.js#L168, beacuse of that line this https://github.com/avajs/ava/blob/master/lib/ava-files.js#L34 never gets a chance to work
Those defaults should just be removed from cli.js there's no point in having two places with default files
@nfcampos is correct. Removing that from the CLI in my local node_modules fixes the issue and my output is like this:
~/Desktop/ava-bug-test-filename-conventions (master)
๐พ $ npm t
โ test โบ works
โ public โบ js โบ thing โบ works
โ thing โบ works
โ test โบ thing โบ works
โ public โบ thing โบ works
5 tests passed [14:18:04]
(Note, I was incorrect in what I expected before, this is now correct).
Haha, sorry, another update. I changed the test names to make things easier. Here's the output that I get (after removing the lines that @nfcampos mentions):
~/Desktop/ava-bug-test-filename-conventions (master)
๐พ $ npm t
โ test โบ test.js
โ public โบ thing โบ public/thing.test.js
โ thing โบ test-thing.js
โ public โบ js โบ thing โบ public/js/__tests__/thing.js
โ test โบ thing โบ test/thing.js
5 tests passed [14:20:44]
Comparing it to the project tree:
~/Desktop/ava-bug-test-filename-conventions (master)
๐พ $ tree -I node_modules
.
โโโ package.json
โโโ public
โย ย โโโ js
โย ย โย ย โโโ __tests__
โย ย โย ย โโโ thing.js
โย ย โโโ test-thing.js
โย ย โโโ thing.test.js
โโโ test
โย ย โโโ thing.js
โโโ test-thing.js
โโโ test.js
4 directories, 7 files
You can see that public/test-thing.js is not present in the output. I'm guessing that was never supported and is not actually the expectation after all...
I'll try to file a PR to remove those lines from the CLI and see if I can get a test working. Thanks!
@kentcdodds public/test-thing.js not being in the output is because the default pattern that deals with test-*.js only finds files in the top level directory
Published in 0.15.1