-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Improve integration test setup #4512
Changes from all commits
c923faf
f0cb17a
d141c7e
137f9ad
a4072d8
847f9b4
16a3e4b
cef7d6e
bb65a8e
c458cc6
b7ee6b5
86e58ee
c960bee
bf795ca
3fe4a22
80e8c5e
1a5502e
7f8deba
a63bd64
2968563
222bf4a
853d89b
454bafc
68e29a6
416b8b8
af87f76
9ddfa40
1e1e8b4
5358a0d
8d93eb6
bb5d1ef
e4c8d90
62d335c
07b191d
0d65b85
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
## Integration Tests | ||
|
||
The `cli/integration_tests` directory contains tests for Turborepo, exercising builds of | ||
Turborepo against custom monorepos and turbo.json setups. Tests are written using [`prysk`][1], | ||
which executes the CLI and can execute arbitrary other commands to assert the result. Some tests | ||
assert the log output, some assert the created artifacts, some assert configuration, etc etc. | ||
|
||
### Adding new tests | ||
|
||
To add a new test to this directory, create a `my-new-test.t` file. You will likely want to | ||
the file to start with: | ||
|
||
```bash | ||
Setup | ||
$ . ${TESTDIR}/setup.sh | ||
$ . ${TESTDIR}/setup_monorepo.sh $(pwd) | ||
``` | ||
|
||
- `setup.sh` sets a `TURBO` environment variable that points to the locally built binary | ||
- `setup_monorepo.sh` uses one of the test repos in the `_fixtures` directory to exercise | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How do you set a specific fixture? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good call. You send another argument like so:
I'll add in examples of this and also how to change the package manager in a new PR so I don't have to wait for tests again with another push here. |
||
the `TURBO` binary against. | ||
|
||
### Fixtures | ||
|
||
For the most part, use the `basic_monorepo`, or `single_package` fixtures to test against. | ||
You can add custom fixture monorepos as an escape hatch or if you truly need a custom monorepo. | ||
|
||
#### Custom turbo.json | ||
|
||
If an existing fixture meets your needs, but you need a custom `turbo.json`, create | ||
a directory for your test (instead of just `my-new-test.t`), add your "local" fixture `turbo.json` | ||
there, and then use `cp` as part the setup before writing your test. For example: | ||
|
||
```bash | ||
Setup | ||
$ . ${TESTDIR}/../setup.sh | ||
$ . ${TESTDIR}/../setup_monorepo.sh $(pwd) | ||
|
||
Custom config | ||
$ cp ${TESTDIR}/myturboconfig.json $(pwd)/turbo.json | ||
$ git commit -am "Update turbo.json" | ||
|
||
Write your tests | ||
... | ||
``` | ||
|
||
(Note that in the example above the paths to `setup.sh` and `setup_monorepo.sh` changed) |
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.
Sorry tiniest nit
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'm all for it. Next PR though because CI is slow