Skip to content

fix: fix test infrastructure and add 5 component unit tests#17

Open
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin/1777416165-fix-failing-tests
Open

fix: fix test infrastructure and add 5 component unit tests#17
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin/1777416165-fix-failing-tests

Conversation

@devin-ai-integration
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot commented Apr 28, 2026

Summary

Fixes the broken test infrastructure and adds 5 new component unit test specs. All 219 tests now pass across 11 test files.

Infrastructure fixes

  • Replaced custom test-setup.ts with @analogjs/vitest-angular for proper zone.js + TestBed initialization
  • Added .js setup file to avoid Angular compiler plugin interference with setup code
  • Added @analogjs/vitest-angular and zone.js as devDependencies
  • Downgraded @angular/core from 21.2.4 → 21.1.1 to fix version mismatch with other @angular/* packages (was causing NG0401: No platform exists!)
  • Removed redundant zone.js imports and TestBed.initTestEnvironment() calls from all 6 existing service spec files
  • Set globals: true in vitest config for zone.js patching compatibility

New component specs

File Tests
article-meta.component.spec.ts 7
home.component.spec.ts 11
profile.component.spec.ts 9
profile-articles.component.spec.ts 6
profile-favorites.component.spec.ts 6

Review & Testing Checklist for Human

  • Run bun run test -- --run locally and verify all 219 tests pass
  • Verify the @angular/core downgrade to 21.1.1 doesn't break anything in the app (bun run start)
  • Spot-check that the new component specs test meaningful behavior (not just toBeTruthy())

Notes

  • The root cause of all test failures was that test-setup.ts was being processed by the @analogjs/vite-plugin-angular compiler, which silently broke the zone.js and TestBed initialization. Switching to a .js setup file that delegates to @analogjs/vitest-angular resolved it.
  • The @angular/core@21.2.4 was bumped by Dependabot (PR chore(deps): bump @angular/core from 21.1.1 to 21.2.4 realworld-apps/angular-realworld-example-app#347) without upgrading the other Angular packages, causing NG0401 errors during platform creation.

Link to Devin session: https://app.devin.ai/sessions/d04ae85f7d4d4dc5b68f8f4c3a50dcb8
Requested by: @WesternConcrete


Open in Devin Review

- Fix test setup to use @analogjs/vitest-angular for proper zone.js
  and TestBed initialization (setup-zone + setupTestBed)
- Use .js setup file to avoid Angular compiler interference
- Add @analogjs/vitest-angular and zone.js as devDependencies
- Downgrade @angular/core to 21.1.1 to match other Angular packages
- Remove redundant zone.js imports and TestBed init from all 6 service specs
- Set globals: true in vitest config for zone.js patching compatibility
- Add article-meta.component.spec.ts (7 tests)
- Add home.component.spec.ts (11 tests)
- Add profile.component.spec.ts (9 tests)
- Add profile-articles.component.spec.ts (6 tests)
- Add profile-favorites.component.spec.ts (6 tests)

All 219 tests pass across 11 test files.

Co-Authored-By: Wes Convery <2wconvery@gmail.com>
@devin-ai-integration
Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@staging-devin-ai-integration
Copy link
Copy Markdown

Devin Review

Status Commit
⚪ Not started

Open in Devin Review (Staging)

💡 Connect your GitHub account to enable automatic code reviews.

Copy link
Copy Markdown
Author

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 6 additional findings.

Open in Devin Review

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.

1 participant