You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by el...@apache.org on 2025/09/29 17:25:43 UTC

(superset) branch docs/testing-guidelines-test-function created (now 572f3392d7)

This is an automated email from the ASF dual-hosted git repository.

elizabeth pushed a change to branch docs/testing-guidelines-test-function
in repository https://gitbox.apache.org/repos/asf/superset.git


      at 572f3392d7 docs(testing): add guidelines for using test() instead of describe()/it()

This branch includes the following new commits:

     new 572f3392d7 docs(testing): add guidelines for using test() instead of describe()/it()

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(superset) 01/01: docs(testing): add guidelines for using test() instead of describe()/it()

Posted by el...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

elizabeth pushed a commit to branch docs/testing-guidelines-test-function
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 572f3392d73e68f244a05b11739c8916df4ba712
Author: Elizabeth Thompson <es...@gmail.com>
AuthorDate: Mon Sep 29 10:25:15 2025 -0700

    docs(testing): add guidelines for using test() instead of describe()/it()
    
    Added comprehensive testing structure guidelines to LLMS.md that explain why and how to use test() instead of describe() and it(), following the "avoid nesting when testing" principle for better test isolation and readability.
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude <no...@anthropic.com>
---
 LLMS.md | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/LLMS.md b/LLMS.md
index 3b861ad715..1d48c99803 100644
--- a/LLMS.md
+++ b/LLMS.md
@@ -102,6 +102,17 @@ superset/
 - **`selectOption()`** - Select component helper
 - **React Testing Library** - NO Enzyme (removed)
 
+### Test Structure Guidelines
+- **Use `test()` instead of `describe()` and `it()`** - Follow the [avoid nesting when testing](https://kentcdodds.com/blog/avoid-nesting-when-youre-testing) principle
+  - **Why**: Reduces unnecessary nesting, improves test isolation, and makes tests more readable
+  - **Pattern**: Write flat test files with descriptive test names that fully describe what's being tested
+  - **Example**: Instead of nested `describe('Component', () => { it('should render', ...) })`, use `test('Component renders correctly', ...)`
+  - **Benefits**:
+    - Each test stands alone with a clear, searchable name
+    - Easier to run individual tests
+    - Forces you to write more descriptive test names
+    - Reduces cognitive overhead from nested context switching
+
 ### Test Database Patterns
 - **Mock patterns**: Use `MagicMock()` for config objects, avoid `AsyncMock` for synchronous code
 - **API tests**: Update expected columns when adding new model fields