Skip to content

Monocart - #4230

Open
MicahMaphet wants to merge 7 commits into
bitpay:masterfrom
MicahMaphet:monocart
Open

Monocart#4230
MicahMaphet wants to merge 7 commits into
bitpay:masterfrom
MicahMaphet:monocart

Conversation

@MicahMaphet

@MicahMaphet MicahMaphet commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Description 🪶

Use monocart for coverage because it supports ESM.

Changelog 📝

  • installed monocart globally and in crypto-rpc
  • mcr.config.js config files in packages
  • coverage-builder.js file for standardizing a config
  • switch from .mocharc.yml to .mocharc.json
  • use require imports in bitcore-client tests to import bitcore-node files

Testing Notes 🥼

The coverage should all be passing for this PR with the thresholds just a little below the current coverage.


Checklist

  • I have read CONTRIBUTING.md and verified that this PR follows the guidelines and requirements outlined in it.

@MicahMaphet
MicahMaphet marked this pull request as ready for review September 1, 2026 02:44
@kajoseph
kajoseph requested a lite review from Copilot September 3, 2026 14:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

As written, Mocha discovery/coverage setup is likely broken due to an invalid extension configuration and an ESM/CommonJS mismatch in coverage-builder.js that would prevent mcr.config.js from loading.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Switches the monorepo’s JS/TS test coverage tooling from NYC/c8 to Monocart Coverage Reports (mcr) to better support ESM packages while standardizing coverage configuration across packages.

Changes:

  • Replaced nyc/c8 coverage invocations with mcr mocha ... across multiple package test scripts.
  • Added per-package mcr.config.js files plus a shared coverage-builder.js to centralize thresholds/filtering.
  • Migrated Mocha configuration from .mocharc.yml to .mocharc.json and updated a few tests (timeouts + require-based imports for built artifacts).
File summaries
File Description
packages/crypto-wallet-core/package.json Switch test script from nyc to mcr.
packages/crypto-wallet-core/mcr.config.js Add Monocart coverage configuration using shared builder.
packages/crypto-wallet-core/.nycrc.yml Remove NYC config.
packages/crypto-wallet-core/.mocharc.yml Remove YAML Mocha config.
packages/crypto-wallet-core/.mocharc.json Add JSON Mocha config for recursive test discovery.
packages/crypto-rpc/package.json Switch docker test coverage to mcr, replace c8 with Monocart dependency.
packages/crypto-rpc/mcr.config.js Add ESM Monocart coverage config.
packages/crypto-rpc/coverage-builder.js Add package-local coverage builder helper (ESM).
packages/crypto-rpc/.mocharc.yml Remove YAML Mocha config.
packages/crypto-rpc/.mocharc.json Add JSON Mocha config.
packages/bitcore-wallet-service/package.json Switch test script from nyc to mcr.
packages/bitcore-wallet-service/mcr.config.js Add Monocart coverage configuration using shared builder.
packages/bitcore-wallet-service/.nycrc.yml Remove NYC config.
packages/bitcore-wallet-service/.mocharc.yml Remove YAML Mocha config.
packages/bitcore-wallet-service/.mocharc.json Add JSON Mocha config.
packages/bitcore-wallet-client/test/api.test.ts Increase suite timeout.
packages/bitcore-wallet-client/package.json Switch test script from nyc to mcr.
packages/bitcore-wallet-client/mcr.config.js Add Monocart coverage configuration using shared builder.
packages/bitcore-wallet-client/.nycrc.yml Remove NYC config.
packages/bitcore-wallet-client/.mocharc.yml Remove YAML Mocha config.
packages/bitcore-wallet-client/.mocharc.json Add JSON Mocha config.
packages/bitcore-tss/package.json Switch mocha coverage script from nyc to mcr.
packages/bitcore-tss/mcr.config.js Add Monocart coverage configuration using shared builder.
packages/bitcore-tss/.nycrc.yml Remove NYC config.
packages/bitcore-tss/.mocharc.json Add JSON Mocha config.
packages/bitcore-p2p/mcr.config.js Add Monocart coverage configuration using shared builder.
packages/bitcore-p2p/.nycrc.yml Remove NYC config.
packages/bitcore-p2p-doge/mcr.config.js Add Monocart coverage configuration using shared builder.
packages/bitcore-p2p-doge/.nycrc.yml Remove NYC config.
packages/bitcore-p2p-cash/mcr.config.js Add Monocart coverage configuration using shared builder.
packages/bitcore-p2p-cash/.nycrc.yml Remove NYC config.
packages/bitcore-node/package.json Switch test script from nyc to mcr; simplify unit/integration mocha invocations.
packages/bitcore-node/mcr.config.js Add Monocart coverage configuration using shared builder.
packages/bitcore-node/.nycrc.yml Remove NYC config.
packages/bitcore-node/.mocharc.yml Remove YAML Mocha config.
packages/bitcore-node/.mocharc.json Add JSON Mocha config.
packages/bitcore-mnemonic/mcr.config.js Add Monocart coverage configuration using shared builder.
packages/bitcore-mnemonic/.nycrc.yml Remove NYC config.
packages/bitcore-logging/package.json Switch test script from nyc to mcr.
packages/bitcore-logging/mcr.config.js Add Monocart coverage configuration using shared builder.
packages/bitcore-logging/.nycrc.yml Remove NYC config.
packages/bitcore-logging/.mocharc.yml Remove YAML Mocha config.
packages/bitcore-logging/.mocharc.json Add JSON Mocha config.
packages/bitcore-lib/test/transaction/transaction.js Adjust timeout configuration for Taproot vector tests.
packages/bitcore-lib/mcr.config.js Add Monocart coverage configuration using shared builder.
packages/bitcore-lib/.nycrc.yml Remove NYC config.
packages/bitcore-lib-ltc/mcr.config.js Add Monocart coverage configuration using shared builder.
packages/bitcore-lib-ltc/.nycrc.yml Remove NYC config.
packages/bitcore-lib-doge/mcr.config.js Add Monocart coverage configuration using shared builder.
packages/bitcore-lib-doge/.nycrc.yml Remove NYC config.
packages/bitcore-lib-cash/mcr.config.js Add Monocart coverage configuration using shared builder.
packages/bitcore-lib-cash/.nycrc.yml Remove NYC config.
packages/bitcore-client/test/unit/wallet.test.ts Switch imports to require for built bitcore-node artifacts; add wallet cleanup.
packages/bitcore-client/package.json Switch test script from nyc (tsx runtime) to mcr (compiled JS).
packages/bitcore-client/mcr.config.js Add Monocart coverage configuration using shared builder.
packages/bitcore-client/.nycrc.yml Remove NYC config.
packages/bitcore-client/.mocharc.yml Remove YAML Mocha config.
packages/bitcore-client/.mocharc.json Add JSON Mocha config.
packages/bitcore-cli/package.json Switch test script from nyc to mcr.
packages/bitcore-cli/mcr.config.js Add Monocart coverage configuration using shared builder.
packages/bitcore-cli/.nycrc.yml Remove NYC config.
packages/bitcore-cli/.mocharc.yml Remove YAML Mocha config.
packages/bitcore-cli/.mocharc.json Add JSON Mocha config.
packages/bitcore-build/index.js Update gulp test task to run mcr mocha.
package.json Replace nyc dev dependency with monocart-coverage-reports.
package-lock.json Lockfile updates reflecting dependency/tooling changes.
coverage-builder.js Add shared Monocart coverage builder helper at repo root.
Review details

Suppressed comments (1)

coverage-builder.js:52

  • export default is ESM-only; in a CommonJS root package this will throw at load time. Export via module.exports (and keep a .default alias since callers use require(...).default).
export default coverageBuilder;
  • Files reviewed: 66/69 changed files
  • Comments generated: 12
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread coverage-builder.js
Comment thread packages/bitcore-build/index.js Outdated
Comment thread packages/bitcore-cli/.mocharc.json
Comment thread packages/bitcore-client/.mocharc.json
Comment thread packages/bitcore-lib/test/transaction/transaction.js
Comment thread packages/bitcore-tss/.mocharc.json
Comment thread packages/bitcore-wallet-client/.mocharc.json
Comment thread packages/bitcore-wallet-service/.mocharc.json
Comment thread packages/crypto-rpc/.mocharc.json
Comment thread packages/crypto-wallet-core/.mocharc.json
monocart copilot review

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants