mirror of
https://github.com/denoland/deno.git
synced 2025-09-27 12:49:10 +00:00
refactor(cli/js/ops/fs): Improve readdir() and FileInfo interfaces (#4763)
This commit is contained in:
parent
6441852a1d
commit
5ac728a5f1
33 changed files with 312 additions and 360 deletions
|
@ -20,7 +20,7 @@ Deno.test(async function emptyDirIfItNotExist(): Promise<void> {
|
|||
try {
|
||||
// check the dir
|
||||
const stat = await Deno.stat(testNestDir);
|
||||
assertEquals(stat.isDirectory(), true);
|
||||
assertEquals(stat.isDirectory, true);
|
||||
} finally {
|
||||
// remove the test dir
|
||||
await Deno.remove(testDir, { recursive: true });
|
||||
|
@ -36,7 +36,7 @@ Deno.test(function emptyDirSyncIfItNotExist(): void {
|
|||
try {
|
||||
// check the dir
|
||||
const stat = Deno.statSync(testNestDir);
|
||||
assertEquals(stat.isDirectory(), true);
|
||||
assertEquals(stat.isDirectory, true);
|
||||
} finally {
|
||||
// remove the test dir
|
||||
Deno.removeSync(testDir, { recursive: true });
|
||||
|
@ -54,10 +54,10 @@ Deno.test(async function emptyDirIfItExist(): Promise<void> {
|
|||
|
||||
// before empty: make sure file/directory exist
|
||||
const beforeFileStat = await Deno.stat(testDirFile);
|
||||
assertEquals(beforeFileStat.isFile(), true);
|
||||
assertEquals(beforeFileStat.isFile, true);
|
||||
|
||||
const beforeDirStat = await Deno.stat(testNestDir);
|
||||
assertEquals(beforeDirStat.isDirectory(), true);
|
||||
assertEquals(beforeDirStat.isDirectory, true);
|
||||
|
||||
await emptyDir(testDir);
|
||||
|
||||
|
@ -65,7 +65,7 @@ Deno.test(async function emptyDirIfItExist(): Promise<void> {
|
|||
try {
|
||||
// test dir still there
|
||||
const stat = await Deno.stat(testDir);
|
||||
assertEquals(stat.isDirectory(), true);
|
||||
assertEquals(stat.isDirectory, true);
|
||||
|
||||
// nest directory have been remove
|
||||
await assertThrowsAsync(
|
||||
|
@ -97,10 +97,10 @@ Deno.test(function emptyDirSyncIfItExist(): void {
|
|||
|
||||
// before empty: make sure file/directory exist
|
||||
const beforeFileStat = Deno.statSync(testDirFile);
|
||||
assertEquals(beforeFileStat.isFile(), true);
|
||||
assertEquals(beforeFileStat.isFile, true);
|
||||
|
||||
const beforeDirStat = Deno.statSync(testNestDir);
|
||||
assertEquals(beforeDirStat.isDirectory(), true);
|
||||
assertEquals(beforeDirStat.isDirectory, true);
|
||||
|
||||
emptyDirSync(testDir);
|
||||
|
||||
|
@ -108,7 +108,7 @@ Deno.test(function emptyDirSyncIfItExist(): void {
|
|||
try {
|
||||
// test dir still there
|
||||
const stat = Deno.statSync(testDir);
|
||||
assertEquals(stat.isDirectory(), true);
|
||||
assertEquals(stat.isDirectory, true);
|
||||
|
||||
// nest directory have been remove
|
||||
assertThrows((): void => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue