You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Normally ts-jest is unaffected by the "include" option in tsconfig.json. In my case I use "include": ["src/*.ts", "src/*.tsx"] so that when I run tsc it does not produce .js files in my tests folder (if I allow tsc to produce .js files of my tests then I would have to reconfigure Jest to ignore them.)
Expected behavior
ts-jest should always ignore "include", but it breaks if "include" doesn't include any files.
Why does this matter? There is a tool (by me) called testpack-cli to check whether your npm package is valid before you publish it. This tool generates a test folder based on your existing tests and your existing tsconfig.json. It installs the packaged version of your package and runs your tests against that. Consequently the src folder no longer exists, so "include": ["src/*.ts", "src/*.tsx"] refers to an empty set.
Error: Some errors occurred while attempting to read from C:\Dev\temp\tsconfig.json: error TS18003: No inputs were found in config file 'tsconfig.json'. Specified 'include' paths were '["nonexist.ts"]' and 'exclude' paths were '[]'.
at readCompilerOptions (node_modules/ts-jest/src/utils.ts:42:11)
at Object.getTSConfig_local (node_modules/ts-jest/src/utils.ts:128:18)
at Object.memoized [as getTSConfig] (node_modules/lodash/lodash.js:10551:27)
at getCacheKey (node_modules/ts-jest/src/preprocessor.ts:91:20)
at Object.getCacheKey (node_modules/ts-jest/index.js:8:51)
Output from your debug log
No <your_project_dir>/node_modules/ts-jest/debug.txt file was created.
The text was updated successfully, but these errors were encountered:
this is typescript config loader bailing, so you'll need to use a different tsconfig file extending yours. You can define a specific tsconfig within the jest config like that:
Normally ts-jest is unaffected by the
"include"
option in tsconfig.json. In my case I use"include": ["src/*.ts", "src/*.tsx"]
so that when I runtsc
it does not produce.js
files in mytests
folder (if I allowtsc
to produce.js
files of my tests then I would have to reconfigure Jest to ignore them.)Expected behavior
ts-jest should always ignore
"include"
, but it breaks if"include"
doesn't include any files.Why does this matter? There is a tool (by me) called
testpack-cli
to check whether your npm package is valid before you publish it. This tool generates a test folder based on your existing tests and your existing tsconfig.json. It installs the packaged version of your package and runs your tests against that. Consequently thesrc
folder no longer exists, so"include": ["src/*.ts", "src/*.tsx"]
refers to an empty set.Minimal repo that reproduces this issue
Create the "repo" with the following commands:
Result:
Output from your debug log
No <your_project_dir>/node_modules/ts-jest/debug.txt file was created.
The text was updated successfully, but these errors were encountered: