score:0

how about "testregex": ["test/.*.[jt]s"], in your jest config so it doesn't try and find shared files, if you're using shared files across multiple projects then no single project should test those files, they should only test their own files.

however i'm not so sure that symlinks are your problem, when using typescript like this and trying to use files outside of your project rootdir it will not find the types for it or it will complain that it can't find the types for it if you've added it to tsconfig include/exclude. right now i can only assume that you're using tsc --project with specific config files for each project.

// tsconfig.json

"include": ["projecta/**/*.ts"],

if you've done something like that then it won't find any types outside of projecta so anything in config.ts and utils.ts will not have any types or be able to find any modules, unless they're included in your tsconfig.

to show a simpler example if i have:

// tsconfig.json

...
includes: ["src/**/*.ts"]
...

along with a directory structure like this:

- tsconfig.json
- example.ts
- src

then anything in example.ts will not be able to find its types or module imports.

the way i get around this issue in my project is to use ts-jest along with specifying where to find tests, along with overriding the globals rootdir.

// .jestrc.json

"testregex": ["test/.*.[jt]s"],

...

"globals": {
  "ts-jest": {
    "tsconfig": {
      "rootdir": "."
    }
  }
}

Related Query

More Query from same tag