Running tests within Nx Workspace projects

Paul Halliday
InstructorPaul Halliday
Share this video with your friends

Social Share Links

Send Tweet
Published 5 years ago
Updated 3 years ago

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.

egghead
egghead
~ 2 hours ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today