deno icon indicating copy to clipboard operation
deno copied to clipboard

test: `--doc` and `--watch` don't play well together

Open mfulton26 opened this issue 1 year ago • 1 comments

Version:

deno 1.45.1 (release, aarch64-apple-darwin)
v8 12.7.224.12
typescript 5.5.2

README.md:

# demo

## Example

```ts
console.log("Hello world");
```

Demo:

% deno test --doc --watch | pbcopy
Watcher Test started.
error: The module's source code could not be parsed: Expected ident at file:///path/to/README.md:3:2

  ## Example
   ~
Watcher Test failed. Restarting on file change...

It looks to me as if --watch is not accounting for watching code blocks in Markdown.

mfulton26 avatar Jul 12 '24 15:07 mfulton26

@dsherret Here's a summary of my workaround: The bug seems to be triggered by the second ## Example header in the markdown, not specifically by the watch command. If you try the same file with other commands like deno check pbcopy, the same error occurs. I traced the issue to the swc_ecma_parser module in this method: image The parser attempts to process the string ##, but it then throws an error. This issue isn’t limited to just the second header; it happens with any header level higher than one in the markdown file.

MujahedSafaa avatar Oct 29 '24 13:10 MujahedSafaa