Skip to content

Commit

Permalink
coverage report untested files (and misc cleanup) (#10556)
Browse files Browse the repository at this point in the history
_incidental_

## Description
The main change in this PR is to make the code coverage reports include files that aren't tested at all (or apparently aren't due to the bundling problem #1817)

It also cleans up a bunch of obsolete stuff about NESM and adds some more usage docs.

### Security Considerations
none

### Scaling Considerations
n/a

### Documentation Considerations
Improves

### Testing Considerations
I ran the commands locally to verify the reports. Once this lands they'll appear at https://agoric-sdk-coverage.netlify.app/

### Upgrade Considerations
n/a
  • Loading branch information
mergify[bot] authored Nov 23, 2024
2 parents c951fdc + 8efce30 commit 5cfb99b
Show file tree
Hide file tree
Showing 36 changed files with 117 additions and 215 deletions.
47 changes: 10 additions & 37 deletions COVERAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,59 +2,32 @@

## Caveat

Until each module can be migrated to support Node.js's builtin ESM
implementation (`nesm`), the coverage line numbers will be out-of-sync with
reality.

In addition, we will have to implement source maps in all of our
Lines from bundled code cannot be detected until we implement source maps in all of our
source-to-source transforms (such as `@endo/bundle-source`,
`@agoric/transform-metering`, and `@agoric/static-module-record`).

## Reports

Coverage reports for the current main branch (whose packages support `nesm`) are
Coverage reports for the current main branch are
published by CI to: https://agoric-sdk-coverage.netlify.app

You can create a report in any package (including the top-level directory):
You can create a report in any package:

```sh
yarn test:c8
```

For more flexibility:
```sh
# Get options available for coverage:
yarn c8 --help
# Run ava under Node.js coverage and display a summary:
yarn c8 -a ava
# Run a particular test
yarn c8 -a ava test/foo.test.js
# Generate a nice, detailed HTML report:
yarn c8 report --reporter=html-spa
open coverage/html/index.html
```

## Node.js ESM Support

With the current `patches/esm+3.2.25.diff`, it is possible to migrate packages
to support both resm (`-r esm`) and nesm (Node.js ESM Support). If an
`agoric-sdk` package has dependencies that support nesm, you can attempt to make
it also support nesm by:

1. Create `ava-nesm.config.js` removing `"require": ["esm"]`:

```sh
../../scripts/ava-nesm.cjs > ava-nesm.config.js
```

2. Make the following changes to its `package.json` (omitting comments):

```js
{
// Enable nesm support.
"type": "module",
"scripts": {
// The following line enables coverage generation from the top.
"test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js"
}
}
```

3. Test that both `yarn test` and `yarn test:c8` run correctly.

## Planned Implementation

Our runtime source transforms can be conditional on the `$NODE_V8_COVERAGE`
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@types/express": "^4.17.17",
"@types/node": "^22.0.0",
"ava": "^5.3.0",
"c8": "^9.1.0",
"c8": "^10.1.2",
"conventional-changelog-conventionalcommits": "^4.6.0",
"eslint": "^8.57.0",
"eslint-config-airbnb-base": "^15.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/access-token/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"scripts": {
"build": "exit 0",
"test": "ava",
"test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js",
"test:c8": "c8 --all ava",
"test:xs": "exit 0",
"lint": "run-s --continue-on-error lint:*",
"lint-fix": "yarn lint:eslint --fix",
Expand All @@ -26,7 +26,7 @@
"@types/n-readlines": "^1.0.3",
"@types/proper-lockfile": "^4.1.2",
"ava": "^5.3.0",
"c8": "^9.1.0"
"c8": "^10.1.2"
},
"publishConfig": {
"access": "public"
Expand Down
4 changes: 2 additions & 2 deletions packages/agoric-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"scripts": {
"build": "node ./scripts/get-sdk-package-names.js > src/sdk-package-names.js",
"test": "ava",
"test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js",
"test:c8": "c8 --all ava",
"test:xs": "exit 0",
"integration-test": "ava --config .ava-integration-test.config.js",
"lint-fix": "yarn lint:eslint --fix",
Expand All @@ -32,7 +32,7 @@
"@agoric/cosmic-swingset": "^0.41.3",
"@agoric/deploy-script-support": "^0.10.3",
"ava": "^5.3.0",
"c8": "^9.1.0",
"c8": "^10.1.2",
"dd-trace": "^4.11.1"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/async-flow/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"prepack": "tsc --build tsconfig.build.json",
"postpack": "git clean -f '*.d.ts*' '*.tsbuildinfo'",
"test": "ava",
"test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js",
"test:c8": "c8 --all ava",
"test:xs": "exit 0",
"lint-fix": "yarn lint:eslint --fix",
"lint": "run-s --continue-on-error lint:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/base-zone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"prepack": "tsc --build tsconfig.build.json",
"postpack": "git clean -f '*.d.ts*' '*.tsbuildinfo'",
"test": "ava",
"test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js",
"test:c8": "c8 --all ava",
"test:xs": "exit 0",
"lint-fix": "yarn lint:eslint --fix",
"lint": "run-s --continue-on-error lint:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/boot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"@endo/base64": "^1.0.9",
"@endo/patterns": "^1.4.7",
"ava": "^5.3.0",
"c8": "^9.1.0",
"c8": "^10.1.2",
"ts-blank-space": "^0.4.1"
},
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/builders/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"@agoric/swingset-liveslots": "^0.10.2",
"@agoric/time": "^0.3.2",
"ava": "^5.3.0",
"c8": "^9.1.0"
"c8": "^10.1.2"
},
"files": [
"CHANGELOG.md",
Expand Down
4 changes: 2 additions & 2 deletions packages/cache/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"scripts": {
"build": "exit 0",
"test": "ava",
"test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js",
"test:c8": "c8 --all ava",
"test:xs": "exit 0",
"lint-fix": "yarn lint:eslint --fix",
"lint": "run-s --continue-on-error lint:*",
Expand All @@ -29,7 +29,7 @@
"devDependencies": {
"@agoric/zoe": "^0.26.2",
"ava": "^5.3.0",
"c8": "^9.1.0"
"c8": "^10.1.2"
},
"publishConfig": {
"access": "public"
Expand Down
4 changes: 2 additions & 2 deletions packages/casting/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"postpack": "git clean -f '*.d.ts*' '*.tsbuildinfo'",
"demo": "node -e 'import(\"./test/fake-rpc-server.js\").then(ns => ns.develop())'",
"test": "ava",
"test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js",
"test:c8": "c8 --all ava",
"test:xs": "exit 0",
"lint-fix": "yarn lint:eslint --fix",
"lint": "run-s --continue-on-error lint:*",
Expand Down Expand Up @@ -40,7 +40,7 @@
"@agoric/cosmic-proto": "^0.4.0",
"@endo/ses-ava": "^1.2.8",
"ava": "^5.3.0",
"c8": "^9.1.0",
"c8": "^10.1.2",
"express": "^5.0.1",
"ws": "^7.2.0"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/client-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"scripts": {
"build": "exit 0",
"test": "ava",
"test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js",
"test:c8": "c8 --all ava",
"test:xs": "exit 0",
"lint-fix": "yarn lint:eslint --fix",
"lint": "run-s --continue-on-error lint:*",
Expand All @@ -23,7 +23,7 @@
},
"devDependencies": {
"ava": "^5.3.0",
"c8": "^9.1.0",
"c8": "^10.1.2",
"ts-blank-space": "^0.4.1"
},
"dependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/cosmic-swingset/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"scripts": {
"build": "exit 0",
"test": "ava",
"test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js",
"test:c8": "c8 --all ava",
"test:xs": "exit 0",
"lint-fix": "yarn lint:eslint --fix",
"lint": "run-s --continue-on-error lint:*",
Expand Down Expand Up @@ -51,7 +51,7 @@
},
"devDependencies": {
"ava": "^5.3.0",
"c8": "^9.1.0"
"c8": "^10.1.2"
},
"publishConfig": {
"access": "public"
Expand Down
4 changes: 2 additions & 2 deletions packages/create-dapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"scripts": {
"build": "exit 0",
"test": "ava",
"test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js",
"test:c8": "c8 --all ava",
"test:xs": "exit 0",
"lint-fix": "yarn lint:eslint --fix",
"lint": "run-s --continue-on-error lint:*",
Expand All @@ -21,7 +21,7 @@
},
"devDependencies": {
"ava": "^5.3.0",
"c8": "^9.1.0"
"c8": "^10.1.2"
},
"dependencies": {
"agoric": "^0.21.1"
Expand Down
4 changes: 2 additions & 2 deletions packages/fast-usdc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"scripts": {
"build": "exit 0",
"test": "ava",
"test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js",
"test:c8": "c8 --all ava",
"test:xs": "exit 0",
"lint-fix": "yarn lint:eslint --fix",
"lint": "run-s --continue-on-error lint:*",
Expand All @@ -26,7 +26,7 @@
"@agoric/zone": "^0.2.2",
"@fast-check/ava": "^2.0.1",
"ava": "^5.3.0",
"c8": "^9.1.0",
"c8": "^10.1.2",
"execa": "9.1.0",
"ts-blank-space": "^0.4.1"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/governance/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"prepack": "tsc --build tsconfig.build.json",
"postpack": "git clean -f '*.d.ts*' '*.tsbuildinfo'",
"test": "ava",
"test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js",
"test:c8": "c8 --all ava",
"test:xs": "exit 0",
"lint-fix": "yarn lint:eslint --fix",
"lint": "run-s --continue-on-error lint:*",
Expand Down Expand Up @@ -53,7 +53,7 @@
"@endo/bundle-source": "^3.5.0",
"@endo/init": "^1.1.7",
"ava": "^5.3.0",
"c8": "^9.1.0"
"c8": "^10.1.2"
},
"files": [
"README.md",
Expand Down
4 changes: 2 additions & 2 deletions packages/import-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"scripts": {
"build": "exit 0",
"test": "ava",
"test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js",
"test:c8": "c8 --all ava",
"test:xs": "exit 0",
"lint": "yarn lint:eslint",
"lint-fix": "yarn lint:eslint --fix",
Expand All @@ -32,7 +32,7 @@
"devDependencies": {
"@agoric/swingset-vat": "^0.32.2",
"ava": "^5.3.0",
"c8": "^9.1.0"
"c8": "^10.1.2"
},
"files": [
"src/",
Expand Down
4 changes: 2 additions & 2 deletions packages/inter-protocol/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"prepack": "tsc --build tsconfig.build.json",
"postpack": "git clean -f '*.d.ts*' '*.tsbuildinfo'",
"test": "ava",
"test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js",
"test:c8": "c8 --all ava",
"test:xs": "exit 0",
"lint-fix": "yarn lint:eslint --fix",
"lint": "run-s --continue-on-error lint:*",
Expand Down Expand Up @@ -59,7 +59,7 @@
"@endo/promise-kit": "^1.1.8",
"@fast-check/ava": "^1.1.5",
"ava": "^5.3.0",
"c8": "^9.1.0",
"c8": "^10.1.2",
"deep-object-diff": "^1.1.9",
"import-meta-resolve": "^2.2.1"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/kmarshal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"scripts": {
"build": "exit 0",
"test": "ava",
"test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js",
"test:c8": "c8 --all ava",
"test:xs": "exit 0",
"lint-fix": "yarn lint:eslint --fix",
"lint": "run-s --continue-on-error lint:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/network/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"@agoric/zone": "^0.2.2",
"@endo/bundle-source": "^3.5.0",
"ava": "^5.3.0",
"c8": "^9.1.0"
"c8": "^10.1.2"
},
"exports": {
".": "./src/index.js"
Expand Down
4 changes: 2 additions & 2 deletions packages/notifier/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"prepack": "tsc --build tsconfig.build.json",
"postpack": "git clean -f '*.d.ts*' '*.tsbuildinfo'",
"test": "ava",
"test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js",
"test:c8": "c8 --all ava",
"test:xs": "exit 0",
"lint-fix": "yarn lint:eslint --fix",
"lint": "run-s --continue-on-error lint:*",
Expand Down Expand Up @@ -49,7 +49,7 @@
"@endo/init": "^1.1.7",
"@endo/ses-ava": "^1.2.8",
"ava": "^5.3.0",
"c8": "^9.1.0"
"c8": "^10.1.2"
},
"exports": {
".": "./src/index.js",
Expand Down
4 changes: 2 additions & 2 deletions packages/orchestration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"prepack": "tsc --build tsconfig.build.json",
"postpack": "git clean -f '*.d.ts*' '*.tsbuildinfo'",
"test": "ava",
"test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js",
"test:c8": "c8 --all ava",
"test:xs": "exit 0",
"lint": "run-s --continue-on-error lint:*",
"lint:types": "tsc",
Expand Down Expand Up @@ -62,7 +62,7 @@
"@endo/import-bundle": "^1.3.2",
"@endo/ses-ava": "^1.2.8",
"ava": "^5.3.1",
"c8": "^9.1.0",
"c8": "^10.1.2",
"prettier": "^3.3.2",
"ts-blank-space": "^0.4.1"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/pegasus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"scripts": {
"build": "exit 0",
"test": "ava",
"test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js",
"test:c8": "c8 --all ava",
"test:xs": "exit 0",
"lint-fix": "yarn lint:eslint --fix",
"lint": "run-s --continue-on-error lint:*",
Expand Down Expand Up @@ -48,7 +48,7 @@
},
"devDependencies": {
"ava": "^5.3.0",
"c8": "^9.1.0",
"c8": "^10.1.2",
"import-meta-resolve": "^2.2.1",
"@agoric/vat-data": "^0.5.2"
},
Expand Down
Loading

0 comments on commit 5cfb99b

Please sign in to comment.