FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: report chdir errors from cd by lawrence3699 · Pull Request #1253 · shelljs/shelljs · GitHub

fix: report chdir errors from cd - #1253

Open
lawrence3699 wants to merge 1 commit into
shelljs:mainfrom
lawrence3699:fix/cd-worker-error
Open

fix: report chdir errors from cd#1253
lawrence3699 wants to merge 1 commit into
shelljs:mainfrom
lawrence3699:fix/cd-worker-error

Conversation

Copy link
Copy Markdown

Fixes #1112.

When process.chdir() fails for an existing directory, cd() currently reclassifies the target as not a directory. In worker threads this hides Node's actual process.chdir() is not supported in workers error.

This keeps the existing no such file or directory and not a directory paths, but reports the original process.chdir() error when the target exists and is a directory.

Validation:

  • npx ava test/cd.js --match='reports process.chdir() errors for existing directories'
  • npx ava test/cd.js
  • npm run test-with-coverage -- test/cd.js
  • npm run lint
  • git diff --check

I also ran npm test; the cd tests passed, and the remaining local failures reproduced on a clean checkout before this change: chmod › Test setgid and four ls › long option assertions where this environment reports gid 0.

Comment thread test/cd.js
t.is(result.stderr, 'cd: not a directory: test/resources/file1');
});

test('reports process.chdir() errors for existing directories', async t => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Can we rename this test case to "shell.cd() not supported in workers" or something like that?

codecov Bot commented May 2, 2026
edited
Loading

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.10%. Comparing base (2809a87) to head (0792b58).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1253   +/-   ##
=======================================
  Coverage   97.09%   97.10%           
=======================================
  Files          36       36           
  Lines        1517     1519    +2     
=======================================
+ Hits         1473     1475    +2     
  Misses         44       44           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

The cd command can report an incorrect error when executing in a worker

2 participants


Back | FazBrowse Home | New Git URL