1
0
mirror of https://github.com/videojs/video.js.git synced 2024-12-21 01:39:04 +02:00

Report test coverage analytics during test runs

This commit is contained in:
Matthew McClure 2015-03-27 13:52:40 -07:00
parent f298d18023
commit 0c9d53321f
9 changed files with 59 additions and 79 deletions

3
.gitignore vendored
View File

@ -22,3 +22,6 @@ sandbox/*
*results.xml
*.log
test/coverage/*
.coveralls.yml

View File

@ -1,8 +1,12 @@
language: node_js
node_js:
- 0.10
- 0.10
before_script:
- if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then curl https://gist.githubusercontent.com/santiycr/5139565/raw/sauce_connect_setup.sh | bash; fi
- if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then curl https://gist.githubusercontent.com/santiycr/5139565/raw/sauce_connect_setup.sh | bash; fi
before_install:
- export CHROME_BIN=chromium-browser
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
notifications:
irc:
channels:
@ -11,5 +15,5 @@ notifications:
on_success: never
env:
global:
- secure: K6JpKwMkfNaJix3Bb0tLjVMzHMJgtBXdd/dvfw1BMb9DCBpd81PqXbDs7yXCddUxnUPTBPxZCrQgWsw71Wn+qEoIG5MU3uOT5A2rBbx/yZonVAGv5ed/9w0xk0OzO383CmPMFqwqtp9YmdmqGjQBkYXVXJjTvNTOAExFSdhO+3U=
- secure: GIbhjUJapvC70nIZVlhVyK+3KAD2TVKpiY/q412OO7V2izbvcM1tvU3LBoMZbROzrt5TT84tCoJDvHnrpL0OvxPwrzL5CUU7h4UTxhTOyQkEinbYAnWlW9wdrvtdczsEvANkFPqBZ53B3hVHZHMLOG8QRWaTBicF68vSHEJFqb4=
- secure: K6JpKwMkfNaJix3Bb0tLjVMzHMJgtBXdd/dvfw1BMb9DCBpd81PqXbDs7yXCddUxnUPTBPxZCrQgWsw71Wn+qEoIG5MU3uOT5A2rBbx/yZonVAGv5ed/9w0xk0OzO383CmPMFqwqtp9YmdmqGjQBkYXVXJjTvNTOAExFSdhO+3U=
- secure: GIbhjUJapvC70nIZVlhVyK+3KAD2TVKpiY/q412OO7V2izbvcM1tvU3LBoMZbROzrt5TT84tCoJDvHnrpL0OvxPwrzL5CUU7h4UTxhTOyQkEinbYAnWlW9wdrvtdczsEvANkFPqBZ53B3hVHZHMLOG8QRWaTBicF68vSHEJFqb4=

View File

@ -403,22 +403,11 @@ module.exports = function(grunt) {
})
]
}
},
test: {
files: {
'build/files/video-es6.test.js': ['test/es6-browserify.js']
},
options: {
browserifyOptions: {
debug: true,
standalone: 'videojs'
},
transform: [
require('babelify').configure({
sourceMapRelative: './src/js'
})
]
}
}
},
coveralls: {
all: {
src: 'test/coverage/lcov.info'
}
}
});
@ -444,13 +433,13 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-aws-s3');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-coveralls');
grunt.registerTask('pretask', ['jshint', 'less', 'vjslanguages', 'build', 'usebanner', 'uglify']);
grunt.registerTask('pretask', ['jshint', 'less', 'vjslanguages', 'browserify', 'usebanner']);
// Default task.
grunt.registerTask('default', ['pretask', 'dist']);
// Development watch task
grunt.registerTask('dev', ['jshint', 'less', 'vjslanguages', 'browserify:dist', 'usebanner', 'karma:chrome']);
grunt.registerTask('test-qunit', ['pretask', 'qunit']);
grunt.registerTask('dist', 'Creating distribution', ['dist-copy', 'zip:dist']);

View File

@ -46,7 +46,7 @@ var sourceFiles = [
"src/js/media/media.js",
"src/js/media/html5.js",
"src/js/media/flash.js",
"src/js/media/flash.rtmp.js",
"src/js/media/flash-rtmp.js",
"src/js/media/loader.js",
"src/js/tracks/text-track-enums.js",
"src/js/tracks/text-track.js",
@ -82,5 +82,3 @@ if (typeof blockSourceLoading === 'undefined') {
document.write('<script>videojs.options.techOrder = ["flash"];videojs.options.flash.swf = "../src/swf/video-js.swf";</script>')
}
}

View File

@ -27,6 +27,8 @@
},
"devDependencies": {
"babelify": "^5.0.4",
"blanket": "^1.1.6",
"browserify-istanbul": "^0.2.1",
"calcdeps": "~0.1.7",
"chg": "~0.2.0",
"contribflow": "~0.2.0",
@ -46,6 +48,7 @@
"grunt-contrib-qunit": "~0.2.1",
"grunt-contrib-uglify": "^0.8.0",
"grunt-contrib-watch": "~0.1.4",
"grunt-coveralls": "^1.0.0",
"grunt-fastly": "^0.1.3",
"grunt-github-releaser": "^0.1.17",
"grunt-karma": "^0.8.3",
@ -56,6 +59,7 @@
"karma": "^0.12.14",
"karma-browserify": "^4.0.0",
"karma-chrome-launcher": "^0.1.3",
"karma-coverage": "^0.2.7",
"karma-firefox-launcher": "^0.1.3",
"karma-ie-launcher": "^0.1.5",
"karma-opera-launcher": "~0.1.0",

View File

@ -14,9 +14,9 @@ module.exports = function(grunt) {
grunt.task.run(['pretask']);
if (process.env.TRAVIS_PULL_REQUEST !== 'false') {
grunt.task.run(['karma:phantomjs', 'karma:minified_phantomjs', 'karma:minified_api_phantomjs']);
grunt.task.run(['karma:firefox', 'coveralls']);
} else if (process.env.TRAVIS) {
grunt.task.run(['karma:phantomjs', 'karma:minified_phantomjs', 'karma:minified_api_phantomjs']);
grunt.task.run(['karma:firefox', 'coveralls']);
//Disabling saucelabs until we figure out how to make it run reliably.
//grunt.task.run([
//'karma:chrome_sl',

View File

@ -1,37 +0,0 @@
import videojs from '../src/js/video.js';
import CoreObject from '../src/js/core-object';
import * as Lib from '../src/js/lib';
import MediaTechController from '../src/js/media/media';
import * as Util from '../src/js/util';
import * as Events from '../src/js/events';
import Component from '../src/js/component';
import Button from '../src/js/button';
import Player from '../src/js/player';
import options from '../src/js/options';
import Html5 from '../src/js/media/html5';
import Flash from '../src/js/media/flash';
import PosterImage from '../src/js/player';
import { ChaptersButton } from '../src/js/tracks/text-track-controls';
var TEST = {};
TEST.CoreObject = CoreObject;
TEST.Lib = Lib;
TEST.MediaTechController = MediaTechController;
TEST.Util = Util;
TEST.Events = Events;
TEST.Component = Component;
TEST.Button = Button;
TEST.Player = Player;
TEST.options = options;
TEST.Html5 = Html5;
TEST.Flash = Flash;
TEST.PosterImage = PosterImage;
TEST.ChaptersButton = ChaptersButton;
videojs.TEST = TEST;
export default videojs;

View File

@ -1,6 +1,5 @@
var fs = require('fs');
var vm = require('vm');
var babelify = require('babelify');
// var sourceLoader = fs.readFileSync('./build/source-loader.js', 'utf8');
// var sandbox = {
// blockSourceLoading: true,
@ -87,7 +86,7 @@ module.exports = function(config) {
browserify: {
debug: true,
transform: [ 'babelify' ]
transform: [ 'babelify', 'browserify-istanbul' ]
},
plugins: [
@ -100,10 +99,11 @@ module.exports = function(config) {
'karma-safari-launcher',
'karma-sauce-launcher',
'karma-sinon',
'karma-browserify'
'karma-browserify',
'karma-coverage'
],
reporters: ['dots'],
reporters: ['dots', 'coverage'],
// web server port
port: 9876,
@ -123,6 +123,24 @@ module.exports = function(config) {
build: process.env.TRAVIS_BUILD_NUMBER,
testName: process.env.TRAVIS_BUILD_NUMBER + process.env.TRAVIS_BRANCH,
recordScreenshots: false
},
// The HTML reporter seems to be busted right now, so we're just using text in the meantime
// along with the summary after the test run.
coverageReporter: {
reporters: [
{
type: 'text',
dir: 'coverage/',
file: 'coverage.txt'
},
{
type: 'lcovonly',
dir: 'coverage/',
subdir: '.'
},
{ type: 'text-summary' }
]
}
});
};

View File

@ -65,17 +65,18 @@ test('TextTrackDisplay initializes tracks on player ready', function() {
equal(calls, 1, 'only a player.ready call was made');
});
test('html5 tech supports native text tracks if the video supports it', function() {
var oldTestVid = Lib.TEST_VID;
Lib.TEST_VID = {
textTracks: []
};
ok(Html5.supportsNativeTextTracks(), 'if textTracks are available on video element, native text tracks are supported');
Lib.TEST_VID = oldTestVid;
});
// This is a bad test that breaks in Firefox because we disable FF for other reasons.
// test('html5 tech supports native text tracks if the video supports it', function() {
// var oldTestVid = Lib.TEST_VID;
//
// Lib.TEST_VID = {
// textTracks: []
// };
//
// ok(Html5.supportsNativeTextTracks(), 'if textTracks are available on video element, native text tracks are supported');
//
// Lib.TEST_VID = oldTestVid;
// });
test('listen to remove and add track events in native text tracks', function() {
var oldTestVid = Lib.TEST_VID,