Hi everyone, we are currently adopting pants and r...
# general
Hi everyone, we are currently adopting pants and really enjoy using it even though there are plenty of questions left. I am looking forward to discuss interesting topics here. The first question I have is if there is some kind of "watch" mode for running tests. When unsing
./pants run
the command is watching the filesystem and restarts. Is there something similiar for
./pants test
? I know this from https://nx.dev/packages/jest/executors/jest#watch where you can enter watch mode with
yarn test myapp --watch
and then select a test based on a test name regex pattern (see attached screenshot). Is something like this available? If no watch mode is available, can I filter for a regex name and then select from a list of matches?
๐Ÿ‘‹ 2
Hi! Yes, you run like so:
./pants --loop test โ€ฆ
are the target
for what you want to test. It can be file paths to your test sources, or target addresses etc. Thereโ€™s also a possilibity to filter targets based on tags etc.
./pants --loop --changed-since=main --changed-dependees=transitive test fmt lint check
Changed my life. and it'll change yours too (maybe)
๐Ÿคฉ 3
๐Ÿ‘ 4
๐ŸŽ‰ 2
๐Ÿ”ฅ 2
It is great that this feature exists, but imho how can you write code when what you write is being reformatted? Wouldnโ€™t it intervene with you making changes? I can imagine running tests once in a while, but constant reformatting? ๐Ÿ˜•
I could see that work, but I tend to only run tests in a loop while developing, then check in a loop while fixing type issues..
the goals will only run in sequence if the previous one has passed. So it's not too intrusive as it'll only be reformatted when the tests pass.
forces you to write your failing tests first, and then put the logic to fix it ๐Ÿ˜„
Awesome, that helped a lot! ๐Ÿ˜Š
๐Ÿ‘ 1
@ambitious-actor-36781 that would probably be nice to add to our docs, but I'm not sure where. My first thought is where we introduce `--loop`: https://www.pantsbuild.org/v2.13/docs/goals#running-goals Something short, like a one sentence example. (We don't want to be too distracting & noisy) Thoughts?
FYI our docs are now in-repo ๐ŸŽ‰ so you can preferably submit a PR to change e.g. https://github.com/pantsbuild/pants/blob/main/docs/markdown/Using%20Pants/concepts/goals.md, or you can still use "Suggest Edits" in the top right corner of Readme.com and a Pants maintainer will convert that to a PR for you