-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
fix(coverage): ignore urls from doc testing #25736
Conversation
cli/tools/coverage/mod.rs
Outdated
@@ -452,6 +452,10 @@ fn filter_coverages( | |||
let exclude: Vec<Regex> = | |||
exclude.iter().map(|e| Regex::new(e).unwrap()).collect(); | |||
|
|||
// Matches virtual file paths for doc testing | |||
// e.g. file:///path/to/mod.ts$23-29.ts | |||
let doc_test_re = Regex::new(r"\$\d+-\d+\.(ts|js)$").unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@magurotuna Do you know what are the possible file extensions from doc example extraction?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The extension is taken from the code fence, like:
```ts
// becomes .ts
```
```tsx
// becomes .tsx
```
Possible extensions are listed here
https://deno-docs--magurotuna-improved-doc-te.deno.dev/runtime/fundamentals/testing/#documentation-tests
- js
- javascript
- mjs
- cjs
- jsx
- ts
- typescript
- mts
- cts
- tsx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
We started executing doc examples in #25220. Because of that change, now the coverage data for generated urls like
file:///path/to/module.ts$20-30.ts
are generated, anddeno coverage
fails by trying to fetch that file from the cache. This behavior causes #25732This PR fixes the above by ignoring urls of the pattern
\$\d+-\d+\.(ts|js)$
when collecting the coverage data.closes #25732