diff --git a/docs/shared/jest-plugin.md b/docs/shared/jest-plugin.md index bb77bc1a9e7348..761a0130408e72 100644 --- a/docs/shared/jest-plugin.md +++ b/docs/shared/jest-plugin.md @@ -117,6 +117,16 @@ node --inspect-brk ./node_modules/@nrwl/cli/bin/nx test Enter [chrome://inspect](chrome://inspect) in Chrome address bar and inspect the target to attach to the node process. Visit the official [Jest documentation](https://jestjs.io/docs/en/troubleshooting#tests-are-failing-and-you-don-t-know-why) to find out more. +## FAQ + +### How do I use an nx library within the global setup/teardown files? + +You need to use [tsconfig-paths/register](https://github.com/dividab/tsconfig-paths) at the top of your setup/teardown files. Along with setting the TS_NODE_PROJECT environment variable tsconfig.base.json (tsconfig containing the paths aliases). + +```bash +TS_NODE_PROJECT=tsconfig.base.json npx nx test +``` + ## More Documentation - [Jest Docs](https://jestjs.io/)