-
Notifications
You must be signed in to change notification settings - Fork 79
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
Only care about tests/ if no globs given #306
Only care about tests/ if no globs given #306
Conversation
We run our tests via `elm-test 'frontend/**/*Tests.elm'` as our app is a big monorepo and we don't want our Elm tests in the top level `tests` directory. However, doing this gives us an error that the `tests/` folder doesn't exist. I updated the code to only check for and use `tests/` if not given a glob.
This is interesting! One of my design goals with That said, I've heard a few times that the hard requirement creates problems for people incrementally adopting Elm in existing applications. Something we've talked about as a long-term goal is integrating However, that concern only applies to packages, not applications. So here's how I'd like to proceed:
Thoughts? |
Agree that this is good for applications and less good for packages 👍
The goal of this PR is to not do this - the goal of this PR is that
Agree with this. For a package you have complete control of the repo and so this requirement makes sense. I will update the PR - thanks for your thoughts! |
I am wrong! This changed the behaviour I think of running just |
Yeah, so I think the goal should be:
I think that should do the trick! |
I quite like the original idea, why the need for a |
@rtfeldman I think I've now updated the code here to work as you explained it above. Let me know what you think! |
lib/elm-test.js
Outdated
@@ -302,15 +302,15 @@ if (args._[0] === "make") { | |||
? 'No tests found for the file pattern "' + | |||
fileGlobs.toString() + | |||
'"\n\nMaybe try running elm-test with no arguments?' | |||
: "No tests found in the tests/ directory.\n\nNOTE: Make sure you're running elm-test from your project's root directory, where its elm.json lives.\n\nTo generate some initial tests to get things going, run elm-test init"; | |||
: "No tests found in the tests/ directory.\n\nNOTE: Make sure you're running elm-test from your project's root directory, where its elm.json lives.\n\nTo generate some initial tests to get things going, run elm-test init.\n\nAlternatively, if you have tests in a different directory, try calling elm-test with a glob: elm-test 'frontend-app/**/*Tests.elm'."; |
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.
Maybe say "Alternatively, if your application has tests"
instead? This advice won't work if they are working on a package!
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.
Nice idea - updated 👍
It's very easy to add flexibility and very painful to take it away once people have come to rely on it. In the application case there are different design constraints, in that people may not have total control over their directory structures. In the package case, they do. So I'm convinced that "I am going to have a really hard time using However, I don't feel confident I grasp the full implications of that choice for packages. The consequences of making that change are serious; if I add the flexibility and then end up having to take it away, I will have caused a lot of pain by saying yes right now. That's why I want to leave packages as-is. I hear you that removing the |
Co-Authored-By: jackfranklin <[email protected]>
@rtfeldman nice comments, thank you! Updated the PR :) |
lib/elm-test.js
Outdated
@@ -302,15 +302,15 @@ if (args._[0] === "make") { | |||
? 'No tests found for the file pattern "' + | |||
fileGlobs.toString() + | |||
'"\n\nMaybe try running elm-test with no arguments?' | |||
: "No tests found in the tests/ directory.\n\nNOTE: Make sure you're running elm-test from your project's root directory, where its elm.json lives.\n\nTo generate some initial tests to get things going, run elm-test init"; | |||
: "No tests found in the tests/ directory.\n\nNOTE: Make sure you're running elm-test from your project's root directory, where its elm.json lives.\n\nTo generate some initial tests to get things going, run elm-test init.\n\nAlternatively, if your application has tests in a different directory, try calling elm-test with a glob: elm-test 'frontend-app/**/*Tests.elm'."; |
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.
I know you say "your application" but I think we should hide this when testing a package. (It's possible the surrounding code already does that.)
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.
I don't think it does, but that seems like a good idea. 👍
I'm assuming this is what you had in mind @mgold; I'm gonna merge so people can try |
Yup! |
We run our tests via
elm-test 'frontend/**/*Tests.elm'
as our app is abig monorepo and we don't want our Elm tests in the top level
tests
directory.
However, doing this gives us an error that the
tests/
folder doesn'texist. I updated the code to only check for and use
tests/
if notgiven a glob.
@rtfeldman let me know what you think!