Skip to content
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

Merged
merged 35 commits into from
Apr 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
c923faf
Move basic_monorepo to fixtures
mehulkar Apr 10, 2023
f0cb17a
Move composable config test repo to fixtures
mehulkar Apr 10, 2023
d141c7e
move inputs test fixture to fixtures
mehulkar Apr 10, 2023
137f9ad
invalid turbo json fixture
mehulkar Apr 10, 2023
a4072d8
lockfile aware caching
mehulkar Apr 10, 2023
847f9b4
monorepo_one_script_error
mehulkar Apr 10, 2023
16a3e4b
persistent deps fixtures
mehulkar Apr 10, 2023
cef7d6e
monorepo with root dep fixture
mehulkar Apr 10, 2023
bb65a8e
run logging fixture
mehulkar Apr 10, 2023
c458cc6
single package fixture
mehulkar Apr 10, 2023
b7ee6b5
single package deps fixture
mehulkar Apr 10, 2023
86e58ee
single package no config fixture
mehulkar Apr 10, 2023
c960bee
strict env vars fixture
mehulkar Apr 10, 2023
bf795ca
Task dependencies fixtures
mehulkar Apr 10, 2023
3fe4a22
Move find_turbo fixtures to fixtures
mehulkar Apr 10, 2023
80e8c5e
Move inference fixtures
mehulkar Apr 10, 2023
1a5502e
Move all basic_monorepo tests to top level tests, the folder didn't r…
mehulkar Apr 10, 2023
7f8deba
Make setup_monorepo script take other fixture names
mehulkar Apr 10, 2023
a63bd64
Make excluded inputs test follow the same pattern as others
mehulkar Apr 10, 2023
2968563
add readme for integration tests
mehulkar Apr 10, 2023
222bf4a
move task-dependencies tests to root dir
mehulkar Apr 10, 2023
853d89b
run logging to root dir
mehulkar Apr 10, 2023
454bafc
one script error
mehulkar Apr 10, 2023
68e29a6
Move main setup.sh script into _helpers directory
mehulkar Apr 10, 2023
416b8b8
Move setup_monorepo script to _helpers
mehulkar Apr 10, 2023
af87f76
Move run summary utils script to helpers
mehulkar Apr 10, 2023
9ddfa40
Move setup_git.sh to helpers
mehulkar Apr 10, 2023
1e1e8b4
Add ability to update package manager in setup script
mehulkar Apr 10, 2023
5358a0d
Group all single_package tests in same dir and delete duplicate setup…
mehulkar Apr 10, 2023
8d93eb6
move back into subdir
mehulkar Apr 10, 2023
bb5d1ef
Use helper and rm duplicate script for composable config
mehulkar Apr 10, 2023
e4c8d90
Remove dupe script for invalid turbojson
mehulkar Apr 10, 2023
62d335c
remove dupe script in persistent deps tests
mehulkar Apr 10, 2023
07b191d
rm dupe script for prune
mehulkar Apr 10, 2023
0d65b85
Move another helper script to _helpers
mehulkar Apr 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
47 changes: 47 additions & 0 deletions cli/integration_tests/README.md
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `setup.sh` sets a `TURBO` environment variable that points to the locally built binary
- `setup.sh` sets a `TURBO` environment variable that points to the locally built binary.

Sorry tiniest nit

Copy link
Contributor Author

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

- `setup_monorepo.sh` uses one of the test repos in the `_fixtures` directory to exercise
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you set a specific fixture?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call. You send another argument like so:

$ . ${TESTDIR}/_helpers/setup_monorepo.sh $(pwd) single_package

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)
Loading