markitect-main/capabilities/testdrive-jsui/node_modules/eslint-plugin-jest/docs/rules/max-nested-describe.md

133 lines
2.8 KiB
Markdown
Raw Normal View History

feat: complete testdrive-jsui capability extraction with full JavaScript test integration Extract JavaScript UI framework functionality into dedicated testdrive-jsui capability while maintaining 100% functionality preservation and integrating JavaScript tests into the main Python test suite. Phase 1 (Foundation Setup) - COMPLETED: - Created capability directory structure with proper Python package layout - Configured pyproject.toml with Node.js subprocess dependencies - Set up package.json with Jest + JSDOM testing framework - Implemented Python-JavaScript bridge for seamless test integration - Created comprehensive capability Makefile with all testing targets - Added detailed README documentation for capability usage Phase 2 (Integration Layer) - COMPLETED: - Built Python test wrappers for JavaScript test execution via subprocess - Integrated with pytest discovery system for unified test experience - Added capability targets to main Makefile delegation system - Verified test integration works with main test suite Phase 3 (Safe Migration) - COMPLETED: - Copied (not moved) all JavaScript files to capability using safe copy-first approach - Migrated 4 core JavaScript components and 11 test files (2,840+ lines) - Verified all tests work in new location (11 Python tests + 7 JavaScript tests passing) - Maintained dual-track testing capability for safety during transition Phase 4 (Framework Enhancement) - COMPLETED: - Enhanced testing framework with Python integration and coverage reporting - Achieved 59% Python test coverage and 100% JavaScript test coverage - Added performance benchmarking and component documentation Phase 5 (Production Integration) - COMPLETED: - Added standard 'test' target to capability Makefile for discovery system compatibility - Integrated JavaScript tests into main Makefile with new targets: * test-js: Run JavaScript UI tests * test-all: Run all tests (Python + JavaScript + Capabilities) - Updated help documentation to include new testing workflows - Verified capability auto-discovery works via 'make test-capabilities' Key Achievements: - Zero-risk migration completed with copy-first safety approach - Full Python-JavaScript test integration with 18 total passing tests - JavaScript UI framework successfully extracted to dedicated capability - Enhanced CI/CD integration with unified test command interface - Clean architecture enabling future JavaScript framework evolution Testing Status: - ✅ All Python integration tests passing (11/11) - ✅ All JavaScript component tests passing (7/7) - ✅ Capability discovery integration working - ✅ Main test suite integration complete - ✅ Test coverage reporting functional (59% Python, 100% JavaScript) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-09 22:29:30 +01:00
# Enforces a maximum depth to nested describe calls (`max-nested-describe`)
<!-- end auto-generated rule header -->
While it's useful to be able to group your tests together within the same file
using `describe()`, having too many levels of nesting throughout your tests make
them difficult to read.
## Rule details
This rule enforces a maximum depth to nested `describe()` calls to improve code
clarity in your tests.
The following patterns are considered warnings (with the default option of
`{ "max": 5 } `):
```js
describe('foo', () => {
describe('bar', () => {
describe('baz', () => {
describe('qux', () => {
describe('quxx', () => {
describe('too many', () => {
it('should get something', () => {
expect(getSomething()).toBe('Something');
});
});
});
});
});
});
});
describe('foo', function () {
describe('bar', function () {
describe('baz', function () {
describe('qux', function () {
describe('quxx', function () {
describe('too many', function () {
it('should get something', () => {
expect(getSomething()).toBe('Something');
});
});
});
});
});
});
});
```
The following patterns are **not** considered warnings (with the default option
of `{ "max": 5 } `):
```js
describe('foo', () => {
describe('bar', () => {
it('should get something', () => {
expect(getSomething()).toBe('Something');
});
});
describe('qux', () => {
it('should get something', () => {
expect(getSomething()).toBe('Something');
});
});
});
describe('foo2', function () {
it('should get something', () => {
expect(getSomething()).toBe('Something');
});
});
describe('foo', function () {
describe('bar', function () {
describe('baz', function () {
describe('qux', function () {
describe('this is the limit', function () {
it('should get something', () => {
expect(getSomething()).toBe('Something');
});
});
});
});
});
});
```
## Options
```json
{
"jest/max-nested-describe": [
"error",
{
"max": 5
}
]
}
```
### `max`
Enforces a maximum depth for nested `describe()`.
This has a default value of `5`.
Examples of patterns **not** considered warnings with options set to
`{ "max": 2 }`:
```js
describe('foo', () => {
describe('bar', () => {
it('should get something', () => {
expect(getSomething()).toBe('Something');
});
});
});
describe('foo2', function () {
describe('bar2', function () {
it('should get something', function () {
expect(getSomething()).toBe('Something');
});
it('should get else', function () {
expect(getSomething()).toBe('Something');
});
});
});
```