How can you make @nx/jest:jest
to respect a certain tsconfig before it reads jest.config.ts
?
#26934
Unanswered
cdpark0530
asked this question in
Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
(This is my first writing in this repo, so I apologize if this question is not where it should be)
I'm using
@nx/*@16.9.0
,ts-node@10.9.1
,ts-jest@29.1.1
.There is package foo:
foo needs to import its
tsconfig.spec.json
to definemodulePaths
andmoduleNameMapper
:jest.preset.js
specifies whichtsconfig
to use:tsconfig.spec.json
setscompilerOptions.resolveJsonModule
totrue
:But when I execute command
yarn nx test foo
, TSError occurs:TS2732: Cannot find module './tsconfig.spec.json'. Consider using '--resolveJsonModule' to import module with '.json' extension.
I guess this is because at the time the executor
@nx/jest:jest
readsjest.config.ts
, it doesn't respect any tsconfig in the entire project.I found some workarounds - executing the command with
TS_NODE_PROJECT
:TS_NODE_PROJECT=apps/foo/tsconfig.spec.json yarn nx test foo
jest.config.ts
#14888 (comment)But I'd like to specify which tsconfig
@nx/jest:jest
should respect even before it readsjest.config.ts
inproject.json
ornx.json
. Is there any way to do this?Beta Was this translation helpful? Give feedback.
All reactions