Running tests within Nx Workspace projects

Paul Halliday
InstructorPaul Halliday
Share this video with your friends

Social Share Links

Send Tweet

In this lesson we look at how we can run tests inside of an Nx Workspace project, allowing you to test a specific library, or the whole project.

Instructor: [00:00] Here we have an Nx workspace. We have one library which contains a counter module and counter component as well as inside of our apps, we have an app component with an app component spec.

[00:16] Therefore, we have tests inside of the app directory and tests inside of the live directory. To run the unit tests inside of our application, we can run ng test. This will run the app component .spec.ts test, and it will also run all of the library tests.

[00:38] If we just wanted to run the unit tests for a particular library, we can use ng test--project = counter. This will no longer run the app tests. It will simply run the counter library tests.