1
0
mirror of https://github.com/videojs/video.js.git synced 2025-05-13 22:16:49 +02:00

Grunt improvements

Get test/index.html working when loaded directly into a browser. Remove extra browserifying via karma. Add timing info to to grunt output.
This commit is contained in:
David LaPalomento 2015-04-29 14:36:20 -07:00
parent b5968f13e2
commit 54519da32c
6 changed files with 40 additions and 56 deletions

View File

@ -1,4 +1,6 @@
module.exports = function(grunt) {
require('time-grunt')(grunt);
var pkg = grunt.file.readJSON('package.json');
var license = grunt.file.read('build/license-header.txt');
var verParts = pkg.version.split('.');
@ -269,7 +271,19 @@ module.exports = function(grunt) {
}
},
browserify: {
build: {
files: {
'build/temp/video.js': ['src/js/video.js']
},
options: {
browserifyOptions: {
debug: true,
standalone: 'videojs'
},
banner: license,
plugin: [
[ 'browserify-derequire' ]
],
transform: [
require('babelify').configure({
sourceMapRelative: './src/js'
@ -283,28 +297,19 @@ module.exports = function(grunt) {
version: version.majorMinor
}]
]
},
build: {
files: {
'build/temp/video.js': ['src/js/video.js']
},
options: {
browserifyOptions: {
debug: true,
standalone: 'videojs'
},
banner: license,
plugin: [
[ 'browserify-derequire' ]
]
}
},
test: {
files: {
'build/temp/tests.js': [
'test/globals-shim.js',
'test/unit/**/*.js',
'test/api/**.js'
'test/unit/**/*.js'
]
},
options: {
transform: [
require('babelify').configure(),
'browserify-istanbul'
]
}
}
@ -319,6 +324,8 @@ module.exports = function(grunt) {
},
coveralls: {
options: {
// warn instead of failing when coveralls errors
// we've seen coveralls 503 relatively frequently
force: true
},
all: {
@ -336,29 +343,8 @@ module.exports = function(grunt) {
}
});
grunt.loadNpmTasks('grunt-videojs-languages');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('videojs-doc-generator');
grunt.loadNpmTasks('grunt-zip');
grunt.loadNpmTasks('grunt-banner');
grunt.loadNpmTasks('grunt-version');
grunt.loadNpmTasks('chg');
grunt.loadNpmTasks('grunt-fastly');
grunt.loadNpmTasks('grunt-github-releaser');
grunt.loadNpmTasks('grunt-aws-s3');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-coveralls');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-exorcise');
// load all the npm grunt tasks
require('load-grunt-tasks')(grunt);
grunt.registerTask('build', [
'clean:build',

View File

@ -71,8 +71,10 @@
"karma-safari-launcher": "^0.1.1",
"karma-sauce-launcher": "^0.2.8",
"karma-sinon": "^1.0.3",
"load-grunt-tasks": "^3.1.0",
"qunitjs": "~1.14.0",
"sinon": "~1.9.1",
"time-grunt": "^1.1.1",
"uglify-js": "~2.3.6",
"videojs-doc-generator": "0.0.1"
}

View File

@ -72,9 +72,6 @@ var videojs = function(id, options, ready){
return tag['player'] || new Player(tag, options, ready);
};
// Extended name, also available externally, window.videojs
// var videojs = window['videojs'] = vjs;
// CDN Version. Used to target right flash swf.
videojs.CDN_VERSION = '__VERSION_NO_PATCH__';
videojs.ACCESS_PROTOCOL = ('https:' == document.location.protocol ? 'https://' : 'http://');

View File

@ -5,7 +5,7 @@
(function(){
q.module('Player Minified');
q.module('Player API');
test('videojs should exist on the window', function() {
ok(window.videojs, 'videojs exists on the window');

View File

@ -9,7 +9,12 @@
<body>
<div id="qunit"></div>
<script src="../node_modules/qunitjs/qunit/qunit.js"></script>
<!-- Execute the bundled tests first -->
<script src="../build/temp/tests.js"></script>
<!-- Include the video.js globals to run the API tests against -->
<script src="../build/temp/video.min.js"></script>
<script src="api/api.js"></script>
</body>
</html>

View File

@ -50,27 +50,22 @@ module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['browserify', 'qunit'],
frameworks: ['qunit'],
autoWatch: false,
singleRun: true,
files: [
// include and execute the standalone test bundle first
'../build/temp/tests.js',
// then include video.js through globals to run the API tests
'../build/temp/video-js.min.css',
'../build/temp/video.min.js',
'../build/temp/tests.js',
'api/api.js'
],
preprocessors: {
'../test/unit/**/*.js': [ 'browserify' ]
},
browserify: {
debug: true,
transform: [ 'babelify', 'browserify-istanbul' ]
},
plugins: [
'karma-qunit',
'karma-chrome-launcher',
@ -80,7 +75,6 @@ module.exports = function(config) {
'karma-phantomjs-launcher',
'karma-safari-launcher',
'karma-sauce-launcher',
'karma-browserify',
'karma-coverage'
],