|
| 1 | +# Testing Status for gh-pages Upgrade |
| 2 | + |
| 3 | +## Current Status: β
BASELINE ESTABLISHED |
| 4 | + |
| 5 | +**Test Results with gh-pages v3.1.0:** |
| 6 | +- β
7 test suites passing |
| 7 | +- β
127 tests passing |
| 8 | +- β οΈ 6 tests skipped (known commander v3 bug) |
| 9 | +- β 0 tests failing |
| 10 | + |
| 11 | +## Critical Discovery: Dry-Run Logging Bug (NOT Commander Bug!) |
| 12 | + |
| 13 | +**Issue:** Dry-run output shows "undefined" for `--name` and `--email` parameters |
| 14 | + |
| 15 | +**Root Cause:** Copy-paste error in `src/engine/engine.ts` lines 303-304: |
| 16 | +```typescript |
| 17 | +name: options.name ? `the name '${options.username} will be used... // WRONG: uses username instead of name |
| 18 | +email: options.email ? `the email '${options.cname} will be used... // WRONG: uses cname instead of email |
| 19 | +``` |
| 20 | +
|
| 21 | +**Evidence:** |
| 22 | +```bash |
| 23 | +node dist/angular-cli-ghpages --name="Deploy Bot" --email="bot@test.com" --dry-run |
| 24 | +# Output shows: "name": "the name 'undefined will be used for the commit" |
| 25 | +# "email": "the email 'undefined will be used for the commit" |
| 26 | +``` |
| 27 | + |
| 28 | +**IMPORTANT:** |
| 29 | +- This is ONLY a **logging bug** in dry-run mode |
| 30 | +- The actual deployment WORKS CORRECTLY (commander v3 parses the options fine) |
| 31 | +- Both `name` and `email` must be provided together (engine only creates user object when both present) |
| 32 | + |
| 33 | +**Impact:** |
| 34 | +- Dry-run output is confusing/misleading |
| 35 | +- Actual deployments work fine |
| 36 | +- This is a PRE-EXISTING bug in v2.0.3 |
| 37 | + |
| 38 | +**Fix Required:** |
| 39 | +1. Change `options.username` β `options.name` and `options.cname` β `options.email` |
| 40 | +2. Add warning when only name OR only email is set (TODO added in code) |
| 41 | + |
| 42 | +## Test Coverage Accomplished |
| 43 | + |
| 44 | +### β
Parameter Passthrough Tests (`engine/parameter-passthrough.spec.ts`) |
| 45 | +**Purpose:** Verify every parameter flows correctly from input β engine β gh-pages |
| 46 | + |
| 47 | +**Coverage:** All 13 parameters tested: |
| 48 | +- `repo` - URL passthrough + token injection (GH_TOKEN, PERSONAL_TOKEN, GITHUB_TOKEN) |
| 49 | +- `remote` - Default 'origin' + custom values |
| 50 | +- `message` - Passthrough + CI metadata injection (Travis, CircleCI, GitHub Actions) |
| 51 | +- `branch` - Default 'gh-pages' + custom values |
| 52 | +- `name` + `email` - User object construction |
| 53 | +- `dotfiles` - Boolean negation (`noDotfiles` β `dotfiles: false`) |
| 54 | +- `notfound` - Boolean negation |
| 55 | +- `nojekyll` - Boolean negation |
| 56 | +- `cname` - Passthrough |
| 57 | +- `add` - Boolean passthrough |
| 58 | +- `dryRun` - Boolean passthrough |
| 59 | +- `git` - Custom git executable path |
| 60 | + |
| 61 | +**Key Test:** "All parameters together" - verifies no parameter conflicts |
| 62 | + |
| 63 | +### β
Edge Case Tests (`engine/edge-cases.spec.ts`) |
| 64 | +**Purpose:** Test boundary conditions and unusual inputs |
| 65 | + |
| 66 | +**Coverage:** |
| 67 | +- Empty/null/undefined handling for all parameters |
| 68 | +- Special characters (quotes, unicode, emojis, newlines) |
| 69 | +- Path edge cases (spaces, absolute paths, Windows paths) |
| 70 | +- Token injection edge cases (special chars, multiple tokens, empty tokens) |
| 71 | +- CI environment combinations (multiple CI systems active) |
| 72 | +- Boolean flag inversions |
| 73 | +- Extreme values (10k character messages, long URLs) |
| 74 | + |
| 75 | +### β
End-to-End CLI Tests (`cli-e2e.spec.ts`) |
| 76 | +**Purpose:** Test standalone CLI with actual command execution |
| 77 | + |
| 78 | +**Coverage:** |
| 79 | +- All CLI parameters (long flags) |
| 80 | +- All short flags (-d, -r, -m, -b, -c, -a) |
| 81 | +- Boolean --no- flags |
| 82 | +- Parameter format variations (--param=value vs --param value) |
| 83 | +- Special values (URLs, paths with slashes, email plus addressing) |
| 84 | + |
| 85 | +**Skipped:** 6 tests for name/email due to known commander v3 bug |
| 86 | + |
| 87 | +### β
Existing Tests (Preserved) |
| 88 | +- `angular-cli-ghpages.spec.ts` - Standalone CLI smoke tests |
| 89 | +- `deploy/actions.spec.ts` - Angular builder integration |
| 90 | +- `engine/engine.spec.ts` - Engine core functionality |
| 91 | +- `ng-add.spec.ts` - Schematic installation |
| 92 | + |
| 93 | +## Testing Philosophy Applied |
| 94 | + |
| 95 | +**CRITICAL RULE:** All tests use explicit assertions |
| 96 | + |
| 97 | +β
**Good:** |
| 98 | +```typescript |
| 99 | +const branch = 'main'; |
| 100 | +const options = { branch }; |
| 101 | +expect(result.branch).toBe(branch); // Passthrough clear |
| 102 | +``` |
| 103 | + |
| 104 | +```typescript |
| 105 | +const inputUrl = 'https://github.com/test/repo.git'; |
| 106 | +const token = 'secret'; |
| 107 | +const expectedUrl = 'https://x-access-token:secret@github.com/test/repo.git'; |
| 108 | +expect(result.repo).toBe(expectedUrl); // Transformation clear |
| 109 | +``` |
| 110 | + |
| 111 | +β **Bad:** |
| 112 | +```typescript |
| 113 | +expect(result.repo).toContain('github.com'); // Weak, unclear |
| 114 | +``` |
| 115 | + |
| 116 | +## What's Still Missing |
| 117 | + |
| 118 | +### π΄ HIGH PRIORITY |
| 119 | + |
| 120 | +1. **Fix commander v3 name/email bug** |
| 121 | + - Option 1: Remove `undefined` defaults, use empty string |
| 122 | + - Option 2: Don't pass default value to commander |
| 123 | + - Must test fix before proceeding |
| 124 | + |
| 125 | +2. **Angular.json config passthrough tests** |
| 126 | + - Test parameters from angular.json β engine |
| 127 | + - Verify precedence (CLI args override angular.json) |
| 128 | + - Test all parameter types (string, boolean, number) |
| 129 | + |
| 130 | +### π‘ MEDIUM PRIORITY |
| 131 | + |
| 132 | +3. **Apply explicit testing philosophy everywhere** |
| 133 | + - Refactor to use property shorthand (`{ branch }` not `{ branch: branch }`) |
| 134 | + - Ensure all tests have explicit expected values |
| 135 | + - Add comments explaining passthrough vs transformation |
| 136 | + |
| 137 | +4. **Mock gh-pages.publish() capture tests** |
| 138 | + - Actually mock gh-pages and capture options passed |
| 139 | + - Verify exact object shape sent to gh-pages |
| 140 | + - Test in both standalone CLI and ng deploy paths |
| 141 | + |
| 142 | +### π’ READY FOR EXECUTION |
| 143 | + |
| 144 | +5. **Upgrade gh-pages v3 β v6** |
| 145 | + - Change package.json |
| 146 | + - Run `npm install` |
| 147 | + - Run full test suite |
| 148 | + - Document any failures |
| 149 | + - Fix regressions if any |
| 150 | + |
| 151 | +6. **Upgrade commander v3 β v11** |
| 152 | + - Change package.json |
| 153 | + - Update CLI script to use `.opts()` if needed |
| 154 | + - Fix name/email bug during this upgrade |
| 155 | + - Run full test suite |
| 156 | + - Fix any regressions |
| 157 | + |
| 158 | +7. **Manual testing** |
| 159 | + - Test standalone CLI in real scenario |
| 160 | + - Test `ng deploy` in real Angular project |
| 161 | + - Test with actual GitHub repo (dry-run first) |
| 162 | + - Test in CI environment (GitHub Actions) |
| 163 | + |
| 164 | +## Next Steps |
| 165 | + |
| 166 | +1. **FIRST:** Fix commander v3 name/email bug |
| 167 | +2. **SECOND:** Write angular.json config tests |
| 168 | +3. **THIRD:** Apply explicit testing philosophy improvements |
| 169 | +4. **FOURTH:** Upgrade gh-pages to v6.1.1 |
| 170 | +5. **FIFTH:** Upgrade commander to v11 |
| 171 | +6. **SIXTH:** Manual testing |
| 172 | +7. **SEVENTH:** Merge PR #186 |
| 173 | + |
| 174 | +## Victory Condition |
| 175 | + |
| 176 | +β
All tests green (0 skipped) |
| 177 | +β
gh-pages upgraded to v6.1.1 |
| 178 | +β
commander upgraded to v11 |
| 179 | +β
Manual testing successful |
| 180 | +β
No regressions detected |
| 181 | +β
PR #186 merged |
| 182 | +β
Package published to npm |
| 183 | + |
| 184 | +**WE WILL GET THERE! π** |
0 commit comments