Angular · Senior · Question 46 of 75
What are component harnesses for?
- ✓Correct answer: A test API that interacts with a component like a user, hiding its DOM structure from the tests
- 2Tools for measuring component performance
- 3Wrappers that run components in production
Explanation
const button = await loader.getHarness(MatButtonHarness) keeps tests working when the internal markup changes. Angular Material ships harnesses, and you can write your own with the CDK.