Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to remap-istanbul 0.7.0 #7

Closed
monounity opened this issue Sep 10, 2016 · 9 comments
Closed

Upgrade to remap-istanbul 0.7.0 #7

monounity opened this issue Sep 10, 2016 · 9 comments
Assignees
Milestone

Comments

@monounity
Copy link
Owner

No description provided.

@monounity monounity added this to the 2.2 milestone Oct 29, 2016
@monounity monounity reopened this Nov 20, 2016
@monounity
Copy link
Owner Author

0.7.0 released.

@monounity monounity changed the title Upgrade to remap-istanbul 0.6.5 when released Upgrade to remap-istanbul 0.7.0 Nov 23, 2016
@Bjeaurn
Copy link

Bjeaurn commented Jan 16, 2017

Does this issue influence the HTML result only being 'clickable' on some components, not all components?

@erikbarke
Copy link
Collaborator

Hey @Bjeaurn, long time no see 😃 I've replaced the bundled version of remap-istanbul with the latest from npm, can you reproduce the error if you install from the latest dev branch, npm install https://github.com/monounity/karma-typescript.git#2.1.7?

@erikbarke erikbarke modified the milestones: 2.1.7, 2.2.0 Jan 16, 2017
@Bjeaurn
Copy link

Bjeaurn commented Jan 17, 2017

Hi @erikbarke, indeed it's been a while!

I've upgraded to the 2.1.7. tag, and saw a visual upgrade to the Istanbul coverage HTML result. However, I'm still unable to click all the components inside as they give me a 404.

I'll try to explain using screenshots, but I'm not completely certain that this issue and the one I'm describing are related or in any way related to the karma-typescript plugin.

Image.

As you can see; I've got quite a big coverage report, with good metrics. But when trying to click through to anything I get 404's. As you can see on the directory, it's only got app/index.html, instead of deeper linked files that give additional information on what's been targeted and covered or not.

@erikbarke
Copy link
Collaborator

That looks really strange... Could you post your Karma config here?

@Bjeaurn
Copy link

Bjeaurn commented Jan 18, 2017

Of course!

module.exports = function (config) {
  config.set({

    frameworks: ["jasmine", "karma-typescript"],
    logLevel: config.LOG_INFO,

    files: [
      {pattern: 'app/assets/base.spec.ts'},
      {pattern: "app/assets/**/*.ts"}
    ],

    exclude: [
      "node_modules",
      "target/node-modules/webjars/",
      "node-modules"
    ],

    map: [
      {'moment': 'node_modules/moment/moment.js' }
    ],


    preprocessors: {
      "app/assets/**/*.ts": ["karma-typescript"]
    },

    exclude: [
      'app/assets/main.ts' // By excluding our main.ts we can initialize the TestBed. This is done through base.spec.ts as seen in the 'files' section.
    ],

    reporters: ["progress", "karma-typescript"],

    karmaTypescriptConfig: {
      tsconfig: './tsconfig.json',
      compilerOptions: {
        inlineSourceMap: true,
        module: "commonjs", // overrides tsconfig
        allowSyntheticDefaultImports: true
      },
      exclude: ["broken"],
      bundlerOptions: {
        ignoredModuleNames: ["react/addons"],
      },
      disableCodeCoverageInstrumentation: false,
      excludeFromCoverage: /\.(d|spec|test)\.ts/,
      remapOptions: {
        warn: function(message){
          console.log(message);
        }
      },
      reports:
      {
        "html": "coverage",
        "text-summary": ""
      },
      transformPath: function(filepath) {
        return filepath.replace(/\.(ts|tsx)$/, ".js");
      }
    },

    coverageReporter: {
      type : 'html',
      dir : 'coverage/'
    },

    browsers: ["Chrome"]
  });
};

@Bjeaurn
Copy link

Bjeaurn commented Jan 18, 2017

Additionally, I just noticed we've been getting this error after the 'Coverage report'

=============================== Coverage summary ===============================
Statements   : 58.38% ( 1704/2919 )
Branches     : 18.64% ( 104/558 )
Functions    : 33.48% ( 224/669 )
Lines        : 56.95% ( 1459/2562 )
================================================================================
18 01 2017 09:48:45.728:ERROR [reporter.karma-typescript]: Error: Unable to find entry for [app/assets/app/app-routing.module.ts]
    at MemoryStore.Store.mix.get (/Development/project-1/node_modules/istanbul/lib/store/memory.js:38:19)
    at HtmlReport.Report.mix.writeDetailPage (/Development/project-1/node_modules/remap-istanbul/node_modules/istanbul/lib/report/html.js:411:67)
    at /Development/project-1/node_modules/remap-istanbul/node_modules/istanbul/lib/report/html.js:489:26
    at SyncFileWriter.extend.writeFile (/Development/project-1/node_modules/remap-istanbul/node_modules/istanbul/lib/util/file-writer.js:57:9)
    at FileWriter.extend.writeFile (/Development/project-1/node_modules/remap-istanbul/node_modules/istanbul/lib/util/file-writer.js:147:23)
    at /Development/project-1/node_modules/remap-istanbul/node_modules/istanbul/lib/report/html.js:488:24
    at Array.forEach (native)
    at HtmlReport.Report.mix.writeFiles (/Development/project-1/node_modules/remap-istanbul/node_modules/istanbul/lib/report/html.js:482:23)
    at /Development/project-1/node_modules/remap-istanbul/node_modules/istanbul/lib/report/html.js:484:22
    at Array.forEach (native)
    at HtmlReport.Report.mix.writeFiles (/Development/project-1/node_modules/remap-istanbul/node_modules/istanbul/lib/report/html.js:482:23)
    at HtmlReport.Report.mix.writeReport (/Development/project-1/node_modules/remap-istanbul/node_modules/istanbul/lib/report/html.js:566:14)
    at /Development/project-1/node_modules/remap-istanbul/lib/writeReport.js:64:22
    at new Promise (/Development/project-1/node_modules/core-js/modules/es6.promise.js:191:7)
    at writeReport (/Development/project-1/node_modules/remap-istanbul/lib/writeReport.js:40:11)
    at /Development/project-1/node_modules/karma-typescript/lib/reporter.js:91:32


@erikbarke
Copy link
Collaborator

I think it's the inlineSourceMap: true that's tripping up the remapping, does it work if you replace that with sourceMap: true in the compilerOptions?

@Bjeaurn
Copy link

Bjeaurn commented Jan 18, 2017

Yeah, that fixes it! It did require your latest branch to get working, so it seems to be all good once more.

Thanks again for your swift support and thanks for the great plugin. It has saved us and will keep preventing us from getting headaches.

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

No branches or pull requests

3 participants