Skip to content

Commit bbefce0

Browse files
committed
Move all tests to Karma
It is a purely browser based component, and so it didn't make sense to split tests between browsers and node This also moves the karma tests back into Travis, which seems to work for now but could go bad..
1 parent 546678c commit bbefce0

6 files changed

Lines changed: 13 additions & 75 deletions

File tree

.travis.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ addons:
33
apt:
44
packages:
55
- sshpass
6+
before_install:
7+
- export CHROME_BIN=chromium-browser
8+
- export DISPLAY=:99.0
9+
- sh -e /etc/init.d/xvfb start
610
install:
711
- npm install -g npm@3
812
- npm install
@@ -15,7 +19,7 @@ node_js:
1519
- "iojs"
1620
script:
1721
- npm run lint
18-
- npm run test:mocha
22+
- npm run test
1923
- npm run build:compile
2024
- npm run build:demo
2125
after_success:

package.json

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111
"build:compile": "NODE_ENV=production babel src -d lib --ignore src/demo",
1212
"start": "node server.js",
1313
"lint": "standard --verbose | snazzy",
14-
"test:mocha": "NODE_ENV=production mocha --require ignore-styles test/mocha --compilers js:babel-core/register",
15-
"test:karma": "karma start test/karma.config.js",
16-
"test": "npm run test:mocha && npm run test:karma",
14+
"test": "karma start test/karma.config.js",
1715
"preversion": "npm run lint && npm run test",
1816
"version": "npm run update-changelog && npm run build:browser && git add CHANGELOG.md dist",
1917
"update-changelog": "auto-changelog --package --template compact",
@@ -55,12 +53,11 @@
5553
"babel-preset-react": "^6.3.13",
5654
"babel-preset-react-hmre": "^1.0.1",
5755
"babel-preset-stage-0": "^6.3.13",
58-
"chai": "^3.4.1",
56+
"chai": "^3.5.0",
5957
"css-loader": "^0.23.0",
6058
"exports-loader": "^0.6.2",
6159
"express": "^4.13.3",
6260
"extract-text-webpack-plugin": "^1.0.1",
63-
"ignore-styles": "^1.1.0",
6461
"imports-loader": "^0.6.4",
6562
"json-loader": "^0.5.4",
6663
"karma": "^0.13.16",
@@ -72,11 +69,10 @@
7269
"karma-mocha-reporter": "^2.0.0",
7370
"karma-sourcemap-loader": "^0.3.6",
7471
"karma-webpack": "^1.7.0",
75-
"mocha": "^2.3.4",
72+
"mocha": "^2.4.5",
7673
"node-sass": "^3.4.2",
7774
"normalize.css": "^4.0.0",
7875
"react": "^15.0.1",
79-
"react-addons-test-utils": "^15.0.1",
8076
"react-dom": "^15.0.1",
8177
"rimraf": "^2.4.4",
8278
"sass-loader": "^3.1.2",

test/karma.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ webpackConfig.devtool = 'inline-source-map'
33

44
module.exports = function (config) {
55
config.set({
6-
browsers: process.env.CONTINUOUS_INTEGRATION ? [ 'ChromeTravis' ] : [ 'Chrome', 'Firefox' ],
6+
browsers: process.env.TRAVIS ? [ 'ChromeTravis' ] : [ 'Chrome', 'Firefox' ],
77
singleRun: true,
88
frameworks: [ 'mocha', 'chai' ],
99
files: [
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import { describe, it } from 'mocha'
2-
import { expect } from 'chai'
3-
41
import SoundCloud from '../../src/players/SoundCloud'
52
import YouTube from '../../src/players/YouTube'
63
import Vimeo from '../../src/players/Vimeo'
74
import FilePlayer from '../../src/players/FilePlayer'
85

6+
const { describe, it, expect } = window
7+
98
describe('YouTube', () => {
109
it('knows what it can play', () => {
1110
expect(YouTube.canPlay('https://www.youtube.com/watch?v=12345678901')).to.be.true
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import { describe, it } from 'mocha'
2-
import { expect } from 'chai'
3-
41
import { parseStartTime } from '../../src/utils'
52

3+
const { describe, it, expect } = window
4+
65
const YOUTUBE_URL = 'http://youtu.be/12345678901'
76

87
describe('parseStartTime', () => {

test/mocha/ReactPlayer.js

Lines changed: 0 additions & 60 deletions
This file was deleted.

0 commit comments

Comments
 (0)