karma working with videojs-contrib-hls
Showing
5 changed files
with
177 additions
and
7 deletions
1 | language: node_js | 1 | language: node_js |
2 | node_js: | ||
3 | - "0.10" | ||
4 | - "0.8" | ||
5 | - "0.11" | ||
2 | before_script: | 6 | before_script: |
3 | - npm install -g grunt-cli | 7 | - npm install -g grunt-cli |
8 | - curl https://gist.github.com/santiycr/5139565/raw/sauce_connect_setup.sh | bash | ||
4 | notifications: | 9 | notifications: |
5 | hipchat: | 10 | hipchat: fa664f1eb0940506d8c511a791780e @ test room |
6 | rooms: | 11 | rooms: |
7 | secure: l5TTd5JuPAW883PtcyaIBcJI9Chr9JpsZPQAEUBKAgIEwzuS6y7t5arlkS1PwH6gi1FADzYDf+OXSIou4GkTSrIetnBcT/SAgF0gBKgIhj+eRkuCfZ4VaC7BPhfZ0hgYRE+5Ejf5BM2MJafRm0pj7OlqG4xKrQZwtuV1te5r3JY= | 12 | secure: l5TTd5JuPAW883PtcyaIBcJI9Chr9JpsZPQAEUBKAgIEwzuS6y7t5arlkS1PwH6gi1FADzYDf+OXSIou4GkTSrIetnBcT/SAgF0gBKgIhj+eRkuCfZ4VaC7BPhfZ0hgYRE+5Ejf5BM2MJafRm0pj7OlqG4xKrQZwtuV1te5r3JY= |
13 | |||
14 | addons: | ||
15 | sauce_connect: | ||
16 | username: "sheff555" | ||
17 | access_key: "d04372cc-0fc3-4e59-aa02-3cfd9df03240" | ||
18 | ... | ... |
... | @@ -32,7 +32,7 @@ module.exports = function(grunt) { | ... | @@ -32,7 +32,7 @@ module.exports = function(grunt) { |
32 | 'src/segment-parser.js', | 32 | 'src/segment-parser.js', |
33 | 'src/stream.js', | 33 | 'src/stream.js', |
34 | 'src/m3u8/m3u8-parser.js' | 34 | 'src/m3u8/m3u8-parser.js' |
35 | ], | 35 | ], |
36 | dest: 'dist/videojs.hls.js' | 36 | dest: 'dist/videojs.hls.js' |
37 | } | 37 | } |
38 | }, | 38 | }, |
... | @@ -107,10 +107,26 @@ module.exports = function(grunt) { | ... | @@ -107,10 +107,26 @@ module.exports = function(grunt) { |
107 | logConcurrentOutput: true | 107 | logConcurrentOutput: true |
108 | } | 108 | } |
109 | } | 109 | } |
110 | } | 110 | }, |
111 | karma: { | ||
112 | options: { | ||
113 | configFile: 'test/karma.conf.js', | ||
114 | frameworks: ['qunit'] | ||
115 | }, | ||
116 | dev: { | ||
117 | configFile: 'test/karma.conf.js', | ||
118 | autoWatch: true | ||
119 | }, | ||
120 | ci: { | ||
121 | configFile: 'test/karma.conf.js', | ||
122 | autoWatch: false | ||
123 | } | ||
124 | }, | ||
125 | |||
111 | }); | 126 | }); |
112 | 127 | ||
113 | // These plugins provide necessary tasks. | 128 | // These plugins provide necessary tasks. |
129 | grunt.loadNpmTasks('grunt-karma'); | ||
114 | grunt.loadNpmTasks('grunt-contrib-clean'); | 130 | grunt.loadNpmTasks('grunt-contrib-clean'); |
115 | grunt.loadNpmTasks('grunt-contrib-concat'); | 131 | grunt.loadNpmTasks('grunt-contrib-concat'); |
116 | grunt.loadNpmTasks('grunt-contrib-uglify'); | 132 | grunt.loadNpmTasks('grunt-contrib-uglify'); |
... | @@ -120,6 +136,9 @@ module.exports = function(grunt) { | ... | @@ -120,6 +136,9 @@ module.exports = function(grunt) { |
120 | grunt.loadNpmTasks('grunt-contrib-connect'); | 136 | grunt.loadNpmTasks('grunt-contrib-connect'); |
121 | grunt.loadNpmTasks('grunt-open'); | 137 | grunt.loadNpmTasks('grunt-open'); |
122 | grunt.loadNpmTasks('grunt-concurrent'); | 138 | grunt.loadNpmTasks('grunt-concurrent'); |
139 | grunt.loadNpmTasks('grunt-saucelabs'); | ||
140 | grunt.loadNpmTasks('grunt-contrib-watch'); | ||
141 | |||
123 | 142 | ||
124 | grunt.registerTask('manifests-to-js', 'Wrap the test fixtures and output' + | 143 | grunt.registerTask('manifests-to-js', 'Wrap the test fixtures and output' + |
125 | ' so they can be loaded in a browser', | 144 | ' so they can be loaded in a browser', |
... | @@ -177,4 +196,11 @@ module.exports = function(grunt) { | ... | @@ -177,4 +196,11 @@ module.exports = function(grunt) { |
177 | 'concat', | 196 | 'concat', |
178 | 'uglify']); | 197 | 'uglify']); |
179 | 198 | ||
199 | grunt.registerTask('test', | ||
200 | ['manifests-to-js', 'qunit', 'karma']); | ||
201 | |||
202 | // travis build task | ||
203 | grunt.registerTask('build:travis', ['jshint', 'test:node', 'test:sauce-browser']); | ||
204 | |||
205 | |||
180 | }; | 206 | }; | ... | ... |
... | @@ -10,7 +10,7 @@ | ... | @@ -10,7 +10,7 @@ |
10 | }, | 10 | }, |
11 | "license": "Apache 2", | 11 | "license": "Apache 2", |
12 | "scripts": { | 12 | "scripts": { |
13 | "test": "grunt" | 13 | "test": "grunt test" |
14 | }, | 14 | }, |
15 | "devDependencies": { | 15 | "devDependencies": { |
16 | "grunt-contrib-jshint": "~0.6.0", | 16 | "grunt-contrib-jshint": "~0.6.0", |
... | @@ -23,7 +23,17 @@ | ... | @@ -23,7 +23,17 @@ |
23 | "grunt-concurrent": "0.4.3", | 23 | "grunt-concurrent": "0.4.3", |
24 | "grunt-open": "0.2.3", | 24 | "grunt-open": "0.2.3", |
25 | "grunt-shell": "0.6.1", | 25 | "grunt-shell": "0.6.1", |
26 | "grunt": "~0.4.1" | 26 | "grunt": "~0.4.1", |
27 | "grunt-karma": "~0.6.2", | ||
28 | "karma": "~0.10.0", | ||
29 | "karma-sauce-launcher": "~0.1.8", | ||
30 | "karma-chrome-launcher": "~0.1.2", | ||
31 | "karma-firefox-launcher": "~0.1.3", | ||
32 | "karma-ie-launcher": "~0.1.1", | ||
33 | "karma-opera-launcher": "~0.1.0", | ||
34 | "karma-phantomjs-launcher": "~0.1.1", | ||
35 | "karma-safari-launcher": "~0.1.1", | ||
36 | "karma-qunit": "~0.1.1" | ||
27 | }, | 37 | }, |
28 | "dependencies": { | 38 | "dependencies": { |
29 | "video.js": "git+https://github.com/videojs/video.js.git#v4.4.1", | 39 | "video.js": "git+https://github.com/videojs/video.js.git#v4.4.1", | ... | ... |
test/karma-qunit-shim.js
0 → 100644
test/karma.conf.js
0 → 100644
1 | // Karma example configuration file | ||
2 | // NOTE: To configure Karma tests, do the following: | ||
3 | // 1. Copy this file and rename the copy with a .conf.js extension, for example: karma.conf.js | ||
4 | // 2. Configure the properties below in your conf.js copy | ||
5 | // 3. Run your tests | ||
6 | |||
7 | module.exports = function(config) { | ||
8 | config.set({ | ||
9 | // base path, that will be used to resolve files and exclude | ||
10 | basePath: '', | ||
11 | |||
12 | frameworks: ['qunit'], | ||
13 | |||
14 | // Set autoWatch to true if you plan to run `grunt karma` continuously, to automatically test changes as you make them. | ||
15 | autoWatch: false, | ||
16 | |||
17 | // Setting singleRun to true here will start up your specified browsers, run tests, and then shut down the browsers. Helpful to have in a CI environment, where you don't want to leave browsers running continuously. | ||
18 | singleRun: true, | ||
19 | |||
20 | // Start these browsers, currently available: | ||
21 | // - Chrome | ||
22 | // - ChromeCanary | ||
23 | // - Firefox | ||
24 | // - Opera | ||
25 | // - Safari (only Mac) | ||
26 | // - PhantomJS | ||
27 | // - IE (only Windows) | ||
28 | // Example usage: | ||
29 | browsers: ['test_browser'], | ||
30 | |||
31 | // List of files / patterns to load in the browser | ||
32 | // Add any new src files to this list. | ||
33 | // If you add new unit tests, they will be picked up automatically by Karma, | ||
34 | // unless you've added them to a nested directory, in which case you should | ||
35 | // add their paths to this list. | ||
36 | |||
37 | files: [ | ||
38 | '../node_modules/video.js/dist/video-js/video.js', | ||
39 | '../node_modules/videojs-contrib-media-sources/videojs-media-sources.js', | ||
40 | '../test/karma-qunit-shim.js', | ||
41 | "../src/videojs-hls.js", | ||
42 | "../src/flv-tag.js", | ||
43 | "../src/exp-golomb.js", | ||
44 | "../src/h264-stream.js", | ||
45 | "../src/aac-stream.js", | ||
46 | "../src/segment-parser.js", | ||
47 | "../src/stream.js", | ||
48 | "../src/m3u8/m3u8-parser.js", | ||
49 | "../tmp/manifests.js", | ||
50 | "../tmp/expected.js", | ||
51 | "tsSegment-bc.js", | ||
52 | "../src/bin-utils.js", | ||
53 | "../src/async-queue.js", | ||
54 | '../test/*.js' | ||
55 | ], | ||
56 | |||
57 | plugins: [ | ||
58 | 'karma-qunit', | ||
59 | 'karma-chrome-launcher', | ||
60 | //'karma-firefox-launcher', | ||
61 | //'karma-ie-launcher', | ||
62 | //'karma-opera-launcher', | ||
63 | //'karma-phantomjs-launcher', | ||
64 | //'karma-safari-launcher', | ||
65 | 'karma-sauce-launcher' | ||
66 | ], | ||
67 | |||
68 | // list of files to exclude | ||
69 | exclude: [ | ||
70 | |||
71 | ], | ||
72 | |||
73 | |||
74 | // test results reporter to use | ||
75 | // possible values: 'dots', 'progress', 'junit' | ||
76 | reporters: ['progress'], | ||
77 | |||
78 | |||
79 | // web server port | ||
80 | port: 9876, | ||
81 | |||
82 | |||
83 | // cli runner port | ||
84 | runnerPort: 9100, | ||
85 | |||
86 | |||
87 | // enable / disable colors in the output (reporters and logs) | ||
88 | colors: true, | ||
89 | |||
90 | |||
91 | // level of logging | ||
92 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG | ||
93 | //logLevel: config.LOG_INFO, | ||
94 | |||
95 | // If browser does not capture in given timeout [ms], kill it | ||
96 | captureTimeout: 60000, | ||
97 | |||
98 | // global config for SauceLabs | ||
99 | sauceLabs: { | ||
100 | username: "sheff555", | ||
101 | accessKey: "d04372cc-0fc3-4e59-aa02-3cfd9df03240", | ||
102 | startConnect: true, | ||
103 | tunnelIdentifier: 'uniquekarmaidentifier', | ||
104 | testName: 'ps test sample' | ||
105 | }, | ||
106 | |||
107 | //define SL browsers | ||
108 | customLaunchers: { | ||
109 | test_browser: { | ||
110 | singleRun: true, | ||
111 | base: 'SauceLabs', | ||
112 | browserName: 'chrome', | ||
113 | platform: 'Windows XP' | ||
114 | } | ||
115 | } | ||
116 | |||
117 | }); | ||
118 | }; |
-
Please register or sign in to post a comment