angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

1.0.0-beta.31 ng test failed on code-coverage.

Open abcfy2 opened this issue 9 years ago • 10 comments

Please provide us with the following information:

OS?

Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?) Linuxmint 18.1

Versions.

Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version and paste the result here:


                             _                           _  _
  __ _  _ __    __ _  _   _ | |  __ _  _ __         ___ | |(_)
 / _` || '_ \  / _` || | | || | / _` || '__|_____  / __|| || |
| (_| || | | || (_| || |_| || || (_| || |  |_____|| (__ | || |
 \__,_||_| |_| \__, | \__,_||_| \__,_||_|          \___||_||_|
               |___/
@angular/cli: 1.0.0-beta.31
node: 6.9.5
os: linux x64
@angular/common: 2.2.1
@angular/compiler: 2.2.1
@angular/compiler-cli: 2.2.1
@angular/core: 2.2.1
@angular/forms: 2.2.1
@angular/http: 2.2.1
@angular/platform-browser: 2.2.1
@angular/platform-browser-dynamic: 2.2.1
@angular/platform-server: 2.2.1
@angular/cli: 1.0.0-beta.31

Repro steps.

Was this an app that wasn't created using the CLI? What change did you do on your code? etc. Not changed anything.

The log given by the failure.

Normally this include a stack trace and some more information.

ng test --code-coverage --watch=false 

START:
10 02 2017 13:02:33.145:WARN [karma]: Port 9876 in use                                     
10 02 2017 13:02:33.146:WARN [karma]: Port 9877 in use
10 02 2017 13:02:33.146:WARN [karma]: Port 9878 in use
10 02 2017 13:02:33.147:INFO [karma]: Karma v1.4.1 server started at http://0.0.0.0:9879/
10 02 2017 13:02:33.147:INFO [launcher]: Launching browser PhantomJS with unlimited concurrency
10 02 2017 13:02:33.152:INFO [launcher]: Starting browser PhantomJS
10 02 2017 13:02:34.211:INFO [PhantomJS 2.1.1 (Linux 0.0.0)]: Connected on socket Jv5eAJYFqrfBbjC3AAAA with id 84629039

... SNIP ...


SUMMARY:
✔ 69 tests completed
Error: Could not find source map for: "/home/fengyu/projects/linchang/site-client-app/src/test.ts"
    at /home/fengyu/projects/linchang/site-client-app/node_modules/remap-istanbul/lib/remap.js:213:11
    at Array.forEach (native)
    at /home/fengyu/projects/linchang/site-client-app/node_modules/remap-istanbul/lib/remap.js:192:22
    at Array.forEach (native)
    at remap (/home/fengyu/projects/linchang/site-client-app/node_modules/remap-istanbul/lib/remap.js:191:12)
    at KarmaRemapIstanbul.onRunComplete (/home/fengyu/projects/linchang/site-client-app/node_modules/karma-remap-istanbul/index.js:58:21)
    at Server.<anonymous> (/home/fengyu/projects/linchang/site-client-app/node_modules/karma/lib/events.js:13:22)
    at emitTwo (events.js:111:20)
    at Server.emit (events.js:191:7)
    at emitRunCompleteIfAllBrowsersDone (/home/fengyu/projects/linchang/site-client-app/node_modules/karma/lib/server.js:295:12)
    at Server.<anonymous> (/home/fengyu/projects/linchang/site-client-app/node_modules/karma/lib/server.js:326:7)
    at emitOne (events.js:96:13)
    at Server.emit (events.js:188:7)
    at Server.<anonymous> (/home/fengyu/projects/linchang/site-client-app/node_modules/karma/lib/server.js:309:12)
    at emitTwo (events.js:111:20)
    at Server.emit (events.js:191:7)
    at Browser.onComplete (/home/fengyu/projects/linchang/site-client-app/node_modules/karma/lib/browser.js:143:13)
    at Socket.<anonymous> (/home/fengyu/projects/linchang/site-client-app/node_modules/karma/lib/events.js:13:22)
    at emitTwo (events.js:111:20)
    at Socket.emit (events.js:191:7)
    at /home/fengyu/projects/linchang/site-client-app/node_modules/socket.io/lib/socket.js:503:12
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)
Error: Could not find source map for: "/home/fengyu/projects/linchang/site-client-app/src/polyfills.ts"
    at /home/fengyu/projects/linchang/site-client-app/node_modules/remap-istanbul/lib/remap.js:213:11
    at Array.forEach (native)
    at /home/fengyu/projects/linchang/site-client-app/node_modules/remap-istanbul/lib/remap.js:192:22
    at Array.forEach (native)
    at remap (/home/fengyu/projects/linchang/site-client-app/node_modules/remap-istanbul/lib/remap.js:191:12)
    at KarmaRemapIstanbul.onRunComplete (/home/fengyu/projects/linchang/site-client-app/node_modules/karma-remap-istanbul/index.js:58:21)
    at Server.<anonymous> (/home/fengyu/projects/linchang/site-client-app/node_modules/karma/lib/events.js:13:22)
    at emitTwo (events.js:111:20)
    at Server.emit (events.js:191:7)
    at emitRunCompleteIfAllBrowsersDone (/home/fengyu/projects/linchang/site-client-app/node_modules/karma/lib/server.js:295:12)
    at Server.<anonymous> (/home/fengyu/projects/linchang/site-client-app/node_modules/karma/lib/server.js:326:7)
    at emitOne (events.js:96:13)
    at Server.emit (events.js:188:7)
    at Server.<anonymous> (/home/fengyu/projects/linchang/site-client-app/node_modules/karma/lib/server.js:309:12)
    at emitTwo (events.js:111:20)
    at Server.emit (events.js:191:7)
    at Browser.onComplete (/home/fengyu/projects/linchang/site-client-app/node_modules/karma/lib/browser.js:143:13)
    at Socket.<anonymous> (/home/fengyu/projects/linchang/site-client-app/node_modules/karma/lib/events.js:13:22)
    at emitTwo (events.js:111:20)
    at Socket.emit (events.js:191:7)
    at /home/fengyu/projects/linchang/site-client-app/node_modules/socket.io/lib/socket.js:503:12
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)
Error: Could not find source map for: "/home/fengyu/projects/linchang/site-client-app/src/mocks.ts"
    at /home/fengyu/projects/linchang/site-client-app/node_modules/remap-istanbul/lib/remap.js:213:11
    at Array.forEach (native)
    at /home/fengyu/projects/linchang/site-client-app/node_modules/remap-istanbul/lib/remap.js:192:22
    at Array.forEach (native)
    at remap (/home/fengyu/projects/linchang/site-client-app/node_modules/remap-istanbul/lib/remap.js:191:12)
    at KarmaRemapIstanbul.onRunComplete (/home/fengyu/projects/linchang/site-client-app/node_modules/karma-remap-istanbul/index.js:58:21)
    at Server.<anonymous> (/home/fengyu/projects/linchang/site-client-app/node_modules/karma/lib/events.js:13:22)
    at emitTwo (events.js:111:20)
    at Server.emit (events.js:191:7)
    at emitRunCompleteIfAllBrowsersDone (/home/fengyu/projects/linchang/site-client-app/node_modules/karma/lib/server.js:295:12)
    at Server.<anonymous> (/home/fengyu/projects/linchang/site-client-app/node_modules/karma/lib/server.js:326:7)
    at emitOne (events.js:96:13)
    at Server.emit (events.js:188:7)
    at Server.<anonymous> (/home/fengyu/projects/linchang/site-client-app/node_modules/karma/lib/server.js:309:12)
    at emitTwo (events.js:111:20)
    at Server.emit (events.js:191:7)
    at Browser.onComplete (/home/fengyu/projects/linchang/site-client-app/node_modules/karma/lib/browser.js:143:13)
    at Socket.<anonymous> (/home/fengyu/projects/linchang/site-client-app/node_modules/karma/lib/events.js:13:22)
    at emitTwo (events.js:111:20)
    at Socket.emit (events.js:191:7)
    at /home/fengyu/projects/linchang/site-client-app/node_modules/socket.io/lib/socket.js:503:12
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)

...

Mention any other details that might be useful.

The pre version 1.0.0-beta.30 works very well.


Thanks! We'll be in touch soon.

abcfy2 avatar Feb 10 '17 05:02 abcfy2

cc @filipesilva

hansl avatar Feb 10 '17 05:02 hansl

I have the exact same issue. Os: windows 10

@angular/cli: 1.0.0-beta.31
node: 6.9.1
os: win32 x64
@angular/common: 2.4.7
@angular/compiler: 2.4.7
@angular/core: 2.4.7
@angular/forms: 2.4.7
@angular/http: 2.4.7
@angular/platform-browser: 2.4.7
@angular/platform-browser-dynamic: 2.4.7
@angular/router: 3.4.7
@angular/cli: 1.0.0-beta.31
@angular/compiler-cli: 2.4.7
> ng test --code-coverage

10 02 2017 09:26:25.043:WARN [karma]: No captured browser, open http://localhost:9876/
10 02 2017 09:26:25.053:WARN [karma]: Port 9876 in use
10 02 2017 09:26:25.055:INFO [karma]: Karma v1.2.0 server started at http://localhost:9877/
10 02 2017 09:26:25.056:INFO [launcher]: Launching browser Chrome with unlimited concurrency
10 02 2017 09:26:25.212:INFO [launcher]: Starting browser Chrome
10 02 2017 09:26:26.960:INFO [Chrome 56.0.2924 (Windows 10 0.0.0)]: Connected on socket /#Dtom8hWQVelX1w29AAAA with id 33028801
LOG: 'Connecting to socket https://xxx.hu/tracking'
Chrome 56.0.2924 (Windows 10 0.0.0): Executed 11 of 12 SUCCESS (0 secs / 2.13 secs)
Chrome 56.0.2924 (Windows 10 0.0.0): Executed 12 of 12 SUCCESS (2.605 secs / 2.482 secs)
Error: Could not find source map for: "C:\xampp\htdocs\Winedata2\src\test.ts"
    at C:\xampp\htdocs\Winedata2\node_modules\remap-istanbul\lib\remap.js:213:11
    at Array.forEach (native)
    at C:\xampp\htdocs\Winedata2\node_modules\remap-istanbul\lib\remap.js:192:22
    at Array.forEach (native)
    at remap (C:\xampp\htdocs\Winedata2\node_modules\remap-istanbul\lib\remap.js:191:12)
    at KarmaRemapIstanbul.onRunComplete (C:\xampp\htdocs\Winedata2\node_modules\karma-remap-istanbul\index.js:55:21)
    at Server.<anonymous> (C:\xampp\htdocs\Winedata2\node_modules\karma\lib\events.js:13:22)
    at emitTwo (events.js:111:20)
    at Server.emit (events.js:191:7)
    at Timeout._onTimeout (C:\xampp\htdocs\Winedata2\node_modules\karma\lib\executor.js:51:17)
    at ontimeout (timers.js:365:14)
    at tryOnTimeout (timers.js:237:5)
    at Timer.listOnTimeout (timers.js:207:5)
Error: Could not find source map for: "C:\xampp\htdocs\Winedata2\src\polyfills.ts"
    at C:\xampp\htdocs\Winedata2\node_modules\remap-istanbul\lib\remap.js:213:11
    at Array.forEach (native)
    at C:\xampp\htdocs\Winedata2\node_modules\remap-istanbul\lib\remap.js:192:22
    at Array.forEach (native)
    at remap (C:\xampp\htdocs\Winedata2\node_modules\remap-istanbul\lib\remap.js:191:12)
    at KarmaRemapIstanbul.onRunComplete (C:\xampp\htdocs\Winedata2\node_modules\karma-remap-istanbul\index.js:55:21)
    at Server.<anonymous> (C:\xampp\htdocs\Winedata2\node_modules\karma\lib\events.js:13:22)
    at emitTwo (events.js:111:20)
    at Server.emit (events.js:191:7)
    at Timeout._onTimeout (C:\xampp\htdocs\Winedata2\node_modules\karma\lib\executor.js:51:17)
    at ontimeout (timers.js:365:14)
    at tryOnTimeout (timers.js:237:5)
    at Timer.listOnTimeout (timers.js:207:5)

...

MateEke avatar Feb 10 '17 08:02 MateEke

Can't reproduce with a fresh install. There might be some code to adapt or modules to prune on previous versions.

ruffiem avatar Feb 10 '17 10:02 ruffiem

How does your karma.conf looks like ?

ruffiem avatar Feb 10 '17 10:02 ruffiem

// 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', '@angular/cli'],
        plugins: [
            require('karma-jasmine'),
            require('karma-chrome-launcher'),
            require('karma-remap-istanbul'),
            require('@angular/cli/plugins/karma')
        ],
        files: [
            {pattern: './src/test.ts', watched: false},
            "./node_modules/amcharts3/amcharts/amcharts.js",
            "./node_modules/amcharts3/amcharts/serial.js",
            "./node_modules/amcharts3/amcharts/radar.js",
            "./node_modules/amcharts3/amcharts/themes/light.js",
            "./scripts/polarScatter.min.js"
        ],
        mime: {'text/x-typescript': ['ts', 'tsx']},
        preprocessors: {
            './src/test.ts': ['@angular/cli']
        },
        remapIstanbulReporter: {
            reports: {
                html: 'coverage',
                lcovonly: './coverage/coverage.lcov'
            }
        },
        angularCli: {
            config: './angular-cli.json',
            environment: 'dev'
        },
        reporters: ['progress', 'karma-remap-istanbul'],
        port: 9876,
        colors: true,
        logLevel: config.LOG_INFO,
        autoWatch: true,
        browsers: ['Chrome'],
        singleRun: false
    });
};

MateEke avatar Feb 10 '17 10:02 MateEke

Ok, so you may have to adapt your karma.conf.js with the one there.

Also make sure your package.json is up to date with the new dependencies.

Sample:

// 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', '@angular/cli'],
        plugins: [
            require('karma-jasmine'),
            require('karma-chrome-launcher'),
            require('karma-coverage-istanbul-reporter'),
            require('@angular/cli/plugins/karma')
        ],
        files: [
            {pattern: './src/test.ts', watched: false},
            "./node_modules/amcharts3/amcharts/amcharts.js",
            "./node_modules/amcharts3/amcharts/serial.js",
            "./node_modules/amcharts3/amcharts/radar.js",
            "./node_modules/amcharts3/amcharts/themes/light.js",
            "./scripts/polarScatter.min.js"
        ],
        mime: {'text/x-typescript': ['ts', 'tsx']},
        preprocessors: {
            './src/test.ts': ['@angular/cli']
        },
        coverageIstanbulReporter: {
            reports: [ 'html', 'lcovonly' ],
            fixWebpackSourcePaths: true
        },
        angularCli: {
            config: './angular-cli.json',
            environment: 'dev'
        },
        reporters: ['progress', 'coverage-istanbul'],
        port: 9876,
        colors: true,
        logLevel: config.LOG_INFO,
        autoWatch: true,
        browsers: ['Chrome'],
        singleRun: false
    });
};

ruffiem avatar Feb 10 '17 10:02 ruffiem

For some reason https://github.com/angular/angular-cli/pull/4560 did not get listed in the breaking changes. Sorry about that.

There's instructions there on what you need to update.

filipesilva avatar Feb 10 '17 10:02 filipesilva

Thanks. I fixed my issue also.

abcfy2 avatar Feb 10 '17 14:02 abcfy2

Thanks for this, helped me fix my issues as well.

Headcult avatar Feb 13 '17 10:02 Headcult

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.