Closed OskarCarl closed 2 years ago
Angular component tests works by using "ng test". "ng test" builds the application in watch mode and launches the Karma test runner. Karma is a testing environment. By default you need the Chrome browser. You also might to need to set your CHROME_BIN Enviromental Variable or you might get an error.
"ng test" will than test every spec.ts files. So if someone wants to write an individual test, they would need to write it in the spec.ts file of this specific component. There is a default test that is already setup when you generate the component. The default just instantiates the component and tests if it exists or not. Services can also be tested the same way.
The tests can be configured in the karma.conf.js file.
5 Pkt.
Wie funktionieren unit Test in Angular? Reicht das aus?