Skip to content

Commit

Permalink
Move all tests to Karma
Browse files Browse the repository at this point in the history
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..
  • Loading branch information
cookpete committed Apr 19, 2016
1 parent 546678c commit bbefce0
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 75 deletions.
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ addons:
apt:
packages:
- sshpass
before_install:
- export CHROME_BIN=chromium-browser
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
install:
- npm install -g npm@3
- npm install
Expand All @@ -15,7 +19,7 @@ node_js:
- "iojs"
script:
- npm run lint
- npm run test:mocha
- npm run test
- npm run build:compile
- npm run build:demo
after_success:
Expand Down
10 changes: 3 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
"build:compile": "NODE_ENV=production babel src -d lib --ignore src/demo",
"start": "node server.js",
"lint": "standard --verbose | snazzy",
"test:mocha": "NODE_ENV=production mocha --require ignore-styles test/mocha --compilers js:babel-core/register",
"test:karma": "karma start test/karma.config.js",
"test": "npm run test:mocha && npm run test:karma",
"test": "karma start test/karma.config.js",
"preversion": "npm run lint && npm run test",
"version": "npm run update-changelog && npm run build:browser && git add CHANGELOG.md dist",
"update-changelog": "auto-changelog --package --template compact",
Expand Down Expand Up @@ -55,12 +53,11 @@
"babel-preset-react": "^6.3.13",
"babel-preset-react-hmre": "^1.0.1",
"babel-preset-stage-0": "^6.3.13",
"chai": "^3.4.1",
"chai": "^3.5.0",
"css-loader": "^0.23.0",
"exports-loader": "^0.6.2",
"express": "^4.13.3",
"extract-text-webpack-plugin": "^1.0.1",
"ignore-styles": "^1.1.0",
"imports-loader": "^0.6.4",
"json-loader": "^0.5.4",
"karma": "^0.13.16",
Expand All @@ -72,11 +69,10 @@
"karma-mocha-reporter": "^2.0.0",
"karma-sourcemap-loader": "^0.3.6",
"karma-webpack": "^1.7.0",
"mocha": "^2.3.4",
"mocha": "^2.4.5",
"node-sass": "^3.4.2",
"normalize.css": "^4.0.0",
"react": "^15.0.1",
"react-addons-test-utils": "^15.0.1",
"react-dom": "^15.0.1",
"rimraf": "^2.4.4",
"sass-loader": "^3.1.2",
Expand Down
2 changes: 1 addition & 1 deletion test/karma.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ webpackConfig.devtool = 'inline-source-map'

module.exports = function (config) {
config.set({
browsers: process.env.CONTINUOUS_INTEGRATION ? [ 'ChromeTravis' ] : [ 'Chrome', 'Firefox' ],
browsers: process.env.TRAVIS ? [ 'ChromeTravis' ] : [ 'Chrome', 'Firefox' ],
singleRun: true,
frameworks: [ 'mocha', 'chai' ],
files: [
Expand Down
5 changes: 2 additions & 3 deletions test/mocha/canPlay.js → test/karma/canPlay.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { describe, it } from 'mocha'
import { expect } from 'chai'

import SoundCloud from '../../src/players/SoundCloud'
import YouTube from '../../src/players/YouTube'
import Vimeo from '../../src/players/Vimeo'
import FilePlayer from '../../src/players/FilePlayer'

const { describe, it, expect } = window

describe('YouTube', () => {
it('knows what it can play', () => {
expect(YouTube.canPlay('https://www.youtube.com/watch?v=12345678901')).to.be.true
Expand Down
5 changes: 2 additions & 3 deletions test/mocha/parseStartTime.js → test/karma/parseStartTime.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { describe, it } from 'mocha'
import { expect } from 'chai'

import { parseStartTime } from '../../src/utils'

const { describe, it, expect } = window

const YOUTUBE_URL = 'http://youtu.be/12345678901'

describe('parseStartTime', () => {
Expand Down
60 changes: 0 additions & 60 deletions test/mocha/ReactPlayer.js

This file was deleted.

0 comments on commit bbefce0

Please sign in to comment.