Default generated app failed ng test

Error Message after running 'ng test' command:
AppComponent should render title in a h1 tag FAILED
Expected ' Welcome to app! ' to contain 'Welcome to my-dream-app!'.
at UserContext. src/app/app.component.spec.ts:25:54)

Solution:
Your html page does not have h1 tag.
comment below line from app.component.spec.ts
// expect(compiled.querySelector('h1').textContent).toContain('Welcome to app!');

Share this

Related Posts