-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[html coverage report] #7528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[html coverage report] #7528
Conversation
🦋 Changeset detectedLatest commit: b26e193 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
hardhatTotal size of the bundle: List of dependencies (sorted by size) |
v-next/hardhat/assets/index.js
Outdated
| @@ -0,0 +1,2 @@ | |||
| import libCoverage from "./lib-coverage/index.cjs"; | |||
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.
This is a "bridge" to expose the common js code into ESM js code, so that the ts file can then import it
| "pretest": "pnpm build", | ||
| "pretest:only": "pnpm build", | ||
| "build": "tsc --build .", | ||
| "postbuild": "node dist/src/copy-assets.js", |
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.
This step is required to copy the assets folder, which contains the CSS and JS files used to generate the report, into the dist folder after compilation
| @@ -0,0 +1,33 @@ | |||
| import { cp } from "node:fs/promises"; | |||
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.
This function is invoked by the postbuild in the package.json file.
Used to copy the assets folder, which contains the CSS and JS files used to generate the report, into the dist folder after compilation
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.
I'm open to better ideas to solve this issue
| @@ -0,0 +1,13 @@ | |||
| { | |||
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.
I need a double-check here. I copied the configuration from tsconfig.base.json, but removed all the properties that would cause errors during compilation, since this folder contains non-ESM files
| report: Report, | ||
| htmlReportPath: string, | ||
| ): Promise<void> { | ||
| const baseDir = process.cwd(); |
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.
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.
This file is intentionally empty to prevent build errors and avoid changing the default scripts in package.json

Link to internal design doc: https://www.notion.so/nomicfoundation/Code-coverage-HTML-report-286578cdeaf580bcad22db58ce54fb47?source=copy_link
As listed in the design doc, this PR addresses point number 1 out of 3:
TODOs before merge
NOTEs for review
v-next/hardhat-vendored/src/coverage-modulehas been copied from vendored packages, so there’s no need for a deep review, a quick scan will be sufficient