Commit e1fa468
authored
test: Improve test stability with TestResource class (#32)
### **User description**
- Created a reusable TestResource class for consistent resource
management
- Provides isolated filesystem and database resources for all tests
- Added proper cleanup via the disposable pattern
- Implemented resilient assertion patterns to reduce flaky tests
- Enabled parallelized test execution with increased concurrency
---
Notes:
* This PR was written _entirely_ by Claude, only using my voice to
command it.
* The first few commits were via RooCode, the last via
https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/overview
___
### **PR Type**
Tests, Enhancement
___
### **Description**
- Introduced `TestResource` class for consistent test resource
management.
- Provides isolated filesystem and database resources.
- Implements proper cleanup using the disposable pattern.
- Reduces flaky tests with resilient assertion patterns.
- Refactored tests to use `TestResource` for improved stability and
isolation.
- Enabled parallelized test execution with increased concurrency.
- Updated test configurations and added new utility methods for testing.
___
### **Changes walkthrough** 📝
<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Tests</strong></td><td><details><summary>5
files</summary><table>
<tr>
<td><strong>apply.test.tsx</strong><dd><code>Updated test directory
structure for isolation</code>
</dd></td>
<td><a
href="https://github.com/t1mmen/srtd/pull/32/files#diff-b86a1df589c794b641e68687d765ed5aa2dcc3d195afb6a056844b3dca864ce0">+1/-1</a>
</td>
</tr>
<tr>
<td><strong>build.test.tsx</strong><dd><code>Updated test directory
structure for isolation</code>
</dd></td>
<td><a
href="https://github.com/t1mmen/srtd/pull/32/files#diff-f82cace99bc6ced0d2a9bee725156909094b816f9028e9c764a32e5fab243101">+1/-1</a>
</td>
</tr>
<tr>
<td><strong>vitest.setup.ts</strong><dd><code>Adjusted test setup for
resource isolation</code>
</dd></td>
<td><a
href="https://github.com/t1mmen/srtd/pull/32/files#diff-a7231f65284d6b5befab281d02b36ac5f4ca6a6dc3a48c5b1e92fac80f2e485d">+3/-1</a>
</td>
</tr>
<tr>
<td><strong>templateManager.test.ts</strong><dd><code>Refactored tests
to use `TestResource`</code>
</dd></td>
<td><a
href="https://github.com/t1mmen/srtd/pull/32/files#diff-b0a41028136ed13c9f9e762da8548c680144f9a2872ffc91bcc85c547802dcd1">+368/-306</a></td>
</tr>
<tr>
<td><strong>registerTemplate.test.ts</strong><dd><code>Refactored tests
to use `TestResource`</code>
</dd></td>
<td><a
href="https://github.com/t1mmen/srtd/pull/32/files#diff-fd68ada194b1717bd54d8a6e2dda664456514498bb907fbb226738d8806db009">+62/-86</a>
</td>
</tr>
</table></details></td></tr><tr><td><strong>Enhancement</strong></td><td><details><summary>2
files</summary><table>
<tr>
<td><strong>TestResource.ts</strong><dd><code>Added `TestResource` class
for test resource management</code> </dd></td>
<td><a
href="https://github.com/t1mmen/srtd/pull/32/files#diff-c474a92f081031dbfed0785a68937e11a37e65acdff55156fa62cb021d2eb3f3">+326/-0</a>
</td>
</tr>
<tr>
<td><strong>index.ts</strong><dd><code>Exported `TestResource`
utility</code>
</dd></td>
<td><a
href="https://github.com/t1mmen/srtd/pull/32/files#diff-41f83663a32268136dbb7de6f1ba49905ca17137d350c399936dcf4cc6ef3f0d">+1/-0</a>
</td>
</tr>
</table></details></td></tr><tr><td><strong>Configuration
changes</strong></td><td><details><summary>1 files</summary><table>
<tr>
<td><strong>vitest.config.ts</strong><dd><code>Enabled parallelized test
execution</code>
</dd></td>
<td><a
href="https://github.com/t1mmen/srtd/pull/32/files#diff-2ee894bf23aa44ff4ce12a3da8af19ab20180474ebf2176dbe5f2eea3f96dc92">+2/-0</a>
</td>
</tr>
</table></details></td></tr><tr><td><strong>Documentation</strong></td><td><details><summary>1
files</summary><table>
<tr>
<td><strong>big-ads-clean.md</strong><dd><code>Added changeset for test
stability improvements</code>
</dd></td>
<td><a
href="https://github.com/t1mmen/srtd/pull/32/files#diff-4ee0590e047a4e79fc4ca960b8cd2bf690acee595d913c445ebd56f1c6039106">+11/-0</a>
</td>
</tr>
</table></details></td></tr><tr><td><strong>Formatting</strong></td><td><details><summary>1
files</summary><table>
<tr>
<td><strong>srtd.config.json</strong><dd><code>Minor formatting
adjustment</code>
</dd></td>
<td><a
href="https://github.com/t1mmen/srtd/pull/32/files#diff-513f5e2650567f1141543846690cd1ace5383d325b3bb9b5d2e030a1cfae8edd">+1/-1</a>
</td>
</tr>
</table></details></td></tr></tr></tbody></table>
___
> <details> <summary> Need help?</summary><li>Type <code>/help how to
...</code> in the comments thread for any questions about Qodo Merge
usage.</li><li>Check out the <a
href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a>
for more information.</li></details>1 parent 20e463f commit e1fa468
File tree
38 files changed
+2114
-578
lines changed- .changeset
- src
- __tests__
- e2e
- helpers
- components
- hooks
- lib
- utils
38 files changed
+2114
-578
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
| 102 | + | |
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
24 | 31 | | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
| 29 | + | |
| 30 | + | |
27 | 31 | | |
28 | 32 | | |
29 | 33 | | |
| |||
97 | 101 | | |
98 | 102 | | |
99 | 103 | | |
100 | | - | |
| 104 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
0 commit comments