Skip to content

Commit

Permalink
chore: add coverage report (#22)
Browse files Browse the repository at this point in the history
* chore: add coverage report
  • Loading branch information
joepegler authored Mar 13, 2024
1 parent 391644c commit 8413e50
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 16 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ on:
jobs:
coverage:
name: coverage
permissions: write-all
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- uses: actions/checkout@v3

Expand All @@ -17,4 +20,12 @@ jobs:
env:
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
BUNDLER_URL: ${{ secrets.BUNDLER_URL }}
PAYMASTER_URL: ${{ secrets.PAYMASTER_URL }}
PAYMASTER_URL: ${{ secrets.PAYMASTER_URL }}

- name: report coverage
uses: davelosert/vitest-coverage-report-action@v2
with:
json-summary-path : ./coverage/coverage-summary.json
json-final-path: './coverage/coverage-final.json'
vite-config-path: ./tests/vitest.config.ts
github-token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ _.seed
lib-cov

# Coverage directory used by tools like istanbul

coverage
*.lcov

# nyc test coverage
Expand Down
19 changes: 19 additions & 0 deletions coverage/coverage-final.json

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions coverage/coverage-summary.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{"total": {"lines":{"total":1587,"covered":1366,"skipped":0,"pct":86.07},"statements":{"total":1587,"covered":1366,"skipped":0,"pct":86.07},"functions":{"total":49,"covered":35,"skipped":0,"pct":71.42},"branches":{"total":66,"covered":45,"skipped":0,"pct":68.18},"branchesTrue":{"total":0,"covered":0,"skipped":0,"pct":100}}
,"/Users/joepegler/Workspace/sdk/src/account/createSmartAccount.ts": {"lines":{"total":333,"covered":226,"skipped":0,"pct":67.86},"functions":{"total":15,"covered":5,"skipped":0,"pct":33.33},"statements":{"total":333,"covered":226,"skipped":0,"pct":67.86},"branches":{"total":13,"covered":11,"skipped":0,"pct":84.61}}
,"/Users/joepegler/Workspace/sdk/src/account/index.ts": {"lines":{"total":5,"covered":5,"skipped":0,"pct":100},"functions":{"total":0,"covered":0,"skipped":0,"pct":100},"statements":{"total":5,"covered":5,"skipped":0,"pct":100},"branches":{"total":0,"covered":0,"skipped":0,"pct":100}}
,"/Users/joepegler/Workspace/sdk/src/account/actions/getAccountAddress.ts": {"lines":{"total":66,"covered":64,"skipped":0,"pct":96.96},"functions":{"total":1,"covered":1,"skipped":0,"pct":100},"statements":{"total":66,"covered":64,"skipped":0,"pct":96.96},"branches":{"total":2,"covered":1,"skipped":0,"pct":50}}
,"/Users/joepegler/Workspace/sdk/src/account/utils/abis.ts": {"lines":{"total":247,"covered":247,"skipped":0,"pct":100},"functions":{"total":0,"covered":0,"skipped":0,"pct":100},"statements":{"total":247,"covered":247,"skipped":0,"pct":100},"branches":{"total":0,"covered":0,"skipped":0,"pct":100}}
,"/Users/joepegler/Workspace/sdk/src/account/utils/constants.ts": {"lines":{"total":54,"covered":54,"skipped":0,"pct":100},"functions":{"total":0,"covered":0,"skipped":0,"pct":100},"statements":{"total":54,"covered":54,"skipped":0,"pct":100},"branches":{"total":0,"covered":0,"skipped":0,"pct":100}}
,"/Users/joepegler/Workspace/sdk/src/account/utils/errors.ts": {"lines":{"total":17,"covered":17,"skipped":0,"pct":100},"functions":{"total":1,"covered":1,"skipped":0,"pct":100},"statements":{"total":17,"covered":17,"skipped":0,"pct":100},"branches":{"total":1,"covered":1,"skipped":0,"pct":100}}
,"/Users/joepegler/Workspace/sdk/src/account/utils/helpers.ts": {"lines":{"total":426,"covered":362,"skipped":0,"pct":84.97},"functions":{"total":13,"covered":13,"skipped":0,"pct":100},"statements":{"total":426,"covered":362,"skipped":0,"pct":84.97},"branches":{"total":27,"covered":15,"skipped":0,"pct":55.55}}
,"/Users/joepegler/Workspace/sdk/src/bundler/createBundlerClient.ts": {"lines":{"total":57,"covered":57,"skipped":0,"pct":100},"functions":{"total":1,"covered":1,"skipped":0,"pct":100},"statements":{"total":57,"covered":57,"skipped":0,"pct":100},"branches":{"total":1,"covered":1,"skipped":0,"pct":100}}
,"/Users/joepegler/Workspace/sdk/src/bundler/actions/chainId.ts": {"lines":{"total":27,"covered":27,"skipped":0,"pct":100},"functions":{"total":1,"covered":1,"skipped":0,"pct":100},"statements":{"total":27,"covered":27,"skipped":0,"pct":100},"branches":{"total":1,"covered":1,"skipped":0,"pct":100}}
,"/Users/joepegler/Workspace/sdk/src/bundler/actions/index.ts": {"lines":{"total":17,"covered":17,"skipped":0,"pct":100},"functions":{"total":2,"covered":2,"skipped":0,"pct":100},"statements":{"total":17,"covered":17,"skipped":0,"pct":100},"branches":{"total":3,"covered":3,"skipped":0,"pct":100}}
,"/Users/joepegler/Workspace/sdk/src/bundler/utils/helpers.ts": {"lines":{"total":18,"covered":14,"skipped":0,"pct":77.77},"functions":{"total":1,"covered":1,"skipped":0,"pct":100},"statements":{"total":18,"covered":14,"skipped":0,"pct":77.77},"branches":{"total":3,"covered":1,"skipped":0,"pct":33.33}}
,"/Users/joepegler/Workspace/sdk/src/client/createSmartAccountClient.ts": {"lines":{"total":91,"covered":91,"skipped":0,"pct":100},"functions":{"total":1,"covered":1,"skipped":0,"pct":100},"statements":{"total":91,"covered":91,"skipped":0,"pct":100},"branches":{"total":1,"covered":1,"skipped":0,"pct":100}}
,"/Users/joepegler/Workspace/sdk/src/modules/index.ts": {"lines":{"total":7,"covered":7,"skipped":0,"pct":100},"functions":{"total":0,"covered":0,"skipped":0,"pct":100},"statements":{"total":7,"covered":7,"skipped":0,"pct":100},"branches":{"total":0,"covered":0,"skipped":0,"pct":100}}
,"/Users/joepegler/Workspace/sdk/src/modules/ecdsaOwnershipValidationModule/createECDSAOwnershipModule.ts": {"lines":{"total":128,"covered":88,"skipped":0,"pct":68.75},"functions":{"total":8,"covered":4,"skipped":0,"pct":50},"statements":{"total":128,"covered":88,"skipped":0,"pct":68.75},"branches":{"total":6,"covered":4,"skipped":0,"pct":66.66}}
,"/Users/joepegler/Workspace/sdk/src/paymaster/createPaymasterClient.ts": {"lines":{"total":56,"covered":56,"skipped":0,"pct":100},"functions":{"total":1,"covered":1,"skipped":0,"pct":100},"statements":{"total":56,"covered":56,"skipped":0,"pct":100},"branches":{"total":1,"covered":1,"skipped":0,"pct":100}}
,"/Users/joepegler/Workspace/sdk/src/paymaster/actions/index.ts": {"lines":{"total":17,"covered":17,"skipped":0,"pct":100},"functions":{"total":2,"covered":2,"skipped":0,"pct":100},"statements":{"total":17,"covered":17,"skipped":0,"pct":100},"branches":{"total":3,"covered":3,"skipped":0,"pct":100}}
,"/Users/joepegler/Workspace/sdk/src/paymaster/actions/sponsorUserOperation.ts": {"lines":{"total":3,"covered":3,"skipped":0,"pct":100},"functions":{"total":1,"covered":1,"skipped":0,"pct":100},"statements":{"total":3,"covered":3,"skipped":0,"pct":100},"branches":{"total":1,"covered":1,"skipped":0,"pct":100}}
,"/Users/joepegler/Workspace/sdk/src/paymaster/utils/helpers.ts": {"lines":{"total":18,"covered":14,"skipped":0,"pct":77.77},"functions":{"total":1,"covered":1,"skipped":0,"pct":100},"statements":{"total":18,"covered":14,"skipped":0,"pct":77.77},"branches":{"total":3,"covered":1,"skipped":0,"pct":33.33}}
}
2 changes: 0 additions & 2 deletions src/client/createSmartAccountClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ export type SmartAccountClient<
/**
* Creates a EIP-4337 compliant Bundler Client with a given [Transport](https://viem.sh/docs/clients/intro.html) configured for a [Chain](https://viem.sh/docs/clients/chains.html).
*
* - Docs: https://docs.pimlico.io/permissionless/reference/clients/smartAccountClient
*
* A Bundler Client is an interface to "erc 4337" [JSON-RPC API](https://eips.ethereum.org/EIPS/eip-4337#rpc-methods-eth-namespace) methods such as sending user operation, estimating gas for a user operation, get user operation receipt, etc through Bundler Actions.
*
* @param parameters - {@link WalletClientConfig}
Expand Down
2 changes: 0 additions & 2 deletions tests/account.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ describe("Biconomy Smart Account core tests", () => {
chain: baseSepolia,
bundlerTransport: http(bundlerUrl)
})

console.log(smartAccountClient, "CLIENT")
})

test("Should get account address + nonce", async () => {
Expand Down
4 changes: 0 additions & 4 deletions tests/modules/ecdsaOwnershipModule.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,17 @@ describe("Biconomy Smart Account core tests", () => {

test("Should get account address + nonce", async () => {
const address = smartAccount.address
console.log("Smart Account Address: ", address)

const nonce = await smartAccount.getNonce()
console.log("Smart Account Nonce: ", nonce)
})

test("should get validation module address", async () => {
const response = smartAccount.defaultValidationModule.getModuleAddress()
console.log("Validation Module Address: ", response)
expect(response).toBe(DEFAULT_ECDSA_OWNERSHIP_MODULE)
})

test("should get validation module signer", async () => {
const response = await smartAccount.defaultValidationModule.getSigner()
console.log("Validation Module signer: ", response)
walletClient.account &&
expect(response.address).toBe(walletClient.account.address)
})
Expand Down
13 changes: 8 additions & 5 deletions tests/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ export default defineConfig({
coverage: {
all: false,
provider: "v8",
reporter: process.env.CI ? ["lcov"] : ["text", "json", "html"],
reporter: process.env.CI
? ["json-summary", "json"]
: ["text", "json", "html"],
exclude: [
"**/errors/utils.ts",
"**/_cjs/**",
Expand All @@ -15,11 +17,12 @@ export default defineConfig({
"**/*.test.ts",
"**/test/**"
],
include: ["src/**/*.ts"],
thresholds: {
lines: 40,
functions: 40,
branches: 40,
statements: 40
lines: 80,
functions: 70,
branches: 60,
statements: 80
}
},
environment: "node",
Expand Down

0 comments on commit 8413e50

Please sign in to comment.