feat(tstest): Enhance tstest with fluent API, suite grouping, tag filtering, fixture & snapshot testing, and parallel execution improvements
This commit is contained in:
102
readme.plan.md
102
readme.plan.md
@@ -18,7 +18,7 @@
|
||||
|
||||
## 2. Enhanced toolsArg Functionality
|
||||
|
||||
### 2.1 Test Flow Control
|
||||
### 2.1 Test Flow Control ✅
|
||||
```typescript
|
||||
tap.test('conditional test', async (toolsArg) => {
|
||||
const result = await someOperation();
|
||||
@@ -36,33 +36,28 @@ tap.test('conditional test', async (toolsArg) => {
|
||||
});
|
||||
```
|
||||
|
||||
### 2.2 Test Metadata and Configuration
|
||||
### 2.2 Test Metadata and Configuration ✅
|
||||
```typescript
|
||||
tap.test('configurable test', async (toolsArg) => {
|
||||
// Set custom timeout
|
||||
toolsArg.timeout(5000);
|
||||
|
||||
// Retry on failure
|
||||
toolsArg.retry(3);
|
||||
|
||||
// Add tags for filtering
|
||||
toolsArg.tags(['slow', 'integration']);
|
||||
|
||||
// Set test priority
|
||||
toolsArg.priority('high');
|
||||
});
|
||||
// Fluent syntax ✅
|
||||
tap.tags('slow', 'integration')
|
||||
.priority('high')
|
||||
.timeout(5000)
|
||||
.retry(3)
|
||||
.test('configurable test', async (toolsArg) => {
|
||||
// Test implementation
|
||||
});
|
||||
```
|
||||
|
||||
### 2.3 Test Data and Context Sharing
|
||||
### 2.3 Test Data and Context Sharing ✅
|
||||
```typescript
|
||||
tap.test('data-driven test', async (toolsArg) => {
|
||||
// Access shared context
|
||||
// Access shared context ✅
|
||||
const sharedData = toolsArg.context.get('sharedData');
|
||||
|
||||
// Set data for other tests
|
||||
// Set data for other tests ✅
|
||||
toolsArg.context.set('resultData', computedValue);
|
||||
|
||||
// Parameterized test data
|
||||
// Parameterized test data (not yet implemented)
|
||||
const testData = toolsArg.data<TestInput>();
|
||||
expect(processData(testData)).toEqual(expected);
|
||||
});
|
||||
@@ -70,7 +65,7 @@ tap.test('data-driven test', async (toolsArg) => {
|
||||
|
||||
## 3. Nested Tests and Test Suites
|
||||
|
||||
### 3.1 Test Grouping with describe()
|
||||
### 3.1 Test Grouping with describe() ✅
|
||||
```typescript
|
||||
tap.describe('User Authentication', () => {
|
||||
tap.beforeEach(async (toolsArg) => {
|
||||
@@ -129,7 +124,7 @@ tap.test('performance test', async (toolsArg) => {
|
||||
});
|
||||
```
|
||||
|
||||
### 4.3 Test Fixtures and Factories
|
||||
### 4.3 Test Fixtures and Factories ✅
|
||||
```typescript
|
||||
tap.test('with fixtures', async (toolsArg) => {
|
||||
// Create test fixtures
|
||||
@@ -143,11 +138,16 @@ tap.test('with fixtures', async (toolsArg) => {
|
||||
|
||||
## 5. Test Execution Improvements
|
||||
|
||||
### 5.1 Parallel Test Execution
|
||||
- Run independent tests concurrently
|
||||
- Configurable concurrency limits
|
||||
### 5.1 Parallel Test Execution ✅
|
||||
- Run independent tests concurrently ✅
|
||||
- Configurable concurrency limits (via file naming convention)
|
||||
- Resource pooling for shared resources
|
||||
- Proper isolation between parallel tests
|
||||
- Proper isolation between parallel tests ✅
|
||||
|
||||
Implementation:
|
||||
- Tests with `para__<groupNumber>` in filename run in parallel
|
||||
- Different groups run sequentially
|
||||
- Tests without `para__` run serially
|
||||
|
||||
### 5.2 Watch Mode
|
||||
- Automatically re-run tests on file changes
|
||||
@@ -155,18 +155,18 @@ tap.test('with fixtures', async (toolsArg) => {
|
||||
- Fast feedback loop for development
|
||||
- Integration with IDE/editor plugins
|
||||
|
||||
### 5.3 Advanced Test Filtering
|
||||
### 5.3 Advanced Test Filtering ✅ (partially)
|
||||
```typescript
|
||||
// Run tests by tags
|
||||
// Run tests by tags ✅
|
||||
tstest --tags "unit,fast"
|
||||
|
||||
// Exclude tests by pattern
|
||||
// Exclude tests by pattern (not yet implemented)
|
||||
tstest --exclude "**/slow/**"
|
||||
|
||||
// Run only failed tests from last run
|
||||
// Run only failed tests from last run (not yet implemented)
|
||||
tstest --failed
|
||||
|
||||
// Run tests modified in git
|
||||
// Run tests modified in git (not yet implemented)
|
||||
tstest --changed
|
||||
```
|
||||
|
||||
@@ -198,36 +198,44 @@ tstest --changed
|
||||
- Links to documentation
|
||||
- Code examples in error output
|
||||
|
||||
### 7.2 Interactive Mode
|
||||
### 7.2 Interactive Mode (Needs Detailed Specification)
|
||||
- REPL for exploring test failures
|
||||
- Debugging integration
|
||||
- Need to define: How to enter interactive mode? When tests fail?
|
||||
- What commands/features should be available in the REPL?
|
||||
- Debugging integration
|
||||
- Node.js inspector protocol integration?
|
||||
- Breakpoint support?
|
||||
- Step-through test execution
|
||||
- Pause between tests?
|
||||
- Step into/over/out functionality?
|
||||
- Interactive test data manipulation
|
||||
- Modify test inputs on the fly?
|
||||
- Inspect intermediate values?
|
||||
|
||||
### 7.3 VS Code Extension
|
||||
- Test explorer integration
|
||||
- Inline test results
|
||||
- CodeLens for running individual tests
|
||||
- Debugging support
|
||||
### 7.3 ~~VS Code Extension~~ (Scratched)
|
||||
- ~~Test explorer integration~~
|
||||
- ~~Inline test results~~
|
||||
- ~~CodeLens for running individual tests~~
|
||||
- ~~Debugging support~~
|
||||
|
||||
## Implementation Phases
|
||||
|
||||
### Phase 1: Core Enhancements (Priority: High)
|
||||
1. Implement enhanced toolsArg methods (skip, skipIf, timeout, retry)
|
||||
2. Add basic test grouping with describe()
|
||||
3. Improve error reporting between tapbundle and tstest
|
||||
### Phase 1: Core Enhancements (Priority: High) ✅
|
||||
1. Implement enhanced toolsArg methods (skip, skipIf, timeout, retry) ✅
|
||||
2. Add basic test grouping with describe() ✅
|
||||
3. Improve error reporting between tapbundle and tstest ✅
|
||||
|
||||
### Phase 2: Advanced Features (Priority: Medium)
|
||||
1. Implement nested test suites
|
||||
2. Add snapshot testing
|
||||
3. Create test fixture system
|
||||
4. Implement parallel test execution
|
||||
1. Implement nested test suites ✅ (basic describe support)
|
||||
2. Add snapshot testing ✅
|
||||
3. Create test fixture system ✅
|
||||
4. Implement parallel test execution ✅
|
||||
|
||||
### Phase 3: Developer Experience (Priority: Medium)
|
||||
1. Add watch mode
|
||||
2. Implement custom reporters
|
||||
3. Create VS Code extension
|
||||
4. Add interactive debugging
|
||||
3. ~~Create VS Code extension~~ (Scratched)
|
||||
4. Add interactive debugging (Needs detailed spec first)
|
||||
|
||||
### Phase 4: Analytics and Performance (Priority: Low)
|
||||
1. Build test analytics dashboard
|
||||
|
Reference in New Issue
Block a user