Skip to content

Commit f761e07

Browse files
pajomaclaude
andcommitted
test(navigation): poll for config propagation in buildCtrl
On CI, config.update() write is async and the next getConfiguration() call may return a stale snapshot before the disk write flushes. Poll until the base value is visible so getBasePath() resolves to the correct tmpBase when getWeekFromURIAndConfig builds its path regex (T3/T4). #200 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 6f796a1 commit f761e07

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/test/suite/commands-prev-next.test.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,14 @@ async function seedEntry(base: string, year: number, month: number, day: number,
3030
async function buildCtrl(tmpBase: string): Promise<{ ctrl: J.Util.Ctrl; logger: TestLogger }> {
3131
const config = vscode.workspace.getConfiguration('journal');
3232
await config.update('base', tmpBase, vscode.ConfigurationTarget.Workspace);
33-
const refreshed = vscode.workspace.getConfiguration('journal');
33+
// On CI the config write is async; poll until the value is visible.
34+
const deadline = Date.now() + 3000;
35+
let refreshed: vscode.WorkspaceConfiguration;
36+
do {
37+
refreshed = vscode.workspace.getConfiguration('journal');
38+
if (refreshed.get<string>('base') === tmpBase) { break; }
39+
await new Promise<void>(r => setTimeout(r, 50));
40+
} while (Date.now() < deadline);
3441
const ctrl = new J.Util.Ctrl(refreshed);
3542
const logger = new TestLogger(false);
3643
ctrl.logger = logger;

0 commit comments

Comments
 (0)