shepherd
shepherd copied to clipboard
chore: Adds cli test infra to enabling testing bin invocation
This PR adds basic bootstrapping of infra that will allow for CLI tests that directly invoke the bin. This can provide a path to end to end tests that will perform a complete migration.
Added:
-
execa
devDependency for invoking the CLI (I know this project uses child-process, but I've found execa to be really nice for this use case. Happy to discuss whether or not to add this) -
fixturify-project
devDependency for building out ad-hoc migration project directories - A simple example of a cli test using a
shepherd
util that maps to the bin script, and tests the usage information is correctly printed
The tests are in the standard __tests__
jest directory, mainly because I wasn't sure where to add tests that weren't specifically unit tests (I suppose they could live next to the file itself, as the other tests do).
TODO
- [ ] Add a fixturify project subclass to provide utilities for adding a
shepherd.yml
to the migration directory - [ ] Add the ability to mimic repos to migrate (separate fixturify project directories?)
- [ ] Add end to end example of testing a migration, from repo checkout to pr creation
- [ ] Exploring using something like https://mswjs.io/ to provide adapter mocking.