Anthony2be
Anthony2be2y ago

How to test if a file was created?

I'm making a deno library that creates some folders and files, how can i check if it generates then correctly?
4 Replies
Beast
Beast2y ago
try {
await Deno.open("/path_to_file");
} catch (error) {
if (error instanceof Deno.errors.NotFound) throw error;
}
try {
await Deno.open("/path_to_file");
} catch (error) {
if (error instanceof Deno.errors.NotFound) throw error;
}
Doctor 🤖
Doctor 🤖2y ago
Deno.mkdir will throw an error if it fails to create a directory. Including if the directory already exists.
Anthony2be
Anthony2be2y ago
do i just plop this in my test file or what?
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View