Avatar ·

What are *.spec.ts files created by Angular CLI for?

Hello everyone! I've just started learning Angular and TypeScript. When I create a new component or service via Angular CLI (e.g., `ng generate component my-component`), files with the `.spec.ts` extension appear alongside the main files. For example, `my-component.component.spec.ts`. I don't quite understand their purpose. My project builds and works fine without them. They just clutter the file explorer. Maybe it's some CLI bug or can they be disabled? The documentation mentions something about testing, but I haven't written a single test yet. Here's an example of such a file that was generated for a simple component: ```typescript import { ComponentFixture, TestBed } from '@angular/core/testing'; import { MyComponent } from './my-component.component'; describe('MyComponent', () => {