Skip to content

Commit

Permalink
add types for v8 and fix reportPath allow empty
Browse files Browse the repository at this point in the history
  • Loading branch information
cenfun committed Dec 8, 2023
1 parent 26b7df4 commit 136268e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
8 changes: 5 additions & 3 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ export type Watermarks = [number, number] | {
}

export type ReportDescription =
['v8'] |
['v8'] | ["v8", {
outputFile?: string,
inline?: boolean,
assetsPath?: string
}] |
['clover'] | ['clover', {
file?: string
}] |
Expand Down Expand Up @@ -92,10 +96,8 @@ export type CoverageReportOptions = {

// [V8 only](String) Output [sub dir/]filename. Defaults to "index.html"
outputFile?: string,

// [V8 only](Boolean) Inline all scripts to the single HTML file. Defaults to false.
inline?: boolean,

// [V8 only](String) Assets path if not inline. Defaults to "./assets"
assetsPath?: string

Expand Down
10 changes: 7 additions & 3 deletions lib/utils/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,13 @@ const Util = {
reportPath = reportPath();
}

if (reportPath && typeof reportPath === 'string') {
const p = path.resolve(options.outputDir, reportPath);
return Util.relativePath(p);
if (typeof reportPath === 'string') {
if (reportPath) {
const p = path.resolve(options.outputDir, reportPath);
return Util.relativePath(p);
}
// empty
return reportPath;
}
// using default html path as report path
return htmlPathHandler();
Expand Down

0 comments on commit 136268e

Please sign in to comment.