Skip to content

Commit edfd6d7

Browse files
committed
fix: remove hard-coded paths from test-prerequisites, document environment assumptions
CRITICAL BUG FIX (A1): - test-prerequisites.spec.ts used hard-coded /Users/johanneshoppe/... paths - Tests would fail on CI and all other machines - This invalidated "production-ready" status Changes to test-prerequisites.spec.ts: 1. Added const projectRoot = process.cwd() for dynamic path resolution 2. Replaced all hard-coded cwd: '/Users/johanneshoppe/...' with cwd: projectRoot 3. Updated error messages to use ${projectRoot} template strings 4. Lines changed: 65, 67, 77, 85, 113, 115 Changes to TEST_COVERAGE_PLAN.md: 1. B1 - Added "Test Environment Requirements" section (lines 252-272) - Documents git availability requirements - Documents working directory assumptions (process.cwd()) - Documents real git integration test dependencies - Provides CI setup guidance 2. B2 - Added "Known Upgrade Tripwires" section (lines 216-240) - Documents intentionally pinned gh-pages v3.2.3 behaviors - Lists getRemoteUrl error message assertions - Lists dotfiles behavior assertions - Lists PublishOptions mapping tests - Explains these are FEATURES for upgrade verification Test results: - test-prerequisites.spec.ts: All 3 tests pass ✅ - Full suite: All 380 tests pass ✅ - Tests now portable across all machines with proper git setup Honest status update: - Previous claim: "100% complete, production-ready, zero gaps" - Reality: Critical portability bug made tests fail outside original machine - Current: Upgrade-ready with strong v3.2.3 baseline and portable tests
1 parent d7a0e1c commit edfd6d7

File tree

2 files changed

+55
-4
lines changed

2 files changed

+55
-4
lines changed

TEST_COVERAGE_PLAN.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,32 @@ We intentionally rely on the existing test suite for upgrade verification rather
213213

214214
We do NOT maintain automated tooling to run tests against both versions simultaneously. This is intentional - the manual comparison process ensures careful evaluation of each change. If automated comparison becomes necessary, it can be added later.
215215

216+
### Known Upgrade Tripwires
217+
218+
The following tests are **INTENTIONALLY pinned** to gh-pages v3.2.3 behavior and **EXPECTED to fail** on upgrade:
219+
220+
1. **getRemoteUrl Error Messages** (`engine.prepare-options-helpers.spec.ts`):
221+
- Exact error text assertions for:
222+
- "not a git repository" errors
223+
- "No such remote 'xyz'" errors
224+
- "remote.XYZ.url not found" errors
225+
- **Action on upgrade**: Review gh-pages v6 error messages and update assertions to match new text
226+
- **Why pinned**: These guard against silent API changes in gh-pages/lib/git.js
227+
228+
2. **Dotfiles Behavior** (`engine.gh-pages-behavior.spec.ts`):
229+
- File list assertions verify exact files published with `dotfiles: true/false`
230+
- Tests assert specific file counts (4 files vs 3 files)
231+
- **Action on upgrade**: Verify actual file lists with gh-pages v6 and update expectations
232+
- **Why pinned**: Ensures dotfiles logic didn't change behavior
233+
234+
3. **PublishOptions Mapping** (`engine.gh-pages-integration.spec.ts`):
235+
- Tests verify which options are passed vs filtered
236+
- Hardcoded list of options that should NOT reach gh-pages.publish
237+
- **Action on upgrade**: Check if gh-pages v6 accepts new options or rejects old ones
238+
- **Why pinned**: Guards against breaking changes in gh-pages API surface
239+
240+
**These are FEATURES, not bugs** - they provide upgrade verification and ensure conscious adaptation rather than silent breakage.
241+
216242
---
217243

218244
## Implementation Order
@@ -249,6 +275,29 @@ We do NOT maintain automated tooling to run tests against both versions simultan
249275

250276
---
251277

278+
## Test Environment Requirements
279+
280+
Tests assume the following environment setup (enforced by test-prerequisites.spec.ts):
281+
282+
1. **Git Availability**:
283+
- Git executable on PATH
284+
- Running in a git repository
285+
- Origin remote configured
286+
287+
2. **Working Directory**:
288+
- Tests run from project root (uses `process.cwd()`)
289+
- Assumes origin points to angular-schule/angular-cli-ghpages (or SSH equivalent)
290+
291+
3. **Real Git Integration Tests**:
292+
- `engine.prepare-options-helpers.spec.ts` getRemoteUrl tests depend on actual git repo
293+
- See `test-prerequisites.spec.ts` for canonical environment validation
294+
295+
**CI Setup**: Ensure CI clones the repo normally and runs tests from repo root.
296+
297+
**Portability**: Tests use `process.cwd()` for dynamic path resolution, not hard-coded paths.
298+
299+
---
300+
252301
## Files to Create/Modify
253302

254303
**New Files:**

src/test-prerequisites.spec.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import { execSync } from 'child_process';
1111
*/
1212

1313
describe('Test Prerequisites', () => {
14+
const projectRoot = process.cwd();
15+
1416
describe('Git availability', () => {
1517
let gitVersion: string;
1618

@@ -62,7 +64,7 @@ describe('Test Prerequisites', () => {
6264
gitDir = execSync('git rev-parse --git-dir', {
6365
encoding: 'utf8',
6466
stdio: 'pipe',
65-
cwd: '/Users/johanneshoppe/Work/angular-schule/angular-cli-ghpages'
67+
cwd: projectRoot
6668
}).trim();
6769
} catch (error) {
6870
throw new Error(
@@ -74,13 +76,13 @@ describe('Test Prerequisites', () => {
7476
'angular-cli-ghpages tests must run within a git repository.\n' +
7577
'\n' +
7678
'Current directory:\n' +
77-
' /Users/johanneshoppe/Work/angular-schule/angular-cli-ghpages\n' +
79+
` ${projectRoot}\n` +
7880
'\n' +
7981
'To fix this:\n' +
8082
'\n' +
8183
' If you cloned this repository:\n' +
8284
' # Ensure you are in the correct directory\n' +
83-
' cd /Users/johanneshoppe/Work/angular-schule/angular-cli-ghpages\n' +
85+
` cd ${projectRoot}\n` +
8486
' git status\n' +
8587
'\n' +
8688
' If you downloaded as ZIP:\n' +
@@ -110,7 +112,7 @@ describe('Test Prerequisites', () => {
110112
remoteUrl = execSync('git config --get remote.origin.url', {
111113
encoding: 'utf8',
112114
stdio: 'pipe',
113-
cwd: '/Users/johanneshoppe/Work/angular-schule/angular-cli-ghpages'
115+
cwd: projectRoot
114116
}).trim();
115117
} catch (error) {
116118
throw new Error(

0 commit comments

Comments
 (0)