diff --git a/ext/fs/30_fs.js b/ext/fs/30_fs.js index 40513e7e0239cb..fc2b18be1373d9 100644 --- a/ext/fs/30_fs.js +++ b/ext/fs/30_fs.js @@ -578,7 +578,7 @@ class FsFile { this.#rid = rid; if (!symbol || symbol !== SymbolFor("Deno.internal.FsFile")) { throw new TypeError( - "`Deno.FsFile` cannot be constructed, use `Deno.open()` or `Deno.openSync()` instead.", + "'Deno.FsFile' cannot be constructed, use 'Deno.open()' or 'Deno.openSync()' instead", ); } } @@ -713,11 +713,15 @@ function checkOpenOptions(options) { (val) => val === true, ).length === 0 ) { - throw new Error("OpenOptions requires at least one option to be true"); + throw new Error( + "'options' requires at least one option to be true", + ); } if (options.truncate && !options.write) { - throw new Error("'truncate' option requires 'write' option"); + throw new Error( + "'truncate' option requires 'write' to be true", + ); } const createOrCreateNewWithoutWriteOrAppend = @@ -726,7 +730,7 @@ function checkOpenOptions(options) { if (createOrCreateNewWithoutWriteOrAppend) { throw new Error( - "'create' or 'createNew' options require 'write' or 'append' option", + "'create' or 'createNew' options require 'write' or 'append' to be true", ); } } diff --git a/tests/unit/files_test.ts b/tests/unit/files_test.ts index a847104c280650..c22d3deb77e230 100644 --- a/tests/unit/files_test.ts +++ b/tests/unit/files_test.ts @@ -137,7 +137,7 @@ Deno.test(async function openOptions() { await Deno.open(filename, { write: false }); }, Error, - "OpenOptions requires at least one option to be true", + "'options' requires at least one option to be true", ); await assertRejects( @@ -145,7 +145,7 @@ Deno.test(async function openOptions() { await Deno.open(filename, { truncate: true, write: false }); }, Error, - "'truncate' option requires 'write' option", + "'truncate' option requires 'write' to be true", ); await assertRejects( @@ -153,7 +153,7 @@ Deno.test(async function openOptions() { await Deno.open(filename, { create: true, write: false }); }, Error, - "'create' or 'createNew' options require 'write' or 'append' option", + "'create' or 'createNew' options require 'write' or 'append' to be true", ); await assertRejects( @@ -161,7 +161,7 @@ Deno.test(async function openOptions() { await Deno.open(filename, { createNew: true, append: false }); }, Error, - "'create' or 'createNew' options require 'write' or 'append' option", + "'create' or 'createNew' options require 'write' or 'append' to be true", ); });