Test-coverage says that coverage is not 100%, but it truly is!
See original GitHub issueBug Report or Feature Request (mark with an x
)
- [x] bug report -> please search issues before submitting
- [ ] feature request
Versions.
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
@angular/cli: 1.0.0
node: 6.9.5
os: darwin x64
@angular/animations: 4.0.1
@angular/common: 4.0.1
@angular/compiler: 4.0.1
@angular/core: 4.0.1
@angular/forms: 4.0.1
@angular/http: 4.0.1
@angular/platform-browser: 4.0.1
@angular/platform-browser-dynamic: 4.0.1
@angular/platform-server: 4.0.1
@angular/router: 4.0.1
@angular/cli: 1.0.0
@angular/compiler-cli: 4.0.1
Repro steps.
Upgrade your 100% tested angular 2.4.8 app to 4.0.1, along with Angular CLI 1.0.0
The log given by the failure.
There’s no actual failure (stacktrace thown), but the behaviour of the text-coverage is wrong. I’m hitting every line, statement, branch and function of the code, but coverage does not “cover” constructor signature.
Desired functionality.
The test coverage should be 100%, and was until I upgraded from Angular 2.4.8 (CLI 1.0.0 RC.0) to Angular 4.01 (CLI 1.0.0).
Before
After
Coverage error (example)
Mention any other details that might be useful.
My karma.conf.js file looks like:
// 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-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular/cli/plugins/karma'),
require('karma-spec-reporter'),
require('karma-appveyor-reporter')
],
files: [
{pattern: './src/test.ts', watched: false}
],
preprocessors: {
'./src/test.ts': ['@angular/cli']
},
mime: {
'text/x-typescript': ['ts', 'tsx']
},
coverageIstanbulReporter: {
reports: [ 'html', 'lcovonly', 'text' ],
fixWebpackSourcePaths: true
},
angularCli: {
environment: 'dev'
},
reporters: config.angularCli && config.angularCli.codeCoverage
? ['spec', 'coverage-istanbul', 'appveyor']
: ['spec', 'appveyor'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false
});
};
I’m unfortunately not permitted to share the code-base, since it’s a closed source, propriatary product I’m working on. I can however provide you with various configuration files. So, do not refrain from asking for these.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:37
- Comments:16 (3 by maintainers)
Top Results From Across the Web
100% test coverage: Why or why not? - Roelof Jan Elsinga
100% test coverage simply means you've written a sufficient amount of tests to cover every line of code in your application. That's it,...
Read more >How can 100% test coverage be "not enough to prove working ...
Test coverage only catches what's been coded - You can't test functionality that hasn't been implemented. If an error scenario isn't coded for, ......
Read more >100% Unit Test Coverage — Is that a Myth? - Deepal's Blog
Obtaining 100% line coverage is not that hard. But, does 100% line coverage mean that the entire code is properly unit tested?
Read more >The 100% Code Coverage Myth - Medium
There's a lot of advice around the internet right now saying that 100% coverage is not a worthwhile goal. I strongly disagree. Usually,...
Read more >The myth of 100% code coverage - Functionize
For many people, 100% coverage is the mythical ideal that they all strive to achieve. After all, if 100% of your code is...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@rg1220
Well, not exactly… since we’re not only experiencing it in constructors, but also in class parameters.
Going to close this one as duplicate of #5526, they are the same and the other one has a lot more info on the problem.