How can I run Storybook Jest Tests for an Nx library?

Viewed 13

I have an Nx monorepo with multiple Angular libraries in it, each of them has its own Storybook configuration (I set up the Storybook config according to this Nx tutorial).

Everything's been working fine, I've been able to build my Storybook for each library and build my components in isolation.

However, I wanted to add Interaction Tests as described in this Storybook tutorial to one of my libraries, the Inventory library. (Basically I wanted to be able to include interaction tests for the component in each of the stories' play function).

The tutorial asks me to add a "test-storybook" script to my package.json though, like so:

{
  "scripts": {
    "test-storybook": "test-storybook"
  }
}

However, I don't understand how to complete this step in terms of an Nx Angular library...where do I include this script? What options should I pass it, so it runs the test associated to the Inventory library only?

Any help is appreciated, and further questions are also welcome.

0 Answers
Related