How can I run tests with a headless browser?

前端 未结 3 1219
小蘑菇
小蘑菇 2020-12-14 14:04

Using:

ng test

Angular CLI runs the tests by default in Chrome, which is great, but what if I need to run them in a console-only environment (h

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-14 14:18

    Angular CLI provides all that we need to run tests without a browser.

    Open the karma.conf.js file and add the ChromeHeadless to the browsers array -

    browsers: ['ChromeHeadless'],
    

    Happy testing!

提交回复
热议问题