Join egghead, unlock knowledge.

Want more egghead?

This lesson is for members. Join us? Get access to all 3,000+ tutorials + a community with expert developers around the world.

Unlock This Lesson
1×
Become a member
to unlock all features
Autoplay

    Running tests within Nx Workspace projects

    Paul HallidayPaul Halliday
    angularAngular

    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.

    Code

    Code

    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    Transcript

    Transcript

    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.

    Discuss

    Discuss