Repro
import * as path from "node:path";
console.log("path.join():", path.join());
Actual (Perry)
TypeError: value is not a function
at <anonymous>
(Process exits 0 — note: unhandled exception, exit code is also wrong; Node exits 1.)
Expected (Node)
Impact
path.join() with zero arguments must return "." per the Node spec. It's the canonical "current directory" sentinel used by code like:
const args = process.argv.slice(2);
const target = path.join(...args); // when args is empty, must yield "."
Today such code throws unhandled in Perry, terminating the program. The error message "value is not a function" suggests the implementation is doing something like arguments.reduce(joinFn) and calling joinFn on undefined when the args array is empty (reduce with no initial value on an empty array throws). The fix is to either provide an initial value or to detect zero-args up front and return ".".
Surfaced by test-files/test_parity_path.ts — the test runs through 20 successful path.basename/dirname/extname/join lines, then dies at this line, masking 21 downstream APIs (path.matchesGlob, path.normalize, path.parse, path.relative, path.resolve, path.toNamespacedPath, all of path.posix.* / path.win32.*, plus path.delimiter / path.sep).
Acceptance
The 2-line repro prints path.join(): . matching Node, AND Perry exits 1 (not 0) for unhandled exceptions in general (separate concern but visible here).
Related
Surfaced by test-files/test_parity_path.ts (committed in d0e84724). Was previously a smaller bug — yesterday Perry returned undefined for path.join() no-args; today it actively throws. Slight regression in error shape, same underlying gap.
Repro
Actual (Perry)
(Process exits 0 — note: unhandled exception, exit code is also wrong; Node exits 1.)
Expected (Node)
Impact
path.join()with zero arguments must return"."per the Node spec. It's the canonical "current directory" sentinel used by code like:Today such code throws unhandled in Perry, terminating the program. The error message
"value is not a function"suggests the implementation is doing something likearguments.reduce(joinFn)and callingjoinFnonundefinedwhen the args array is empty (reduce with no initial value on an empty array throws). The fix is to either provide an initial value or to detect zero-args up front and return".".Surfaced by
test-files/test_parity_path.ts— the test runs through 20 successfulpath.basename/dirname/extname/joinlines, then dies at this line, masking 21 downstream APIs (path.matchesGlob,path.normalize,path.parse,path.relative,path.resolve,path.toNamespacedPath, all ofpath.posix.*/path.win32.*, pluspath.delimiter/path.sep).Acceptance
The 2-line repro prints
path.join(): .matching Node, AND Perry exits 1 (not 0) for unhandled exceptions in general (separate concern but visible here).Related
Surfaced by
test-files/test_parity_path.ts(committed ind0e84724). Was previously a smaller bug — yesterday Perry returnedundefinedforpath.join()no-args; today it actively throws. Slight regression in error shape, same underlying gap.