Skip to content

ci: Add unit tests and codecov integration with Vitest#6

Merged
rbalet merged 7 commits into
mainfrom
copilot/implement-unit-test-codecov
Mar 4, 2026
Merged

ci: Add unit tests and codecov integration with Vitest#6
rbalet merged 7 commits into
mainfrom
copilot/implement-unit-test-codecov

Conversation

Copilot AI commented Mar 3, 2026

Copy link
Copy Markdown
Contributor

Implements comprehensive unit tests for the library using Vitest and integrates codecov for coverage tracking.

Test Infrastructure

  • Vitest configuration with @analogjs/vite-plugin-angular for Angular support
  • Test job in CI workflow runs before publish, blocks on failure
  • Codecov upload with fail_ci_if_error: false to avoid blocking on service issues
  • lcov reporter for coverage data

Test Coverage

Achieves 100% coverage across all library components:

NgxBackButtonService (11 tests)

  • Navigation history tracking and back() behavior with/without history
  • Config precedence (child overrides root) and error handling

NgxBackButtonDirective (6 tests)

  • Host listener integration and fallback parameter passing
  • Config injection from hierarchical DI

Provider Functions (6 tests)

  • provideNgxBackButton() and provideNgxBackButtonChild() configuration

Testing Framework Migration

  • Migrated from Karma/Jasmine to Vitest
  • Converted all test files to Vitest syntax (vi.fn(), vi.spyOn())
  • Added test-setup.ts for Angular testing environment initialization
  • Test commands: npm test (watch mode), npm run test:ci (coverage), npm run test:ui (UI mode)

Documentation

  • Codecov badge and test commands in README
  • Development section with Vitest instructions

CI Changes

  • New test job runs on push and pull requests
  • publish job depends on test passing
  • Workflow permissions properly scoped (contents: read for test job)
Original prompt

This section details on the original issue you should resolve

<issue_title>ci: codecov</issue_title>
<issue_description>## Description
Implement unit test & bind it with codecov</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits March 3, 2026 15:15
Co-authored-by: rbalet <44493964+rbalet@users.noreply.github.com>
Co-authored-by: rbalet <44493964+rbalet@users.noreply.github.com>
Co-authored-by: rbalet <44493964+rbalet@users.noreply.github.com>
Co-authored-by: rbalet <44493964+rbalet@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement unit test and bind it with codecov ci: Add unit tests and codecov integration Mar 3, 2026

@rbalet rbalet left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Please, do the migration to use vitest instead.

Co-authored-by: rbalet <44493964+rbalet@users.noreply.github.com>

Copilot AI commented Mar 4, 2026

Copy link
Copy Markdown
Contributor Author

Please, do the migration to use vitest instead.

Migration to Vitest completed in commit 95d97db. All 23 tests passing with 100% code coverage maintained. The changes include:

  • Removed Karma/Jasmine dependencies and configuration
  • Added Vitest with @analogjs/vite-plugin-angular for Angular support
  • Converted all test files from Jasmine to Vitest syntax
  • Updated test scripts: npm test (watch mode), npm run test:ci (coverage), npm run test:ui (UI mode)
  • CI workflow remains compatible with the new test command

Copilot AI changed the title ci: Add unit tests and codecov integration ci: Add unit tests and codecov integration with Vitest Mar 4, 2026
@rbalet rbalet marked this pull request as ready for review March 4, 2026 15:51
@rbalet rbalet merged commit e665c60 into main Mar 4, 2026
2 checks passed
@rbalet rbalet deleted the copilot/implement-unit-test-codecov branch March 4, 2026 15:51
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 21.1.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci: codecov

2 participants