monounity / karma-typescript

Simplifying running unit tests with coverage for Typescript projects.
314 stars 109 forks source link

Missing line number of origin typescript file in output #142

Closed SteffenAnders closed 7 years ago

SteffenAnders commented 7 years ago

Hi,

I've just updated karma-typescript from 2.1.7 to 3.0.4.

Everything works so far, but i have noticed that the line number of the origin typescript file is missing on test error output.

Output in 2.1.7

Expected false to be true.
typescript/tests/utils/buildUrl.ts:5:27 <- typescript/tests/utils/buildUrl.js:5:27
loaded@http://localhost:9876/context.js:162:17

Output in 3.0.4

Expected false to be true.
typescript/tests/utils/buildUrl.js:5:27
loaded@http://localhost:9876/context.js:162:17

How do i get back the line number of the origin typescipt file?

My tsconfig.json:

{
    "compilerOptions": {
        "charset": "utf8",
        "module": "commonjs",
        "alwaysStrict": true,
        "noImplicitAny": true,
        "removeComments": true,
        "baseUrl": "."
    },
    "include": [
        "typescript/**/*.ts",
        "node_modules/@types/**/*.ts"
    ]
}

My karma configuration:

karma: {
        singleRun: true,
        autoWatch: false,
        logLevel: "debug",
        browsers: ["PhantomJS"],
        browserNoActivityTimeout: 10000,
        concurrency: 1, // Start browsers & execute tests serialized to avoid performance issues
        frameworks: ["jasmine", "karma-typescript"],
        files: [
            {pattern: "{public,typescript}/**/*.js", watched: false, served: true, included: false, nocache: true},
            {pattern: "typescript/**/!(*.dist).ts", watched: false, served: true, included: true}
        ],
        preprocessors: {
            "**/*.ts": ["karma-typescript"]
        },
        reporters: ["spec", "junit"],
        junitReporter: {
            outputDir: ".",
            outputFile: "karma.tests.xml",
            suite: "typescript",
            useBrowserName: false
        },
        coverageReporter: {
            type: "cobertura",
            dir: ".",
            subdir: ".",
            file: "karma.coverage.xml"
        },
        karmaTypescriptConfig: {
            compilerOptions: {
                sourceMap: true,
            },
            coverageOptions: {
                exclude: /tests/
            }
        }
    }
erikbarke commented 7 years ago

Hey @SteffenAnders, this feature seems to have gone missing between 2.1.7 and 3.0.0. The 3.x really was a major release with massive changes to the code base, so this will bug probably take a while to hunt down 😕

SteffenAnders commented 7 years ago

Hi @erikbarke , thanks for your response.

Until this "bug" is fixed, i will stay on 2.1.7 because this information is really important for test debugging.

Salasar commented 7 years ago

@erikbarke could you fix it in the closest release or provide a workaround, by any chance? It's pretty important stuff, and I can't use 2.1.7 version as it has ts.isDeclarationFile issue :(

erikbarke commented 7 years ago

The line numbers are back now on the development branch, npm i github:monounity/karma-typescript#next!