-
Notifications
You must be signed in to change notification settings - Fork 19
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
support workdir in matcher.FileMatcher{} #155
Conversation
Hey @dylanhitt! The |
Hey @SimonBaeumer You're right that it is expected behaviour IF we are net setting the workdir in a tests config see. An example: Imagine we are at the root of the project and I run the command it should match file output:
command: printf "line one\nline two"
config:
dir: examples/
stdout:
file: _fixtures/output.txt As the it should match file output:
command: printf "line one\nline two"
config:
dir: examples/
stdout:
file: _fixtures/output.txt
test2:
command: echo "hello" > testfile.txt
config:
dir: examples/
stdout:
file: _fixtures/output.txt the first test will still fail, while the second would create a file in I looked into just using |
Ahh okay!
It is a good point regarding the race condition of This solve your issue with file assertions in the given use case. WDYT? |
Hmm, Alright, and I'm fine with |
If the working dir is changed I would assume that everything is relative to the |
Got it. Let's close this, and I'll open a PR tonight for What do you think about supporting a type TestCommand struct {
testPath string
out output.OutputWriter
ctx TestCommandContext
// some other things
} This would allows for a |
I am looking forward for your PR! btw travis looks like it has some problems with their job backlog ... |
Fixes #153
Hey @SimonBaeumer,
I found a bit of what I consider a bug today with
file
assertion. Currently we aren't respecting the working directory for opening files. I opened this quick fix, for right now. If you could take a look that would be great.I'm currently working on adding a
--workdir
flag soworkdir
can be set from the command line as well. This is a little bit more involved than I thought. I plan to rewriteruntime.Validate
to get theMatcher
a bit easier, rather than having passtest.Command.Dir
through multiplefunctions
. I also plan on manipulatingtest_command.go
, to make passing command line args a bit easier.I'll probably be opening the branch off of this one, since I don't quite know my timeline on what I mentioned above. I mainly just wanted to get this fix in.
Cheers
Checklist
Linux
,Windows
andmacOS
?