diff --git a/CHANGELOG.md b/CHANGELOG.md index 28977a19c..e8c11b135 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ CHANGELOG * @forbesjo added a vjs-button class to button controls ([view](https://github.com/videojs/video.js/pull/2084)) * @bc-bbay Load plugins before controls ([view](https://github.com/videojs/video.js/pull/2094)) * @bc-bbay rename onEvent methods to handleEvent ([view](https://github.com/videojs/video.js/pull/2093)) +* @dmlap added an error message if techOrder is not in options ([view](https://github.com/videojs/video.js/pull/2097)) -------------------- diff --git a/Gruntfile.js b/Gruntfile.js index e01e5cb93..74decc8e9 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -269,6 +269,21 @@ module.exports = function(grunt) { } }, browserify: { + options: { + transform: [ + require('babelify').configure({ + sourceMapRelative: './src/js' + }), + ['browserify-versionify', { + placeholder: '__VERSION__', + version: pkg.version + }], + ['browserify-versionify', { + placeholder: '__VERSION_NO_PATCH__', + version: version.majorMinor + }] + ] + }, build: { files: { 'build/temp/video.js': ['src/js/video.js'] @@ -281,19 +296,15 @@ module.exports = function(grunt) { banner: license, plugin: [ [ 'browserify-derequire' ] - ], - transform: [ - require('babelify').configure({ - sourceMapRelative: './src/js' - }), - ['browserify-versionify', { - placeholder: '__VERSION__', - version: pkg.version - }], - ['browserify-versionify', { - placeholder: '__VERSION_NO_PATCH__', - version: version.majorMinor - }] + ] + } + }, + test: { + files: { + 'build/temp/tests.js': [ + 'test/globals-shim.js', + 'test/unit/**/*.js', + 'test/api/**.js' ] } } @@ -307,6 +318,9 @@ module.exports = function(grunt) { } }, coveralls: { + options: { + force: true + }, all: { src: 'test/coverage/lcov.info' } diff --git a/src/js/player.js b/src/js/player.js index cab97a541..52012cab5 100644 --- a/src/js/player.js +++ b/src/js/player.js @@ -76,6 +76,17 @@ class Player extends Component { // Run base component initializing with new options super(null, options, ready); + + // if the global option object was accidentally blown away by + // someone, bail early with an informative error + if (!this.options_ || + !this.options_.techOrder || + !this.options_.techOrder.length) { + throw new Error('No techOrder specified. Did you overwrite ' + + 'videojs.options instead of just changing the ' + + 'properties you want to override?'); + } + this.tag = tag; // Store the original tag used to set options // Store the tag attributes used to restore html5 element diff --git a/test/globals-shim.js b/test/globals-shim.js new file mode 100644 index 000000000..cbcf7b034 --- /dev/null +++ b/test/globals-shim.js @@ -0,0 +1,10 @@ +import window from 'global/window'; +import sinon from 'sinon'; + +window.q = QUnit; +window.sinon = sinon; + +// This may not be needed anymore, but double check before removing +window.fixture = document.createElement('div'); +fixture.id = 'qunit-fixture'; +document.body.appendChild(fixture); diff --git a/test/index.html b/test/index.html new file mode 100644 index 000000000..41b1268b6 --- /dev/null +++ b/test/index.html @@ -0,0 +1,15 @@ + + + + + VideoJS Tests + + + + +
+ + + + + diff --git a/test/karma-qunit-shim.js b/test/karma-qunit-shim.js deleted file mode 100644 index 18611a8d2..000000000 --- a/test/karma-qunit-shim.js +++ /dev/null @@ -1,6 +0,0 @@ -var q = QUnit; - -// This may not be needed anymore, but double check before removing -var fixture = document.createElement('div'); -fixture.id = 'qunit-fixture'; -document.body.appendChild(fixture); \ No newline at end of file diff --git a/test/karma.conf.js b/test/karma.conf.js index 40b9773a6..9c5876f03 100644 --- a/test/karma.conf.js +++ b/test/karma.conf.js @@ -50,20 +50,16 @@ module.exports = function(config) { config.set({ basePath: '', - frameworks: ['browserify', 'qunit', 'sinon'], + frameworks: ['browserify', 'qunit'], autoWatch: false, singleRun: true, - // customLaunchers: customLaunchers, - files: [ '../build/temp/video-js.min.css', - '../test/karma-qunit-shim.js', - '../test/unit/**/*.js', '../build/temp/video.min.js', - '../test/api/**/*.js', + '../build/temp/tests.js', ], preprocessors: { @@ -84,7 +80,6 @@ module.exports = function(config) { 'karma-phantomjs-launcher', 'karma-safari-launcher', 'karma-sauce-launcher', - 'karma-sinon', 'karma-browserify', 'karma-coverage' ], diff --git a/test/unit/player.js b/test/unit/player.js index 7f7376e5e..aa63119f0 100644 --- a/test/unit/player.js +++ b/test/unit/player.js @@ -717,3 +717,14 @@ test('should be scrubbing while seeking', function(){ equal(player.scrubbing(), true, 'player is scrubbing'); ok(player.el().className.indexOf('scrubbing') !== -1, 'scrubbing class is present'); }); + +test('should throw on startup no techs are specified', function() { + const techOrder = Options.techOrder; + + Options.techOrder = null; + q.throws(function() { + videojs(TestHelpers.makeTag()); + }, 'a falsey techOrder should throw'); + + Options.techOrder = techOrder; +});