Skip to content

Commit

Permalink
ignore: Code coverage (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
forbesjo authored Feb 23, 2018
1 parent e9966a8 commit 586f317
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 33 deletions.
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@
],
"author": "Brightcove, Inc",
"license": "Apache-2.0",
"browserify": {
"transform": [
"browserify-versionify"
]
},
"browserify-shim": {
"qunit": "global:QUnit",
"sinon": "global:sinon",
Expand Down Expand Up @@ -101,6 +106,7 @@
"browserify": "^11.0.0",
"browserify-istanbul": "^2.0.0",
"browserify-shim": "^3.0.0",
"browserify-versionify": "^1.0.6",
"bundle-collapser": "^1.2.1",
"connect": "^3.4.0",
"cowsay": "^1.1.0",
Expand Down
3 changes: 1 addition & 2 deletions src/media-groups.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import videojs from 'video.js';
import PlaylistLoader from './playlist-loader';
import DashPlaylistLoader from './dash-playlist-loader';

const noop = () => {};
import noop from './util/noop';

/**
* Convert the properties of an HLS track into an audioTrackKind.
Expand Down
3 changes: 1 addition & 2 deletions src/source-updater.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
import videojs from 'video.js';
import { printableRange } from './ranges';
import logger from './util/logger';

const noop = function() {};
import noop from './util/noop';

/**
* A queue of callbacks to be serialized and applied when a
Expand Down
1 change: 1 addition & 0 deletions src/util/noop.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default function noop() {}
2 changes: 2 additions & 0 deletions src/videojs-http-streaming.js
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,8 @@ class HlsHandler extends Component {
* this object in normal usage.
*/
const HlsSourceHandler = {
name: 'videojs-http-streaming',
VERSION: '__VERSION__',
canHandleSource(srcObj, options = {}) {
let localOptions = videojs.mergeOptions(videojs.options, options);

Expand Down
41 changes: 13 additions & 28 deletions test/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = function(config) {
'node_modules/video.js/dist/video-js.css',
'dist-test/browserify-test.js',
'dist-test/webpack-test.js',
'dist-test/videojs-http-streaming.js'
'test/**/*.test.js'
],
browserConsoleLogOptions: {
level: 'error',
Expand All @@ -36,6 +36,11 @@ module.exports = function(config) {
captureTimeout: 600,
timeout: 600
},
coverageReporter: {
reporters: [{
type: 'text-summary'
}]
},
customLaunchers: {
ChromeHeadlessWithFlags: {
base: 'ChromeHeadless',
Expand Down Expand Up @@ -99,29 +104,24 @@ module.exports = function(config) {
}
},
preprocessors: {
'src/**/*.js': ['browserify', 'coverage'],
'test/**/*.test.js': ['browserify']
},
browserify: {
debug: true,
transform: [
'babelify',
['browserify-shim', { global: true }]
['browserify-shim', { global: true }],
istanbul({
instrumenter: isparta,
ignore: ['**/node_modules/**', '**/test/**']
})
],
noParse: [
'test/data/**',
]
},
babelPreprocessor: {
options: {
presets: ['es2015'],
sourceMap: 'inline'
},
sourceFileName: function (file) {
return file.originalPath;
}
},

reporters: ['dots'],
reporters: ['dots', 'coverage'],
port: 9876,
colors: true,
autoWatch: false,
Expand All @@ -132,19 +132,4 @@ module.exports = function(config) {
browserDisconnectTimeout: 300000,
browserDisconnectTolerance: 3
});

// Coverage reporting
// Coverage is enabled by passing the flag --coverage to npm test
var coverageFlag = process.env.npm_config_coverage;
var reportCoverage = process.env.TRAVIS || coverageFlag;

if (reportCoverage) {
config.reporters.push('coverage');
config.browserify.transform.push(istanbul({
instrumenter: isparta,
ignore: ['**/node_modules/**', '**/test/**']
}));
config.preprocessors['src/**/*.js'] = ['browserify', 'coverage'];
}

};
3 changes: 2 additions & 1 deletion test/media-groups.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
import * as MediaGroups from '../src/media-groups';
import PlaylistLoader from '../src/playlist-loader';
import DashPlaylistLoader from '../src/dash-playlist-loader';
import noop from '../src/util/noop';

QUnit.module('MediaGroups', {
beforeEach(assert) {
Expand All @@ -19,7 +20,7 @@ QUnit.module('MediaGroups', {

QUnit.test('createMediaTypes creates skeleton object for all supported media groups',
function(assert) {
const noopToString = 'function noop() {}';
const noopToString = noop.toString();
const result = MediaGroups.createMediaTypes();

assert.ok(result.AUDIO, 'created AUDIO media group object');
Expand Down

0 comments on commit 586f317

Please sign in to comment.