Skip to content

test(jest): use a folder below a file for the unwritable diagnostics case - #302

Open
TheSeydiCharyyev wants to merge 1 commit into
callstackincubator:mainfrom
TheSeydiCharyyev:fix/issue-301
Open

TheSeydiCharyyev wants to merge 1 commit into
callstackincubator:mainfrom
TheSeydiCharyyev:fix/issue-301

Conversation

@TheSeydiCharyyev

Copy link
Copy Markdown

What is this?

On Windows, the diagnostics test "never throws when the directory cannot be written" does not meet an unwritable folder. It uses projectRoot: '/dev/null/nope'. On Linux and macOS /dev/null is a device, so no folder can be created below it. On Windows, Node resolves the path against the root of the current drive, and the appender creates \dev\null\nope\.harness\diagnostics\unwritable.jsonl there. The case passes, and the folder stays on the drive after the run (#301).

How does it work?

The case now writes an empty file in its temp folder and uses a path below that file as projectRoot. A folder below a regular file can't be created on any platform (ENOTDIR), so the appender meets the error the case is about. The temp folder is removed after each case, as before. The case also checks that the .jsonl file does not exist after dispose(). With /dev/null/nope this check fails on Windows 11 (expected true to be false). With the new path, all 27 cases in the file pass and nothing is written under \dev\null. Production code is unchanged. I ran the tests on Windows 11 only; Linux and macOS run them in CI.

Why is this useful?

The case tests what its name says on every platform, and a test run on Windows no longer leaves \dev\null on the drive. While that folder exists, Git for Windows fails on commands that open /dev/null as a path, for example git diff --no-index /dev/null <file>.

Fixes #301

@vercel

vercel Bot commented Oct 29, 2026

Copy link
Copy Markdown

@TheSeydiCharyyev is attempting to deploy a commit to the Callstack Team on Vercel.

A member of the Team first needs to authorize it.

@TheSeydiCharyyev
TheSeydiCharyyev marked this pull request as ready for review October 29, 2026 11:39

This branch has not been deployed

No deployments
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.

On Windows, report.test.ts's unwritable-folder case creates \dev\null\nope at the drive root instead of meeting an unwritable folder

1 participant