sonar-scanner-npm icon indicating copy to clipboard operation
sonar-scanner-npm copied to clipboard

ERROR: Caused by: Line 5 of report refers to a file with an unknown language (TypeScript file)

Open yujingxiacai opened this issue 3 years ago • 1 comments

Version

"sonarqube-scanner": "^2.8.1",

Error

ERROR: Error during SonarScanner execution
ERROR: Error during parsing of generic test execution report '/Users/shenyukang1/Myprogram/tool-make/umi4-web-demo/coverage/test-reporter.xml'. 
Look at the SonarQube documentation to know the expected XML format.
ERROR: Caused by: Line 5 of report refers to a file with an unknown language:
 /Users/shenyukang1/Myprogram/tool-make/umi4-web-demo/src/components/FibonacciTest/utils/__tests__/dp_function.test.ts
ERROR: 

Hello, have someone know this, No error when i change dp_function.test.ts to dp_function.test.js

it haunted me for a long time😂lol

yujingxiacai avatar Jul 22 '22 08:07 yujingxiacai

INFO: Load metrics repository
INFO: Load metrics repository (done) | time=69ms
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by net.sf.cglib.core.ReflectUtils$1 (file:/Users/shenyukang1/.sonar/cache/866bb1adbf016ea515620f1aaa15ec53/sonar-javascript-plugin.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of net.sf.cglib.core.ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
INFO: Sensor SonarCSS Metrics [cssfamily]
INFO: Sensor SonarCSS Metrics [cssfamily] (done) | time=71ms
INFO: Sensor SonarCSS Rules [cssfamily]
INFO: Sensor SonarCSS Rules [cssfamily] (done) | time=2768ms
INFO: Sensor JavaXmlSensor [java]
INFO: Sensor JavaXmlSensor [java] (done) | time=2ms
INFO: Sensor HTML [web]
INFO: Sensor HTML [web] (done) | time=13ms
INFO: Sensor JaCoCo XML Report Importer [jacoco]
INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=3ms
INFO: Sensor SonarJS [javascript]
INFO: 3 source files to be analyzed
INFO: Sensor SonarJS [javascript] (done) | time=210ms
INFO: Sensor ESLint-based SonarJS [javascript]
INFO: 3/3 source files have been analyzed
INFO: 3 source files to be analyzed
INFO: Sensor ESLint-based SonarJS [javascript] (done) | time=3264ms
INFO: 3/3 source files have been analyzed
INFO: Sensor SonarJS Coverage [javascript]
INFO: Analysing [/Users/shenyukang1/Myprogram/tool-make/umi4-web-demo/./coverage/lcov.info]
INFO: Sensor SonarJS Coverage [javascript] (done) | time=15ms
INFO: Sensor Generic Test Executions Report
INFO: Parsing /Users/shenyukang1/Myprogram/tool-make/umi4-web-demo/coverage/test-reporter.xml
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 16.904s
INFO: Final Memory: 13M/57M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
ERROR: Error during parsing of generic test execution report '/Users/shenyukang1/Myprogram/tool-make/umi4-web-demo/coverage/test-reporter.xml'. Look at the SonarQube documentation to know the expected XML format.
ERROR: Caused by: Line 5 of report refers to a file with an unknown language: /Users/shenyukang1/Myprogram/tool-make/umi4-web-demo/src/components/FibonacciTest/utils/__tests__/dp_function.test.ts
ERROR:

Is it because SonarJS is used here!? Maybe SonarJS doesn't support scanning typescript? If so how do I set up SonarTS to scan?

// sonar-scanner.js

const scanner = require('sonarqube-scanner');

scanner(
    {
        serverUrl: 'http://sonarqube.test.lan',
        token: 'xxxxxx',
        options: {
            'sonar.login': 'xxxxxx',
            'sonar.host.url': 'http://sonarqube.test.lan',
            'sonar.projectName': 'umi4-web-demo',
            'sonar.projectKey': 'umi4-web-demo',
            'sonar.sources': '.',
            'sonar.projectBaseDir': '.',
            'sonar.javascript.lcov.reportPaths': './coverage/lcov.info',
            'sonar.testExecutionReportPaths': './coverage/test-reporter.xml',
            'sonar.sourceEncoding': 'UTF-8',
            'sonar.eslint.reportPath': './report.json',
            'sonar.tests.inclusions': '**/*.test.tsx,**/*.test.ts',
            'sonar.exclusions': '**/*.test.tsx',
        },
    },
    () => process.exit(),
);

yujingxiacai avatar Jul 22 '22 09:07 yujingxiacai

Hey @yujingxiacai, Sonar should support TypeScript. Is this still an issue for you?

gabssnake avatar Sep 26 '22 18:09 gabssnake

Closing this as stale. Feel free to reopen in new information comes up.

gabssnake avatar Oct 03 '22 18:10 gabssnake