Skip to content
This repository has been archived by the owner on Apr 27, 2021. It is now read-only.

Failed to find a source file matching path * in program created with * ( tsconfig.json) #883

Open
totodile94 opened this issue Oct 19, 2019 · 1 comment

Comments

@totodile94
Copy link

I want to report a bug.

SonarTS version: 1.9

Node.js version: 10.16.0

TypeScript version: 3.6.4

SonarQube version: 8.0.0.29455

TSLint version: 5.20.0

Logs

INFO: Analyzing 520 typescript file(s) with the following configuration file D:\Latest\fleet-streams\tsconfig.json
ERROR: Failed to find a source file matching path D:\Latest\fleet-streams\poller\__test__\status-data-validator.test.ts in program created with D:\Latest\fleet-streams\tsconfig.json

Expected behavior

Am getting this error for all my test files. I have only one tsconfig.json file at the root. My tests are in different folders

My tsconfig file at the root ( D:\Latest\fleet-streams\tsconfig.json)

{
	"compilerOptions": {
		"baseUrl": ".",
		"paths": {
			"async-lock": [
				"ts-types.d.ts"
			],
			"shared/*": [
				"shared/*"
			]
		},
		"lib": [
			"es2018",
			"dom"
		],
		"outDir": "./tsc-dist",
		"sourceMap": true,
		"module": "commonjs",
		"resolveJsonModule": true,
		"allowJs": true,
		"target": "es2018",
		"strict": false,
		"noUnusedParameters": true,
		"noUnusedLocals": true,
		"experimentalDecorators": true,
		"allowUnreachableCode": false
	},
	"include": [
		"./**/src/**/*",
		"./**/src/**/*.ts",
        "./enrollment-functions/**/*",
        "./enrollment-functions/**/*.json",
        "./enrolment-functions/extensions.csproj",
		"./shared/**/*.ts",
		"./shared/db-scripts/**/*.js"
	],
	"exclude": [
        "node_modules"
	]
}

My sonar-project.properties file in the root

sonar.typescript.tsconfigPath=tsconfig.json
sonar.exclusions=**/node_modules/**

I tried adding sonar.typescript.tsconfigPath as suggested in an earlier post but it did not work.

@zuyetawarmatik
Copy link

I also have the same problem in my Angular 10 app, I suspect if it's related to this https://community.sonarsource.com/t/ts-skipping-files-with-no-tsconfig-json/28231.

the tsconfig.json in Angular 10 uses solution style which may be the cause https://angular.io/guide/migration-solution-style-tsconfig

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants