-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(ext/node): add the missing path information when the file is not found in fs.stat
and fs.statSync
#26037
Conversation
I test it with // main.js
import fs from "node:fs";
const file = "non-exist-file";
const fileUrl = new URL(file, import.meta.url);
const nonFileUrl = new URL(file, "https://example.com");
const files = [file, fileUrl, nonFileUrl];
function testStatSync() {
files.forEach((item) => {
try {
fs.statSync(item);
} catch (error) {
console.log(`Error occurred in fs.statSync: ${error}`);
}
try {
Deno.statSync(item);
} catch (error) {
console.log(`Error occurred in Deno.statSync: ${error}\n`);
}
});
}
async function testStat() {
for (const item of files) {
await fs.stat(item, (error) => {
console.log(`Error occurred in fs.stat: ${error}`);
});
try {
await Deno.stat(item);
} catch (error) {
console.log(`Error occurred in Deno.stat: ${error}\n`);
}
}
}
testStatSync();
testStat(); Run it with
Running |
@familyboat You can add your test to target/debug/deno test -A --config tests/config/deno.json tests/unit_node/fs_test.ts |
I add tests for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Fix #25921.
See more details in #25921.