Skip to content

test(components): build path expectations with pathe, not node:path - #427

Merged
IgorShevchik merged 1 commit into
mainfrom
sync/nuxt-ccd4894
Aug 18, 2026
Merged

test(components): build path expectations with pathe, not node:path#427
IgorShevchik merged 1 commit into
mainfrom
sync/nuxt-ccd4894

Conversation

@IgorShevchik

Copy link
Copy Markdown
Collaborator

Port of nuxt/ui@ccd48940. Second of six in the queue, after #425.

The defect

The spec built its expected paths with node:path while the module under test builds them with pathe. On Windows those disagree — node:path emits backslashes, pathe forward slashes — so the assertions compared two spellings of the same directory and failed.

It is ours in full, not merely upstream-shaped:

  • src/utils/components.ts imports dirname, join, normalize, resolve from pathe, so resolveExtraScanDirs emits forward slashes;
  • the spec compared against node:path output in the two places fed by fixtureRoot().toEqual([outside]) and .toEqual([join(outside, 'components')]).
-import { join } from 'node:path'
+import { join, normalize } from 'pathe'

-  const dir = realpathSync(mkdtempSync(join(tmpdir(), 'b24ui-cd-')))
+  const dir = normalize(realpathSync(mkdtempSync(join(tmpdir(), 'b24ui-cd-'))))

normalize is needed on top of the import switch: realpathSync comes from node:fs and returns native separators regardless of which join produced its argument.

pathe is already a root dependencies entry (^2.0.3), so nothing new is pulled in, and no node:path import remains in the file.

Deviations

None. The only difference from upstream's diff in the touched lines is the fixture prefix, b24ui-cd- against nuxt-ui-cd-.

Verification — and what it cannot show

This cannot be demonstrated on Linux. Worth stating plainly rather than implying coverage the run does not have. On POSIX pathe.join and node:path.join return identical strings, and normalize is an identity on an already-normal path. Checked rather than assumed:

node:path "/tmp/x/z"
pathe     "/tmp/x/z"
identical on this platform: true | platform: linux

So the suite is green before and after, and no mutation can turn it red here — the usual proof for a change like this is unavailable.

What is verifiable locally is the mechanism: implementation and test now resolve paths through the same module, and the two comparison sites are exactly the ones consuming fixtureRoot(). The Windows behaviour rests on upstream's report, not on a run here.

Verify (CI=true)

lint · typecheck · test · build — all green. Tests 6622 passed | 6 skipped across 288 files.

No docs:generate — the commit touches no docs/, per PORTING.md §6.

Ledger

6bcc97a6 reconciled with #425 and squash e5c7e658. cursorccd48940, entry added, log at .sync/log/ccd48940….md.

Remaining: f065438d (reka-ui 2.10.3), f3c2ac21 (the Slider fix — applies here as Range, see #423), cf5f15e3 and f6d188bd (showcase; the second has a schema half worth taking).


Generated by Claude Code

Port of nuxt/ui@ccd48940.

The spec built its expected paths with `node:path` while the module under
test builds them with `pathe`. On Windows those disagree — `node:path`
emits backslashes, `pathe` forward slashes — so the assertions compared two
spellings of the same directory and failed.

The defect is ours in full. `src/utils/components.ts` imports `dirname`,
`join`, `normalize` and `resolve` from `pathe`, so `resolveExtraScanDirs`
emits forward slashes, and the spec compared against `node:path` output in
the two places fed by `fixtureRoot()`: `.toEqual([outside])` and
`.toEqual([join(outside, 'components')])`.

`normalize` is needed on top of the import switch because `realpathSync`
comes from `node:fs` and returns native separators regardless. `pathe` is
already a root dependency, so nothing new is pulled in, and no `node:path`
import remains in the file.

This cannot be demonstrated on Linux, which is worth stating plainly rather
than implying coverage. On POSIX `pathe.join` and `node:path.join` return
identical strings and `normalize` is an identity on an already-normal path
— checked, both give `/tmp/x/z` — so the suite is green before and after
and no mutation can turn it red here. What is verifiable locally is the
mechanism: implementation and test now use the same module, and the two
comparison sites are exactly the ones consuming `fixtureRoot()`. The
Windows behaviour rests on upstream's report, not on a run here.

Verify (CI=true): lint · typecheck · test (6622 passed, 6 skipped, 288
files) · build — all green. No docs:generate; the commit touches no docs/.
@IgorShevchik
IgorShevchik merged commit dcb3bac into main Aug 18, 2026
1 check passed
@IgorShevchik
IgorShevchik deleted the sync/nuxt-ccd4894 branch August 18, 2026 04:33
IgorShevchik pushed a commit that referenced this pull request Aug 20, 2026
release-please parses every commit with `@conventional-commits/parser`, and when
the parse throws it catches, writes two `logger.debug` lines and moves on.
Nothing turns red: CI is green, the release PR renders normally, and the commit
is simply absent. dcb3bac — `test(components): build path expectations with
pathe, not node:path (#427)` — went missing from the 2.12.0 notes that way; the
range holds seven `test:` commits and the notes list six.

Fidelity is measured, not assumed. Over all 3240 commits on `main`, this oracle
and release-please's own `parseConventionalCommits` agree on every one: 67
rejected by both, zero disagreements in either direction. The hazard is live at
roughly one commit in a hundred in the current style, and every one of the 29
line-leading call tokens in the whole history sits in the last 400 commits.

The trigger is broader than nested parentheses, which is what this commit first
claimed. A body line beginning with a call-like token arms the parser's scope
rule, which then rejects unless the very next `(`, `)` or line-end is a `)`. So
an unclosed call — `writeTemplates(config.root` running to end of line, or a call
wrapped across two lines — fails identically. Any `:` or `!` before the paren
disarms it, as does one space of indentation, and only the first group on the
line is scanned. The reliable repairs are indenting or prefixing; reflowing works
only where the parentheses balance once joined.

More importantly, 64 of the 67 real rejections are on the SUBJECT, not in the
body — missing colons, `Revert "…"`, a space between type and scope. The first
version of the error text sent all of them hunting for nested parens in a body
that does not have them, while the parser's own message pointed at line 1. The
guard now branches on the reported position and lists the shapes for each.

Merge commits are exempt. Their subject is `Merge pull request …`, which the
parser rejects and release-please is right to drop — failing there would redden
`main` for correct behaviour. Thirteen exist in this history, the last from
2026-05-07.

The parser is an ordinary devDependency. `pnpm add`-ing it downgraded TypeScript
6.0.3 to 5.9.3, which this commit first blamed on the package; the cause is that
`typescript` is a non-optional peer not listed in devDependencies while
`@nuxt/module-builder` peers `^5.9.3`, so any root `pnpm add` does it (#451).
Appending to `package.json` by hand and running `pnpm install` gives a 33-line
pure-addition lockfile diff with `typescript` untouched — so the CI-time install,
the only npm fetch in this repository outside `--frozen-lockfile`, is gone.

Tests moved from `test/workflows/` to `test/utils/commit-parses.spec.ts`, because
`run.sh` executes before `pnpm install` and the parser now lives in
`node_modules`. Eighteen accepted shapes are pinned, weighted by what this
repository actually writes — `Co-authored-by:` appears in 83% of recent commits,
`Claude-Session:` in 74%, a `(#NNN)` subject in 98%, an indented body line in
28% — because a guard that reddened `main` on ordinary messages would be removed
within the week.

Closes #436.
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