Skip to content

Report mv errors for a missing destination directory - #1275

Open
Hashim1999164 wants to merge 2 commits into
shelljs:mainfrom
Hashim1999164:fix-mv-missing-dest-dir
Open

Hashim1999164 wants to merge 2 commits into
shelljs:mainfrom
Hashim1999164:fix-mv-missing-dest-dir

Conversation

@Hashim1999164

Copy link
Copy Markdown
Contributor

Summary

When mv targets a path that ends with a directory separator but that directory does not exist, file moves now set stderr instead of failing silently. Directory renames to a new name with a trailing separator still behave the same.

Fixes #1146

Test plan

  • npx ava test/mv.js
  • shell.mv("file", "no/such/dir/") leaves the file in place and prints an error

Trailing slash destinations that do not exist now surface a clear error for files while directory renames keep working.
Comment thread src/mv.js Resolved
@nfischer nfischer added the bash compat Compatibility issues with bash or POSIX behavior label Oct 3, 2026
@codecov

codecov Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 97.12%. Comparing base (6ec0929) to head (8d88f84).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
src/mv.js 90.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1275      +/-   ##
==========================================
- Coverage   97.17%   97.12%   -0.05%     
==========================================
  Files          36       36              
  Lines        1520     1530      +10     
==========================================
+ Hits         1477     1486       +9     
- Misses         43       44       +1     

☔ 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.

Match bash mv wording when the destination path ends with a slash but is not a directory.
@Hashim1999164

Copy link
Copy Markdown
Contributor Author

yep, swapped it to Not a directory to match bash. thanks for the catch

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

Labels

bash compat Compatibility issues with bash or POSIX behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

In mv command, there should be en error if destination directory not present.

2 participants