6

When trying to create an istanbul report (angular2-cli app), I get the following error

[Error: Could not find source map for:"/Users/dylan/IdeaProjects/IssueTracker2-UI/code/dist/vendor/es6-shim/es6-shim.js"]
[Error: Could not find source map for: "/Users/dylan/IdeaProjects/IssueTracker2-UI/code/dist/vendor/zone.js/dist/zone.js"]
Error: Could not find file: "/Users/dylan/IdeaProjects/IssueTracker2-UI/code/dist/vendor/systemjs/dist/system-polyfills.js.map"

This is when I am running npm run posttest. This is noted in my package.json in the following.

     "posttest": "node_modules/.bin/remap-istanbul -i coverage/coverage-final.json -o coverage -t html",
     "coverage": "http-server -c-1 -o -p 9875 ./coverage"

Underneath I will show my karma.conf.js file

 // Karma configuration file, see link for more information
// https://karma-runner.github.io/0.13/config/configuration-file.html

module.exports = function (config) {
config.set({
basePath: '..',
frameworks: ['jasmine'],
plugins: [
  require('karma-jasmine'),
  require('karma-chrome-launcher'),
  require('karma-coverage')
],
customLaunchers: {
  // chrome setup for travis CI using chromium
  Chrome_travis_ci: {
    base: 'Chrome',
    flags: ['--no-sandbox']
  }
},
files: [
  { pattern: 'dist/vendor/es6-shim/es6-shim.js', included: true, watched: false },
  { pattern: 'dist/vendor/zone.js/dist/zone.js', included: true, watched: false },
  { pattern: 'dist/vendor/reflect-metadata/Reflect.js', included: true, watched: false },
  { pattern: 'dist/vendor/systemjs/dist/system-polyfills.js', included: true, watched: false },
  { pattern: 'dist/vendor/systemjs/dist/system.src.js', included: true, watched: false },
  { pattern: 'dist/vendor/zone.js/dist/async-test.js', included: true, watched: false },
  { pattern: 'dist/vendor/zone.js/dist/fake-async-test.js', included: true, watched: false },

  { pattern: 'config/karma-test-shim.js', included: true, watched: true },

  // Distribution folder.
  { pattern: 'dist/**/*', included: false, watched: false },

  { pattern: 'src/**/*.ts', included: false, watched: false },
  { pattern: 'dist/**/*.js.map', included: false, watched: false }
],
exclude: [
  // Vendor packages might include spec files. We don't want to use those.
  'dist/vendor/**/*.spec.js'
],
preprocessors: {'dist/**/!(*spec).js': ['coverage']},
reporters: ['progress','dots','coverage'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: false,
browsers: ['Chrome'],
singleRun: true,

proxies : {
  '/src/': '/base/src/'
},

coverageReporter : {
  reporters:[
    {type:'json', subdir: '.', file: 'coverage-final.json'}
  ]
}
});
};

Thanks!

Dylan Meeus
  • 5,696
  • 2
  • 30
  • 49
  • I'm having the exact same issue. It seems to work fine when only `AppComponent` exists but then the `/Users` problem starts appearing as soon as I add another component. – Jason Swett Jul 18 '16 at 13:39
  • @JasonSwett Unfortunately I can not confirm that it works when only AppComponent exists. I'm trying to include it in an existing angular-cli project. =/ – Dylan Meeus Jul 18 '16 at 13:41
  • @DylanMeeus Did you manage to resolve this, or find a work around. It appears as though the coverage.json is missing the transpiled source that should be in a property called '.code' in order to remap back to ts. – robmcm Oct 25 '16 at 08:26

0 Answers0