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

CLI - add support for multiple files or a folder #35

Closed
lukaszmn opened this issue Feb 9, 2020 · 4 comments
Closed

CLI - add support for multiple files or a folder #35

lukaszmn opened this issue Feb 9, 2020 · 4 comments
Assignees
Labels
enhancement New feature or request WIP Issues with a proposed solution, not ready to merge

Comments

@lukaszmn
Copy link
Contributor

lukaszmn commented Feb 9, 2020

Currently, one has to provide path to a single test JS file. Can we enhance it to accept either: a pattern (like *test.js) or a folder with test files (like tests/)?

@shikaan
Copy link
Owner

shikaan commented Feb 9, 2020

Yes, we can and we should to be honest.

As you can see by the code itself, once we manage to feed the application with a list of file paths, we are pretty much sorted.

I started playing with the idea of writing a simple glob parser long time ago (pretty much around latest commits on this project), but then eventually I gave up because of other things. I might still have the branch with some scrap-away code somewhere...

The obvious alternative would be using an external library for that (such as node-glob), which is ready made, reliable and tested. It would clash a bit with the zero-dependency idea behind the project, but it's a viable compromise if there is a real need for this framework out there

Thanks again for your contribution

@lukaszmn
Copy link
Contributor Author

lukaszmn commented Feb 9, 2020

I also like the idea of zero dependencies, so maybe a very simple parser would be enough? As I said, passing a folder with test files without any patterns might be ideal for some scenarios, at least at the beginning.

By the way, I see that the test npm command calls titef for a folder: titef ./test and I believe it has worked for you. However, it errors in my env (Win 10, Node 10.16.2):

> Executing task: npm run test <


> titef@ test C:\tmp\titef
> node ./bin/titef.js ./test

internal/modules/cjs/loader.js:638
    throw err;
    ^

Error: Cannot find module 'C:\tmp\titef\test'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)

@shikaan
Copy link
Owner

shikaan commented Feb 22, 2020

Hey @lukaszmn,
I have jotted down a very simple solution for this problem which might be okay for a good chunk of use cases. Not perfect yet, but probably a nice first iteration.

You can take a look at #39

Thanks!

@shikaan shikaan added enhancement New feature or request WIP Issues with a proposed solution, not ready to merge labels Feb 24, 2020
@shikaan shikaan self-assigned this Feb 24, 2020
@shikaan
Copy link
Owner

shikaan commented Mar 7, 2020

Closed because of #39

@shikaan shikaan closed this as completed Mar 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request WIP Issues with a proposed solution, not ready to merge
Projects
None yet
Development

No branches or pull requests

2 participants