Skip to content

Commit 116efe5

Browse files
authored
update docs: when incremental compilation is used, integration tests are preferred (#4336)
<!-- Reference any GitHub issues resolved by this PR --> Closes #3567 ## Introduced changes <!-- A brief description of the changes --> - ## Checklist <!-- Make sure all of these are complete --> - [x] Linked relevant issue - [x] Updated relevant documentation - [ ] Added relevant tests - [ ] Performed self-review of the code - [ ] Added changes to `CHANGELOG.md`
1 parent 7086c7e commit 116efe5

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

docs/src/testing/running-tests.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,13 @@ Tests: 1 passed, 0 failed, 0 ignored, other filtered out
7777
</details>
7878
<br>
7979

80+
## Speeding Up Test Compilation
81+
82+
For best cache reuse across repeat runs, prefer the **integration test layout** (`tests/`) over unit tests in `src/`.
83+
84+
Thanks to Scarb's [incremental compilation](https://docs.swmansion.com/scarb/docs/procedural-macros/incremental.html) (enabled by default), the main package and the test code are cached separately, so editing tests does not invalidate the main package's build cache.
85+
For details on the layout difference, see [Test Collection](test-collection.md).
86+
8087
## Skipping tests
8188

8289
You can use the `--skip` flag to exclude tests matching a specified filter pattern.

docs/src/testing/test-collection.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ mod tests {
5757

5858
### Integration Tests
5959

60+
> 📝 **Note**
61+
>
62+
> Thanks to Scarb's [incremental compilation](https://docs.swmansion.com/scarb/docs/procedural-macros/incremental.html) (enabled by default),
63+
> the integration test layout usually recompiles faster than the unit test layout.
64+
>
65+
> The main package and the test code are cached separately, so editing tests does not invalidate the main package's build cache.
66+
67+
6068
Integration tests are placed in `tests` directory.
6169
This directory is a special directory in Scarb.
6270
Tests do not have to be wrapped in `#[cfg(test)]` and each file is treated as a separate module.

0 commit comments

Comments
 (0)