diff options
author | Ian Bull <irbull@eclipsesource.com> | 2024-09-13 02:38:45 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-13 11:38:45 +0200 |
commit | 606b7b17c6b5eccae9950eeb11d30e63e544b49d (patch) | |
tree | 50bbd9ab8209a4a0e32d64cf4d19a744f3dd6e71 /tests/unit | |
parent | 7477c2d70639962a40c7333e766b4a4b4aa75ddd (diff) |
refactor(runtime): align error messages (#25563)
Aligns the error messages in the runtime folder to be in-line with the
Deno style guide.
https://github.com/denoland/deno/issues/25269
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/command_test.ts | 56 | ||||
-rw-r--r-- | tests/unit/permissions_test.ts | 4 |
2 files changed, 48 insertions, 12 deletions
diff --git a/tests/unit/command_test.ts b/tests/unit/command_test.ts index 0a7891493..523d20cf3 100644 --- a/tests/unit/command_test.ts +++ b/tests/unit/command_test.ts @@ -73,8 +73,16 @@ Deno.test( }); const child = command.spawn(); - assertThrows(() => child.stdout, TypeError, "stdout is not piped"); - assertThrows(() => child.stderr, TypeError, "stderr is not piped"); + assertThrows( + () => child.stdout, + TypeError, + "Cannot get 'stdout': 'stdout' is not piped", + ); + assertThrows( + () => child.stderr, + TypeError, + "Cannot get 'stderr': 'stderr' is not piped", + ); const msg = new TextEncoder().encode("hello"); const writer = child.stdin.getWriter(); @@ -99,9 +107,21 @@ Deno.test( }); const child = command.spawn(); - assertThrows(() => child.stdin, TypeError, "stdin is not piped"); - assertThrows(() => child.stdout, TypeError, "stdout is not piped"); - assertThrows(() => child.stderr, TypeError, "stderr is not piped"); + assertThrows( + () => child.stdin, + TypeError, + "Cannot get 'stdin': 'stdin' is not piped", + ); + assertThrows( + () => child.stdout, + TypeError, + "Cannot get 'stdout': 'stdout' is not piped", + ); + assertThrows( + () => child.stderr, + TypeError, + "Cannot get 'stderr': 'stderr' is not piped", + ); await child.status; }, @@ -120,8 +140,16 @@ Deno.test( }); const child = command.spawn(); - assertThrows(() => child.stdin, TypeError, "stdin is not piped"); - assertThrows(() => child.stderr, TypeError, "stderr is not piped"); + assertThrows( + () => child.stdin, + TypeError, + "Cannot get 'stdin': 'stdin' is not piped", + ); + assertThrows( + () => child.stderr, + TypeError, + "Cannot get 'stderr': 'stderr' is not piped", + ); const readable = child.stdout.pipeThrough(new TextDecoderStream()); const reader = readable.getReader(); @@ -154,8 +182,16 @@ Deno.test( }); const child = command.spawn(); - assertThrows(() => child.stdin, TypeError, "stdin is not piped"); - assertThrows(() => child.stdout, TypeError, "stdout is not piped"); + assertThrows( + () => child.stdin, + TypeError, + "Cannot get 'stdin': 'stdin' is not piped", + ); + assertThrows( + () => child.stdout, + TypeError, + "Cannot get 'stdout': 'stdout' is not piped", + ); const readable = child.stderr.pipeThrough(new TextDecoderStream()); const reader = readable.getReader(); @@ -955,7 +991,7 @@ Deno.test( assertThrows( () => child.kill(), TypeError, - "Child process has already terminated.", + "Child process has already terminated", ); }, ); diff --git a/tests/unit/permissions_test.ts b/tests/unit/permissions_test.ts index e18b0c8f2..82524d556 100644 --- a/tests/unit/permissions_test.ts +++ b/tests/unit/permissions_test.ts @@ -120,7 +120,7 @@ Deno.test(function permissionQueryForReadReturnsSameStatusSync() { }); Deno.test(function permissionsIllegalConstructor() { - assertThrows(() => new Deno.Permissions(), TypeError, "Illegal constructor."); + assertThrows(() => new Deno.Permissions(), TypeError, "Illegal constructor"); assertEquals(Deno.Permissions.length, 0); }); @@ -128,7 +128,7 @@ Deno.test(function permissionStatusIllegalConstructor() { assertThrows( () => new Deno.PermissionStatus(), TypeError, - "Illegal constructor.", + "Illegal constructor", ); assertEquals(Deno.PermissionStatus.length, 0); }); |