Skip to content

test: compare the statusline copy path JSON-escaped in hooks.test.js - #1046

Merged
DietrichGebert merged 2 commits into
DietrichGebert:mainfrom
Bettinho179:fix/hooks-test-windows-json-escape
Oct 13, 2026
Merged

DietrichGebert merged 2 commits into
DietrichGebert:mainfrom
Bettinho179:fix/hooks-test-windows-json-escape

Conversation

@Bettinho179

Copy link
Copy Markdown
Contributor

What

tests/hooks.test.js failed on Windows at the #1032 assertion ("nudge must point at the config-dir copy, not the plugin cache").

Why

The statusline nudge embeds the script path in a JSON snippet (JSON.stringify(command)), so on win32 the backslashes are doubled (C:\\Users\\...\\ponytail-statusline.ps1). The assertion searched stdout for the raw path, so it never matched on Windows. Because it is a plain assert.ok in a top-level script, the failure also skipped every assertion after it (the broken-statusLine and spaced-path cases).

The hook output is correct; only the test was POSIX-only.

Change

Compare against the JSON-encoded form of the path: JSON.stringify(copyPath).slice(1, -1). On POSIX this is identical to the raw path, so behavior there is unchanged.

Checks

On Windows 11, Node 24:

  • npm test: 125 pass, 0 fail, 2 skipped (main suite); 28/28 (pi-extension)
  • node scripts/check-rule-copies.js: ok
  • node scripts/check-versions.js: ok

🤖 Generated with Claude Code

The nudge embeds the script path in a JSON snippet, so on Windows its backslashes are doubled. The DietrichGebert#1032 assertion looked for the raw path and failed on win32, which also skipped every assertion after it. Compare against the JSON-encoded form instead.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@DietrichGebert
DietrichGebert merged commit 7fc4ab5 into DietrichGebert:main Oct 13, 2026
1 check passed
@DietrichGebert

Copy link
Copy Markdown
Owner

Thanks! Checked it: on Windows the hook prints the path JSON-encoded, so the old check never matched and skipped the rest of the file; on macOS and Linux nothing changes. Merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants