1
0
mirror of https://github.com/videojs/video.js.git synced 2024-12-25 02:42:10 +02:00

@gkatsev added tests for webpack and browserify bundling and node.js requiring. closes #3558

This commit is contained in:
Gary Katsevman 2016-08-24 16:31:19 -04:00
parent b90f04fc3b
commit c154518df4
8 changed files with 55 additions and 2 deletions

View File

@ -18,6 +18,7 @@ CHANGELOG
* greenkeeper updated uglify ([view](https://github.com/videojs/video.js/pull/3547))
* greenkeeper updated grunt-concurrent ([view](https://github.com/videojs/video.js/pull/3532))
* greenkeeper updated karma-chrome-launcher ([view](https://github.com/videojs/video.js/pull/3553))
* @gkatsev added tests for webpack and browserify bundling and node.js requiring ([view](https://github.com/videojs/video.js/pull/3558))
--------------------

View File

@ -434,6 +434,24 @@ module.exports = function(grunt) {
options: {
preferLocal: true
}
},
noderequire: {
command: 'node test/require/node.js',
options: {
failOnError: true
}
},
browserify: {
command: 'browserify test/require/browserify.js -o build/temp/browserify.js',
options: {
preferLocal: true
}
},
webpack: {
command: 'webpack test/require/webpack.js build/temp/webpack.js',
options: {
preferLocal: true
}
}
}
});
@ -487,7 +505,11 @@ module.exports = function(grunt) {
grunt.registerTask('default', ['test']);
// The test script includes coveralls only when the TRAVIS env var is set.
grunt.registerTask('test', ['build', 'karma:defaults'].concat(process.env.TRAVIS && 'coveralls').filter(Boolean));
grunt.registerTask('test', [
'build',
'shell:noderequire',
'shell:browserify',
'karma:defaults'].concat(process.env.TRAVIS && 'coveralls').filter(Boolean));
// Run while developing
grunt.registerTask('dev', ['build', 'connect:dev', 'concurrent:watchSandbox']);

View File

@ -94,7 +94,8 @@
"time-grunt": "^1.1.1",
"uglify-js": "~2.7.3",
"videojs-doc-generator": "0.0.1",
"videojs-standard": "^5.2.0"
"videojs-standard": "^5.2.0",
"webpack": "^1.13.2"
},
"vjsstandard": {
"ignore": [

View File

@ -14,6 +14,8 @@
<!-- Execute the bundled tests first -->
<script src="../build/temp/tests.js"></script>
<script src="../build/temp/browserify.js"></script>
<script src="../build/temp/webpack.js"></script>
</body>
</html>

View File

@ -13,6 +13,8 @@ module.exports = function(config) {
'../build/temp/ie8/videojs-ie8.min.js',
'../test/globals-shim.js',
'../test/unit/**/*.js',
'../build/temp/browserify.js',
'../build/temp/webpack.js',
{ pattern: '../src/**/*.js', watched: true, included: false, served: false }
],

View File

@ -0,0 +1,8 @@
/* eslint-disable no-var */
/* eslint-env qunit */
var videojs = require('../../');
QUnit.module('Browserify Require');
QUnit.test('videojs should be requirable and bundled via browserify', function(assert) {
assert.ok(videojs, 'videojs is required properly');
});

9
test/require/node.js Normal file
View File

@ -0,0 +1,9 @@
/* eslint-disable no-console */
try {
require('../../');
} catch (e) {
console.error(e);
process.exit(1);
}
process.exit(0);

8
test/require/webpack.js Normal file
View File

@ -0,0 +1,8 @@
/* eslint-disable no-var */
/* eslint-env qunit */
var videojs = require('../../');
QUnit.module('Webpack Require');
QUnit.test('videojs should be requirable and bundled via webpack', function(assert) {
assert.ok(videojs, 'videojs is required properly');
});