Skip to content

Conversation

@AlexD10S
Copy link
Collaborator

@AlexD10S AlexD10S commented Sep 19, 2024

This PR refactors all pop-cli commands to use the CLI module introduce in this PR #216, enabling us to test the output messages produced by the CLI.
Additionally, tests have been added to ensure better coverage in the pop-cli crate. As a result, the test coverage of pop-cli has increased significantly, from 34% to 67% with overall project coverage now nearing our goal: 80%.

Coverage still can be improved, particularly the final parts of the install, build, and up commands, which are difficult to mock for a unit test.

Note: The call command does not include tests because they are being addressed in parallel in this PR #306 to avoid duplication of work.

@codecov
Copy link

codecov bot commented Sep 20, 2024

Codecov Report

❌ Patch coverage is 76.47368% with 447 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.09%. Comparing base (582db18) to head (b13a70c).
⚠️ Report is 329 commits behind head on main.

Files with missing lines Patch % Lines
crates/pop-cli/src/commands/up/parachain.rs 63.00% 82 Missing and 29 partials ⚠️
crates/pop-cli/src/commands/up/contract.rs 61.63% 65 Missing and 24 partials ⚠️
crates/pop-cli/src/cli.rs 53.01% 73 Missing and 5 partials ⚠️
crates/pop-cli/src/commands/install/mod.rs 76.77% 18 Missing and 18 partials ⚠️
crates/pop-cli/src/commands/new/parachain.rs 92.28% 3 Missing and 20 partials ⚠️
crates/pop-cli/src/commands/build/spec.rs 92.76% 3 Missing and 19 partials ⚠️
crates/pop-cli/src/commands/new/contract.rs 84.28% 3 Missing and 19 partials ⚠️
crates/pop-cli/src/commands/test/contract.rs 70.31% 8 Missing and 11 partials ⚠️
crates/pop-cli/src/commands/new/pallet.rs 85.52% 4 Missing and 7 partials ⚠️
crates/pop-cli/src/common/helpers.rs 87.50% 0 Missing and 8 partials ⚠️
... and 7 more
@@            Coverage Diff             @@
##             main     #315      +/-   ##
==========================================
+ Coverage   70.32%   78.09%   +7.77%     
==========================================
  Files          53       54       +1     
  Lines        9098    10387    +1289     
  Branches     9098    10387    +1289     
==========================================
+ Hits         6398     8112    +1714     
+ Misses       1718     1110     -608     
- Partials      982     1165     +183     
Files with missing lines Coverage Δ
...op-parachains/src/new_pallet/new_pallet_options.rs 0.00% <0.00%> (ø)
crates/pop-cli/src/commands/mod.rs 16.00% <0.00%> (-0.33%) ⬇️
crates/pop-contracts/src/node/mod.rs 64.44% <50.00%> (ø)
crates/pop-contracts/src/call.rs 80.45% <76.19%> (+1.83%) ⬆️
crates/pop-contracts/src/init_tests.rs 66.66% <66.66%> (ø)
crates/pop-cli/src/common/contracts.rs 52.85% <77.77%> (+52.85%) ⬆️
crates/pop-contracts/src/up.rs 80.00% <77.41%> (+2.34%) ⬆️
crates/pop-cli/src/common/helpers.rs 86.15% <87.50%> (+86.15%) ⬆️
crates/pop-cli/src/commands/new/pallet.rs 75.67% <85.52%> (+59.26%) ⬆️
crates/pop-cli/src/commands/test/contract.rs 61.33% <70.31%> (+61.33%) ⬆️
... and 7 more

... and 7 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@AlexD10S AlexD10S marked this pull request as ready for review September 20, 2024 09:57
@AlexD10S AlexD10S added the ready-for-final-review The PR is ready for final review label Sep 20, 2024
cli: &mut impl cli::traits::Cli,
) -> Result<Config> {
if !matches!(template, Parachain::Standard) &&
if Provider::Pop.provides(template) &&
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fix needed. Customization values are available for all Pop templates

@AlexD10S
Copy link
Collaborator Author

Redone it #631

@AlexD10S AlexD10S closed this Sep 11, 2025
@AlexD10S AlexD10S deleted the alex/unit-test-cli branch September 11, 2025 10:55
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