karma-runner / karma-runner/karma-coverage
ERROR [coverage]: TypeError: Cannot read property 'text' of undefined
- Dominant language
- JavaScript
- Stars
- 771
- Forks
- 242
- PR merge metrics
- No merged PRs in 30d
Description
// Karma configuration
var mainBowerFiles = require('main-bower-files');
const path = require('path');
function listFiles() {
// Instead of manually specifying bower files, inject all the MAIN js files (not all the .js, just the main ones).
var files = mainBowerFiles([['**/*.js']]);
// MOCK is required for jasmine.
files.push('bower_components/angular-mocks/angular-mocks.js');
// files.push('app/vendor/*.js');
files.push('app/views/**/*.html');
files.push('app/scripts/*.js');
files.push('app/**/*.js');
files.push('app/**/*.spec.js');
return files;
}
module.exports = function (config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],
// list of files / patterns to load in the browser
files: listFiles(),
// list of files to exclude
exclude: [],
// plugins: ['karma-coverage', 'karma-jasmine', 'karma-phantomjs-launcher'],
// Source files you want generate coverage for.
// Do not include tests or libraries!
// These files will be instrumented by Istanbul.
preprocessors: {
// exclude *spec.js files
'!(*spec).js': ['coverage'],
// include all js files within our app folder
'app/scripts/**/*.js': ['coverage']
},
reporters: ['spec', 'coverage'],
coverageReporter: {
// We generate our coverage report following the 'lcov' file format.
type: 'html',
// Output the results into ./coverage/
dir: 'coverage/',
// Subdir should be used if more than 1 reporter.
// Which is not our case.
subdir: '.'
},
// web server port
port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['PhantomJS'],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false
});
};
json file {
"name": "unknown",
"version": "0.0.1",
"devDependencies": {
"angular-mocks": "1.4.7",
"browser-sync": "~2.1.4",
"browser-sync-spa": "~1.0.2",
"chalk": "~0.5.1",
"concat-stream": "~1.4.7",
"del": "~1.1.1",
"gulp": "~3.9.0",
"gulp-angular-filesort": "~1.0.4",
"gulp-angular-templatecache": "~1.5.0",
"gulp-autoprefixer": "~2.1.0",
"gulp-csso": "~1.0.0",
"gulp-filter": "~2.0.2",
"gulp-flatten": "~0.0.4",
"gulp-inject": "~1.1.1",
"gulp-jasmine": "^2.4.2",
"gulp-jshint": "~1.9.0",
"gulp-load-plugins": "~0.8.0",
"gulp-minify-html": "~0.1.7",
"gulp-ng-annotate": "~0.5.2",
"gulp-protractor": "~0.0.12",
"gulp-rename": "~1.2.0",
"gulp-replace": "~0.5.0",
"gulp-rev": "~3.0.1",
"gulp-rev-replace": "~0.3.1",
"gulp-sass": "~2.0.1",
"gulp-size": "~1.2.0",
"gulp-sourcemaps": "~1.3.0",
"gulp-symlink": "~2.1.0",
"gulp-uglify": "~1.1.0",
"gulp-useref": "~1.1.0",
"gulp-util": "~3.0.2",
"http-proxy": "~1.8.0",
"http-proxy-middleware": "^0.17.0",
"istanbul": "^0.4.5",
"jasmine": "^2.3.1",
"jasmine-core": "^2.3.4",
"jasmine-jquery": "*",
"jshint-stylish": "~1.0.0",
"karma": "^1.7.1",
"karma-chrome-launcher": "^2.0.0",
"karma-coverage": "^1.1.1",
"karma-coverage-istanbul-reporter": "^1.3.0",
"karma-jasmine": "^0.3.8",
"karma-ng-html2js-preprocessor": "~0.1.2",
"karma-phantomjs-launcher": "^0.2.3",
"karma-spec-reporter": "0.0.31",
"lodash": "~3.2.0",
"main-bower-files": "~2.5.0",
"merge-stream": "~0.1.7",
"minimist": "^1.2.0",
"phantomjs": "^2.1.7",
"protractor": "~1.7.0",
"require-dir": "~0.1.0",
"run-sequence": "^1.0.1",
"uglify-save-license": "~0.4.1",
"wiredep": "~2.2.0",
"wrench": "~1.5.8"
},
"engines": {
"node": "0.12.15"
},
"scripts": {
"start": "DOCKER_HOST=http://localhost gulp serve --env docker",
"build": "gulp build",
"dist": "DOCKER_HOST=http://localhost gulp serve:dist --env docker",
"test": "gulp test"
}
}
Contributor guide
Research direction
Start with the supplied Karma configuration and package.json, then run the project’s `npm test` command (`gulp test`) to reproduce the coverage failure. Inspect the coverage-related configuration and dependencies around the reported TypeError; done means the test command completes without this error and still generates the configured coverage output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100