SonarSource / SonarTS

Static code analyzer for TypeScript
GNU Lesser General Public License v3.0
761 stars 53 forks source link

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

Open totodile94 opened 5 years ago

totodile94 commented 5 years ago

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 commented 4 years ago

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