Add missing test.ts to Angular templates causing "describe is not defined" error #1484
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix "describe is not defined" error using shared test.ts file
Problem
CodeGen End2End tests were failing with
ReferenceError: describe is not definedwhen running Karma tests for generated Angular applications. The test bootstrap file (test.ts) was missing from 128 template directories.Solution ✨
Instead of duplicating test.ts 128 times, created 2 shared files in common-files directories that are automatically included in all Angular templates via base template classes.
Changes Made
Understand current template system and file copying mechanismRevert the 128 duplicate test.ts filesCreate shared common files directoriesAdd single test.ts file to each shared locationModify all base template classes to include shared filesFix path resolution to correctly locate common-filesRun code review - PASSED (no comments)Run security scan - PASSED (no issues)File Structure
Modified Template Classes
How It Works
Impact
✅ 126 duplicate files removed (kept 2 in empty project templates)
✅ ~75KB repository size reduction
✅ Single source of truth - update once, affect all templates
✅ Cleaner architecture - follows DRY principle and template inheritance
✅ No breaking changes - empty projects still work with their own test.ts
Testing
All Angular templates (ig-ts, igx-ts, igx-ts-legacy) will now include test.ts when generated, preventing the "describe is not defined" error in CodeGen End2End tests.
Original prompt
💡 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.