mirror of
https://github.com/denoland/deno.git
synced 2024-11-24 15:19:26 -05:00
Merge branch 'main' into fix-doc-test-shebang-parse-error
This commit is contained in:
commit
b7a1fb4dd0
5 changed files with 67 additions and 4 deletions
|
@ -46,6 +46,12 @@ brew install deno
|
|||
choco install deno
|
||||
```
|
||||
|
||||
[WinGet](https://winstall.app/apps/DenoLand.Deno) (Windows):
|
||||
|
||||
```powershell
|
||||
winget install --id=DenoLand.Deno
|
||||
```
|
||||
|
||||
### Build and install from source
|
||||
|
||||
Complete instructions for building Deno from source can be found in the manual
|
||||
|
|
|
@ -1009,7 +1009,11 @@ impl deno_graph::source::Reporter for FileWatcherReporter {
|
|||
) {
|
||||
let mut file_paths = self.file_paths.lock();
|
||||
if specifier.scheme() == "file" {
|
||||
file_paths.push(specifier.to_file_path().unwrap());
|
||||
// Don't trust that the path is a valid path at this point:
|
||||
// https://github.com/denoland/deno/issues/26209.
|
||||
if let Ok(file_path) = specifier.to_file_path() {
|
||||
file_paths.push(file_path);
|
||||
}
|
||||
}
|
||||
|
||||
if modules_done == modules_total {
|
||||
|
|
|
@ -30,7 +30,7 @@ use tokio::sync::mpsc;
|
|||
use tokio::sync::mpsc::UnboundedReceiver;
|
||||
use tokio::time::sleep;
|
||||
|
||||
const CLEAR_SCREEN: &str = "\x1B[2J\x1B[1;1H";
|
||||
const CLEAR_SCREEN: &str = "\x1B[H\x1B[2J\x1B[3J";
|
||||
const DEBOUNCE_INTERVAL: Duration = Duration::from_millis(200);
|
||||
|
||||
struct DebouncedReceiver {
|
||||
|
|
|
@ -383,7 +383,10 @@ export function stat(
|
|||
|
||||
Deno.stat(path).then(
|
||||
(stat) => callback(null, CFISBIS(stat, options.bigint)),
|
||||
(err) => callback(denoErrorToNodeError(err, { syscall: "stat" })),
|
||||
(err) =>
|
||||
callback(
|
||||
denoErrorToNodeError(err, { syscall: "stat", path: getPathname(path) }),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -417,9 +420,16 @@ export function statSync(
|
|||
return;
|
||||
}
|
||||
if (err instanceof Error) {
|
||||
throw denoErrorToNodeError(err, { syscall: "stat" });
|
||||
throw denoErrorToNodeError(err, {
|
||||
syscall: "stat",
|
||||
path: getPathname(path),
|
||||
});
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getPathname(path: string | URL) {
|
||||
return typeof path === "string" ? path : path.pathname;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ import {
|
|||
cp,
|
||||
FileHandle,
|
||||
open,
|
||||
stat,
|
||||
writeFile,
|
||||
} from "node:fs/promises";
|
||||
import process from "node:process";
|
||||
|
@ -123,6 +124,48 @@ Deno.test(
|
|||
},
|
||||
);
|
||||
|
||||
Deno.test(
|
||||
"[node/fs statSync] throw error with path information",
|
||||
() => {
|
||||
const file = "non-exist-file";
|
||||
const fileUrl = new URL(file, import.meta.url);
|
||||
|
||||
assertThrows(() => {
|
||||
statSync(file);
|
||||
}, "Error: ENOENT: no such file or directory, stat 'non-exist-file'");
|
||||
|
||||
assertThrows(() => {
|
||||
statSync(fileUrl);
|
||||
}, `Error: ENOENT: no such file or directory, stat '${fileUrl.pathname}'`);
|
||||
},
|
||||
);
|
||||
|
||||
Deno.test(
|
||||
"[node/fs/promises stat] throw error with path information",
|
||||
async () => {
|
||||
const file = "non-exist-file";
|
||||
const fileUrl = new URL(file, import.meta.url);
|
||||
|
||||
try {
|
||||
await stat(file);
|
||||
} catch (error: unknown) {
|
||||
assertEquals(
|
||||
`${error}`,
|
||||
"Error: ENOENT: no such file or directory, stat 'non-exist-file'",
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
await stat(fileUrl);
|
||||
} catch (error: unknown) {
|
||||
assertEquals(
|
||||
`${error}`,
|
||||
`Error: ENOENT: no such file or directory, stat '${fileUrl.pathname}'`,
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
Deno.test(
|
||||
"[node/fs/promises cp] copy file",
|
||||
async () => {
|
||||
|
|
Loading…
Reference in a new issue