Skip to content

Commit 01efda2

Browse files
committed
Address review feedback
- hugo.yaml: raise module.hugoVersion.min to 0.158.0, matching the new theme floor - no-deprecations test: prune test-created dirs only when empty, so future hook files can't be deleted by test cleanup
1 parent d9b194c commit 01efda2

2 files changed

Lines changed: 18 additions & 4 deletions

File tree

hugo.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ module:
247247
# workspace: docsy.work
248248
hugoVersion:
249249
extended: true
250-
min: 0.157.0
250+
min: 0.158.0
251251
imports:
252252
- path: github.com/google/docsy/theme
253253
disable: false

tests/no-deprecations.test.mjs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
import test from 'node:test';
22
import assert from 'node:assert/strict';
33
import { spawnSync } from 'node:child_process';
4-
import { existsSync, mkdirSync, rmSync, writeFileSync } from 'node:fs';
4+
import {
5+
existsSync,
6+
mkdirSync,
7+
rmSync,
8+
rmdirSync,
9+
writeFileSync,
10+
} from 'node:fs';
511
import { dirname, join } from 'node:path';
612
import { fileURLToPath } from 'node:url';
713

@@ -66,7 +72,15 @@ test('build with seeded deprecated API call logs a deprecation notice', (t) => {
6672
);
6773
t.diagnostic(`Seeded deprecation reported as: ${deprecations[0].trim()}`);
6874
} finally {
69-
rmSync(hookPath);
70-
rmSync(dirname(hookPath), { recursive: true, force: true });
75+
rmSync(hookPath, { force: true });
76+
// Prune test-created dirs only if empty (rmdirSync refuses to delete
77+
// non-empty directories), in case other hooks/partials are added later.
78+
for (const dir of [dirname(hookPath), dirname(dirname(hookPath))]) {
79+
try {
80+
rmdirSync(dir);
81+
} catch {
82+
break; // Directory not empty; leave it (and its parents) in place.
83+
}
84+
}
7185
}
7286
});

0 commit comments

Comments
 (0)