This article's content
Using Nx with Jetbrains IDE

Running Nx Jest in Jetbrains IDE

Here is how you have to configure Jetbrains IDE to make Jest work within a NX workspace. When I say “work” I mean to make it possible that Jetbrains UI is used to visually indicate failed and succeeded tests instead of a console.

NX module import in Jetbrains IDE

One thing that annoyed me was that Jetbrains auto-imports TypeScript modules like this by default:

import { Something } from "@myorg/mylib".

This is kind of bad and it will even throw a warning such as this one:

ESLint: Projects should use relative imports to import from other files within the same project. Use "./path/to/file" instead of import from "@myorg/mylib"(@nrwl/nx/enforce-module-boundaries)

Luckily there is a setting that lets you change the default auto-import behavior. Navigate to Editor > Code Style > TypeScript and set “Use path mapping from tsconfig.json” to “Only in files outside specified paths“, now the IDE will use relative imports when you are inside a package and scoped-imports otherwise. Neat!

About Author

Mathias Bothe To my job profile

I am Mathias, born 40 years ago in Heidelberg, Germany. Today I am living in Munich and Stockholm. I am a passionate IT freelancer with more than 16 years experience in programming, especially in developing web based applications for companies that range from small startups to the big players out there. I am founder of, creator of the security service platform BosyProtect© and initiator of several other software projects.