Skip to content

Add unit specs to increase test coverage toward 90% - #402

Merged
gavindidrichsen merged 2 commits into
mainfrom
coverage/increase-unit-test-coverage-v2
Sep 4, 2026
Merged

Add unit specs to increase test coverage toward 90%#402
gavindidrichsen merged 2 commits into
mainfrom
coverage/increase-unit-test-coverage-v2

Conversation

@bronachfalls

Copy link
Copy Markdown
Contributor

Summary

  • Adds 9 new RSpec unit spec files covering the largest previously-untested areas of the codebase
  • Increases test coverage from ~39% toward 90% with 163 new examples, 0 failures

New specs

File What it covers
spec/languageserver/unit/lsp/lsp_protocol_spec.rb All LSP::LSPBase subclasses (lsp_protocol.rb, lsp_types.rb, lsp_custom.rb) via dynamic ObjectSpace meta-test
spec/debugserver/unit/dsp/dsp_protocol_spec.rb All DSP::DSPBase subclasses (dsp_protocol.rb, dsp_base.rb) via dynamic ObjectSpace meta-test
spec/languageserver/unit/puppet-editor-services/protocol/debug_adapter_spec.rb PuppetEditorServices::Protocol::DebugAdapter (receive_data, extract_headers, encode_and_send, send_json_string)
spec/languageserver/unit/puppet-editor-services/protocol/debug_adapter_messages_spec.rb DebugAdapterMessages — ProtocolMessage, Request, Event, Response, and factory methods
spec/languageserver/unit/puppet-editor-services/protocol/json_rpc_messages_spec.rb JSON-RPC message types and factory methods
spec/languageserver/unit/puppet-editor-services/logging_spec.rb PuppetEditorServices.log_message and init_logging
spec/languageserver/unit/puppet-languageserver/crash_dump_spec.rb PuppetLanguageServer::CrashDump.default_crash_file and write_crash_file
spec/languageserver-sidecar/unit/puppet-languageserver-sidecar/cache/base_spec.rb Cache::Base interface
spec/languageserver-sidecar/unit/puppet-languageserver-sidecar/cache/null_spec.rb Cache::Null implementation

Test plan

  • All 163 new examples pass (0 failures)
  • No existing specs were modified or removed
  • Rubocop autocorrect applied; remaining violations are structural (same patterns as existing codebase)

🤖 Generated with Claude Code

New specs cover the largest previously-untested areas:
- LSP protocol classes (lsp_protocol.rb, lsp_types.rb, lsp_custom.rb) via
  dynamic ObjectSpace meta-test covering all LSP::LSPBase subclasses
- DSP protocol classes (dsp_protocol.rb, dsp_base.rb) via the same pattern
  covering all DSP::DSPBase subclasses
- PuppetEditorServices::Protocol::DebugAdapter (receive_data, encode_and_send, etc.)
- PuppetEditorServices::Protocol::DebugAdapterMessages and JsonRPC message types
- PuppetEditorServices logging (log_message, init_logging)
- PuppetLanguageServer::CrashDump (default_crash_file, write_crash_file)
- Cache::Base and Cache::Null sidecar cache classes

163 new examples, 0 failures.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@bronachfalls
bronachfalls requested a review from a team as a code owner September 4, 2026 15:27
@codecov

codecov Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.24%. Comparing base (56a7b97) to head (a6d5507).

Additional details and impacted files
@@             Coverage Diff             @@
##             main     #402       +/-   ##
===========================================
+ Coverage   15.18%   85.24%   +70.05%     
===========================================
  Files          92       92               
  Lines        8857     8857               
===========================================
+ Hits         1345     7550     +6205     
+ Misses       7512     1307     -6205     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Without a unique command_name, each of the three sequential RSpec
invocations (languageserver, languageserver-sidecar, debugserver) wrote
to coverage/.resultset.json under the same "RSpec" key, so each run
overwrote the previous result. Codecov only received the final
(debugserver) suite's data, reporting ~29% instead of the true combined
coverage.

Setting ENV['COVERAGE_SUITE'] in each suite-specific spec_helper and
using it as the SimpleCov command_name causes SimpleCov to merge all
three result sets before uploading.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@gavindidrichsen
gavindidrichsen merged commit a335ef8 into main Sep 4, 2026
9 checks passed
@gavindidrichsen
gavindidrichsen deleted the coverage/increase-unit-test-coverage-v2 branch September 4, 2026 16:03
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