โ† All Angular Web Framework Flashcard Decks

Angular Quality & Compliance Flashcards

7 cards from real Angular Web Framework practice questions. Tap to flip, then mark Knew It or Still Learning โ€” missed cards come back until you master them.

Read the first 7 Angular Quality & Compliance flashcards as text
  1. Which Angular CLI command runs unit tests with code coverage reporting enabled?

    Answer: ng test --code-coverage

    The `ng test --code-coverage` flag instructs Karma to produce an Istanbul coverage report in the `/coverage` folder.

  2. In Angular's default Karma configuration, which coverage reporter generates an HTML report you can open in a browser?

    Answer: html

    The `html` reporter produces a browsable HTML coverage report in the coverage output directory.

  3. What is the purpose of the `schemas: [NO_ERRORS_SCHEMA]` option in an Angular TestBed configuration?

    Answer: Suppresses unknown element and attribute errors in the test host

    `NO_ERRORS_SCHEMA` tells TestBed to ignore unknown elements and attributes, allowing shallow component testing without declaring every child component.

  4. Which ESLint rule configuration file does `ng lint` look for by default in a modern Angular project?

    Answer: .eslintrc.js or .eslintrc.json

    Modern Angular projects generated with `@angular-eslint/schematics` use `.eslintrc.js` or `.eslintrc.json` as the ESLint configuration file.

  5. What does the `fixture.detectChanges()` call do in an Angular unit test?

    Answer: Triggers Angular's change detection cycle on the test fixture

    `detectChanges()` manually triggers Angular's change detection so the DOM reflects the component's current state during testing.

  6. Which Jasmine matcher should you use to verify that a spy was called exactly once?

    Answer: toHaveBeenCalledTimes(1)

    `toHaveBeenCalledTimes(1)` asserts the spy was invoked exactly one time, distinguishing it from `toHaveBeenCalled()` which only checks that it was called at least once.

  7. In Angular, what is the recommended approach to test a component that depends on an HTTP service without making real network calls?

    Answer: Import HttpClientTestingModule and use HttpTestingController

    `HttpClientTestingModule` paired with `HttpTestingController` lets you expect and flush HTTP requests in unit tests without real network activity.