简体   繁体   中英

How to test single it() method from a specific spec.ts file

I'm new to angular Unit testing using jasmine. Wondering if we can test a single it() method from a specific spec.ts file that consists of only one describe.

In order to test a single test case scenario every time I have to run ng test and wait for it to complete.

I researched a lot but no luck. I know we can change the karma configuration to a specific spec file and run but then curious to know if there is a way we can do like mentioned above.

if you want to run a specific test in jasmine, simple change it() to fit() .

you can use fdescribe instead of describe to run a single describe block

and fit instead of it to run a single test spec

f stands for focused and only these will run

and if you want run all just remove f from all specs

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM