Repository navigation
docs(testing): improve the docs of @std/testing - #5033
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5033 +/- ##
==========================================
+ Coverage 92.10% 92.12% +0.01%
==========================================
Files 487 487
Lines 38798 38865 +67
Branches 5432 5435 +3
==========================================
+ Hits 35736 35805 +69
+ Misses 3006 3005 -1
+ Partials 56 55 -1 ☔ View full report in Codecov by Sentry. |
| const TS_SNIPPET = /```ts[\s\S]*?```/g; | ||
| const ASSERTION_IMPORT = /import \{.*\} from "@std\/assert(?:\/.*)?";/gm; | ||
| const ASSERTION_IMPORT = | ||
| /from "@std\/(assert(\/[a-z-]+)?|testing\/(mock|snapshot|types))"/g; |
There was a problem hiding this comment.
Removed import \{.*\} part as this doesn't work if there are line breaks between import and from.
Also added testing\/(mock|snapshot|types) part as these files also include assertion functions.
There was a problem hiding this comment.
Having assertions spread across multiple packages is confusing. What if we moved assertions (only) to @std/assert? WDYT?
There was a problem hiding this comment.
That makes @std/assert a huge package. In the current layout, assertions are organized by the category (mock / snapshot / types). This makes more sense to me.
| * A group of tests. | ||
| */ | ||
| export interface TestSuite<T> { | ||
| /** The symbol */ |
There was a problem hiding this comment.
This doesn't seem informative.
| * @typeParam T The expected type (`true` or `false`) | ||
| * @param expectTrue - True if the passed in type argument resolved to true. | ||
| */ | ||
| export function assertType<T extends true | false>(_expectTrue: T) { | ||
| } | ||
| export function assertType<T extends true | false>( | ||
| // deno-lint-ignore no-unused-vars |
There was a problem hiding this comment.
| * @typeParam T The expected type (`true` or `false`) | |
| * @param expectTrue - True if the passed in type argument resolved to true. | |
| */ | |
| export function assertType<T extends true | false>(_expectTrue: T) { | |
| } | |
| export function assertType<T extends true | false>( | |
| // deno-lint-ignore no-unused-vars | |
| * @typeParam T The expected type | |
| * @param expectTrue - True if the passed in type argument resolved to true. | |
| */ | |
| export function assertType<T extends boolean>( | |
| // deno-lint-ignore no-unused-vars |
| }); | ||
| }; | ||
|
|
||
| /** Ignore the test suite */ |
There was a problem hiding this comment.
Can we include targeted examples for these methods?
| const TS_SNIPPET = /```ts[\s\S]*?```/g; | ||
| const ASSERTION_IMPORT = /import \{.*\} from "@std\/assert(?:\/.*)?";/gm; | ||
| const ASSERTION_IMPORT = | ||
| /from "@std\/(assert(\/[a-z-]+)?|testing\/(mock|snapshot|types))"/g; |
There was a problem hiding this comment.
Having assertions spread across multiple packages is confusing. What if we moved assertions (only) to @std/assert? WDYT?
@std/testing
iuioiua
left a comment
There was a problem hiding this comment.
Great work! Good to see this done.
| * ``` | ||
| * @param value The value to set | ||
| */ | ||
| set start(value: number) { |
There was a problem hiding this comment.
Let's remove this setter in a follow-up PR.
part of #3764