This repository has been archived by the owner on Feb 17, 2024. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR sets up the infrastructure for integrations tests which exercise the main timecraft program, and
I moved the files from
internal/cmd
back into the top-level directory because I couldn't test the command by invokingcmd.Root
because in some error cases the function callsos.Exit
which is not permitted during a Go test, moving the tests exercising a compiled binary tointernal/cmd
did not feel right, and keeping the source and tests close seems like a better setup. We can move the sources back later if we address theos.Exit
calls. Note that all the symbols are unexported and in themain
package, so they cannot be imported by external Go packages.I added tests for some of the commands but the test suite is not complete. It is already taking close to 1s to run, I believe this is likely due to recompiling the test wasm program in each test invoking
timecraft run
, I'll look into leveraging the caching capabilities of wazero to speed this up.I made a few other changes as well, most are consistency and usability fixes that were highlighted by the test suite. I also added a
--quiet
option to simplify the text output to a single column of IDs, which is useful to implement script-like operations in tests that involve multiple invocations of the timecraft command.