monounity / karma-typescript

Simplifying running unit tests with coverage for Typescript projects.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

error TS18003: No inputs were found in config file 'tsconfig.json'

galiron opened this issue · comments

Environment:
OS: Win10
NPM: 9.1.2
TypeScript: 4.9.4
karma-typescript: 5.5.3

Problem:
running "karma start karma.conf.json" with modules like watchdog (https://www.npmjs.com/package/watchdog) causes Errors:
[karma-server]: Error: Unable to resolve module [brolog] from [G:\karma-jasmine-example\node_modules\watchdog\bundles\watchdog.umd.js].
When trying to resolve this Error by adding
karmaTypescriptConfig: { include: [ "./node_modules/brolog/**/*" ] }
to the karma.config.js, the error becomes this:
[compiler.karma-typescript]: error TS18003: No inputs were found in config file 'tsconfig.json'. Specified 'include' paths were '["./node_modules/brolog/**/*"]' and 'exclude' paths were '["node_modules"]'.
Even if I specifically included it.

Reproduction:
git clone https://github.com/galiron/karma-jasmine-example
npm i
karma start karma.conf.js

To reproduce step 1 of the problem, you simply need to remove the karmaTypescriptConfig in the karma.conf.js

Log

...
12 12 2022 09:55:32.851:DEBUG [web-server]: Instantiating middleware
12 12 2022 09:55:32.858:DEBUG [reporter]: Trying to load reporter: karma-typescript
12 12 2022 09:55:32.859:DEBUG [reporter]: Trying to load color-version of reporter: karma-typescript (karma-typescript_color)
12 12 2022 09:55:32.859:DEBUG [reporter]: Couldn't load color-version.
12 12 2022 09:55:32.876:DEBUG [preprocessor.karma-typescript]: Processing "G:/karma-jasmine-example/src/app/logic/ControlLock.ts". 3642
12 12 2022 09:55:32.877:DEBUG [preprocessor.karma-typescript]: Processing "G:/karma-jasmine-example/src/app/logic/ControlSocket.ts". 391
12 12 2022 09:55:32.877:DEBUG [preprocessor.karma-typescript]: Processing "G:/karma-jasmine-example/src/app/models/wsMessage.ts". 92
12 12 2022 09:55:32.877:DEBUG [preprocessor.karma-typescript]: Processing "G:/karma-jasmine-example/src/app/server.ts". 1086
12 12 2022 09:55:32.878:DEBUG [preprocessor.karma-typescript]: Processing "G:/karma-jasmine-example/src/app/logic/WebsocketApi.ts". 3253
12 12 2022 09:55:33.137:INFO [compiler.karma-typescript]: Compiling project using Typescript 4.9.4
12 12 2022 09:55:33.139:DEBUG [project.karma-typescript]: File system changed, resolving tsconfig
12 12 2022 09:55:33.140:DEBUG [project.karma-typescript]: Fallback to default compiler options
12 12 2022 09:55:33.141:DEBUG [project.karma-typescript]: Resolved configFileJson:
 {
   "config": {
      "compilerOptions": {
         "emitDecoratorMetadata": true,
         "experimentalDecorators": true,
         "jsx": "react",
         "module": "commonjs",
         "sourceMap": true,
         "target": "ES5"
      },
      "exclude": [
         "node_modules"
      ]
   }
}
12 12 2022 09:55:33.147:DEBUG [project.karma-typescript]: Resolved tsconfig:
 {
   "options": {
      "emitDecoratorMetadata": true,
      "experimentalDecorators": true,
      "jsx": 2,
      "module": 1,
      "sourceMap": true,
      "target": 1,
      "configFilePath": "",
      "suppressOutputPathCheck": true
   },
   "fileNames": [],
   "typeAcquisition": {
      "enable": false,
      "include": [],
      "exclude": []
   },
   "raw": {
      "compilerOptions": {
         "emitDecoratorMetadata": true,
         "experimentalDecorators": true,
         "jsx": "react",
         "module": "commonjs",
         "sourceMap": true,
         "target": "ES5"
      },
      "exclude": [
         "node_modules"
      ],
      "include": [
         "./node_modules/brolog/**/*"
      ],
      "compileOnSave": false
   },
   "errors": [
      {
         "messageText": "No inputs were found in config file 'tsconfig.json'. Specified 'include' paths were '[\"./node_modules/brolog/**/*\"]' and 'exclude' paths were '[\"node_modules\"]'.",
         "category": 1,
         "code": 18003
      }
   ],
   "wildcardDirectories": {},
   "compileOnSave": false
}
12 12 2022 09:55:33.150:ERROR [compiler.karma-typescript]: error TS18003: No inputs were found in config file 'tsconfig.json'. Specified 'include' paths were '["./node_modules/brolog/**/*"]' and 'exclude' paths were '["node_modules"]'.

12 12 2022 09:55:33.158:INFO [compiler.karma-typescript]: Compiled 0 files in 8 ms.
12 12 2022 09:55:33.159:ERROR [karma-server]: UncaughtException: Error: No source found for G:/karma-jasmine-example/src/app/logic/ControlLock.ts!
Is there a mismatch between the Typescript compiler options and the Karma config?
    at G:\karma-jasmine-example\node_modules\karma-typescript\dist\compiler\compiler.js:80:23
    at Array.forEach (<anonymous>)
    at Compiler.onProgramCompiled (G:\karma-jasmine-example\node_modules\karma-typescript\dist\compiler\compiler.js:77:24)
    at Compiler.compileProject (G:\karma-jasmine-example\node_modules\karma-typescript\dist\compiler\compiler.js:63:14)
    at Compiler.<anonymous> (G:\karma-jasmine-example\node_modules\karma-typescript\dist\compiler\compiler.js:29:23)
    at invokeFunc (G:\karma-jasmine-example\node_modules\lodash\lodash.js:10401:23)
    at trailingEdge (G:\karma-jasmine-example\node_modules\lodash\lodash.js:10450:18)
    at Timeout.timerExpired [as _onTimeout] (G:\karma-jasmine-example\node_modules\lodash\lodash.js:10438:18)
    at listOnTimeout (node:internal/timers:564:17)
    at process.processTimers (node:internal/timers:507:7)
12 12 2022 09:55:33.160:ERROR [karma-server]: Error: No source found for G:/karma-jasmine-example/src/app/logic/ControlLock.ts!
Is there a mismatch between the Typescript compiler options and the Karma config?
    at G:\karma-jasmine-example\node_modules\karma-typescript\dist\compiler\compiler.js:80:23
    at Array.forEach (<anonymous>)
    at Compiler.onProgramCompiled (G:\karma-jasmine-example\node_modules\karma-typescript\dist\compiler\compiler.js:77:24)
    at Compiler.compileProject (G:\karma-jasmine-example\node_modules\karma-typescript\dist\compiler\compiler.js:63:14)
    at Compiler.<anonymous> (G:\karma-jasmine-example\node_modules\karma-typescript\dist\compiler\compiler.js:29:23)
    at invokeFunc (G:\karma-jasmine-example\node_modules\lodash\lodash.js:10401:23)
    at trailingEdge (G:\karma-jasmine-example\node_modules\lodash\lodash.js:10450:18)
    at Timeout.timerExpired [as _onTimeout] (G:\karma-jasmine-example\node_modules\lodash\lodash.js:10438:18)
    at listOnTimeout (node:internal/timers:564:17)
    at process.processTimers (node:internal/timers:507:7)
12 12 2022 09:55:33.161:DEBUG [launcher]: Disconnecting all browsers
12 12 2022 09:55:33.161:DEBUG [proxy]: Destroying proxy agents