|
| 1 | +# Testing Process for PostgreSQL Deparser |
| 2 | + |
| 3 | +## Overview |
| 4 | +This document outlines the testing process for the PostgreSQL Deparser package, following the development workflow described in DEVELOPMENT.md and AGENTS.md. |
| 5 | + |
| 6 | +## Test Execution |
| 7 | + |
| 8 | +### Prerequisites |
| 9 | +- Yarn and Lerna installed |
| 10 | +- Dependencies installed via `yarn` in root directory |
| 11 | +- Project built via `yarn build` |
| 12 | + |
| 13 | +### Running Tests |
| 14 | +```bash |
| 15 | +cd packages/deparser |
| 16 | +yarn test # Run all tests |
| 17 | +yarn test:watch # Run tests in watch mode |
| 18 | +``` |
| 19 | + |
| 20 | +### Individual Test Execution |
| 21 | +For debugging specific failures: |
| 22 | +```bash |
| 23 | +yarn test --testNamePattern="test-name" |
| 24 | +``` |
| 25 | + |
| 26 | +## Test Coverage Requirements |
| 27 | +- Target: 100% test coverage |
| 28 | +- All tests must pass before merging |
| 29 | +- No regressions allowed |
| 30 | + |
| 31 | +## Testing Workflow |
| 32 | +1. Run individual failing tests during development |
| 33 | +2. Fix issues in tight debugging loops |
| 34 | +3. Run full test suite to check for regressions |
| 35 | +4. Verify 100% coverage before PR submission |
| 36 | + |
| 37 | +## Current Status |
| 38 | +✅ All tests passing (252/252 test suites, 265/265 tests) |
| 39 | +✅ 100% test coverage achieved |
| 40 | +✅ Fixed COPY statement DefElem formatting |
| 41 | +✅ All parsing issues resolved by upstream fixes |
| 42 | + |
| 43 | +## Recent Fixes |
| 44 | +- **COPY Statement Formatting**: Fixed DefElem to generate `WITH (FORMAT CSV)` instead of `WITH (format = 'csv')` for CopyStmt context |
| 45 | +- **Parsing Issues**: Resolved by Dan's upstream fixes with new statement-splitter utility and improved fixture generation |
| 46 | + |
| 47 | +## Development Guidelines |
| 48 | +- Follow the context-driven rendering approach outlined in AGENTS.md |
| 49 | +- Use tight testing loops for efficient debugging |
| 50 | +- Ensure all changes maintain backward compatibility |
| 51 | +- Run tests in isolation when debugging specific issues |
| 52 | +- Check for regressions after each fix |
| 53 | + |
| 54 | +## Debugging Process |
| 55 | +1. Identify failing tests using `yarn test` |
| 56 | +2. Run individual tests with `--testNamePattern` for focused debugging |
| 57 | +3. Analyze AST differences and deparser output |
| 58 | +4. Apply fixes following existing code patterns |
| 59 | +5. Verify fixes don't break other tests |
| 60 | +6. Confirm 100% test coverage before submission |
0 commit comments