You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying out the new deno test --doc feature in the Deno 2 release candidate. It works, but might be nicer if I didn't have to write out imports in each code block.
Version: 2.0.0-rc.4
Example
Here is an import that will be needed in the following examples:
```tsimport { assertEquals } from"@std/assert";
```
Here's an example of how to use assertEquals:
```tsassertEquals("hello".length, 5);
```
Here's a second example:
```tsassertEquals([1, 2, 3], [1, 2, 3]);
```
What it does now:
Check file:///Users/skybrian/Projects/deno/repeat-test/docs/example.md$3-6.ts
Check file:///Users/skybrian/Projects/deno/repeat-test/docs/example.md$9-12.ts
Check file:///Users/skybrian/Projects/deno/repeat-test/docs/example.md$15-18.ts
error: TS2304 [ERROR]: Cannot find name 'assertEquals'.
assertEquals([
~~~~~~~~~~~~
at file:///Users/skybrian/Projects/deno/repeat-test/docs/example.md$15-18.ts:2:5
TS2304 [ERROR]: Cannot find name 'assertEquals'.
assertEquals("hello".length, 5);
~~~~~~~~~~~~
at file:///Users/skybrian/Projects/deno/repeat-test/docs/example.md$9-12.ts:2:5
Found 2 errors.
What I'd like it to do:
Don't report any errors, because the imports were declared in a previous code block.
How would it work?
I don't know what's best, but here are some alternatives:
When there is a code block that only contains imports, automatically prepend it to each of the following code blocks.
When there is a code block that has no imports, reuse the imports from the previous code block.
Or, perhaps both rules?
The text was updated successfully, but these errors were encountered:
I'm trying out the new
deno test --doc
feature in the Deno 2 release candidate. It works, but might be nicer if I didn't have to write out imports in each code block.Version: 2.0.0-rc.4
Example
What it does now:
What I'd like it to do:
Don't report any errors, because the imports were declared in a previous code block.
How would it work?
I don't know what's best, but here are some alternatives:
Or, perhaps both rules?
The text was updated successfully, but these errors were encountered: