forked from react-boilerplate/react-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'jbinto-karma-chrome' into v3.0.0
- Loading branch information
Showing
8 changed files
with
114 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,16 @@ | ||
language: node_js | ||
sudo: true | ||
node_js: | ||
- "5" | ||
- "4" | ||
- "0.10" | ||
- "5.0" | ||
script: npm run build | ||
before_install: | ||
- export CHROME_BIN=/usr/bin/google-chrome | ||
- export DISPLAY=:99.0 | ||
- sudo apt-get update | ||
- sudo apt-get install -y libappindicator1 fonts-liberation | ||
- wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb | ||
- sudo dpkg -i google-chrome*.deb | ||
- sh -e /etc/init.d/xvfb start | ||
notifications: | ||
email: | ||
on_failure: change |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
import Img from './index'; | ||
|
||
import { expect } from 'chai'; | ||
import expect from 'expect'; | ||
import { shallow } from 'enzyme'; | ||
import React from 'react'; | ||
|
||
describe('<Img />', () => { | ||
it('should render an <img> tag', () => { | ||
const renderedComponent = shallow(<Img src="test.png" alt="test" />); | ||
expect(renderedComponent).to.have.tagName('img'); | ||
expect(renderedComponent.find('img').length).toEqual(1); | ||
}); | ||
|
||
it('should have an alt attribute', () => { | ||
const renderedComponent = shallow(<Img src="test.png" alt="test" />); | ||
expect(renderedComponent).to.have.attr('alt', 'test'); | ||
expect(renderedComponent.prop('alt')).toEqual('test'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
var path = require('path'); | ||
var webpackConfig = require('./webpack/webpack.test.babel'); | ||
|
||
module.exports = function(config) { | ||
config.set({ | ||
frameworks: ['mocha'], | ||
reporters: ['mocha'], | ||
|
||
browsers: process.env.TRAVIS | ||
? ['ChromeTravis'] | ||
: ['Chrome'], | ||
|
||
autoWatch: process.env.TRAVIS ? false : true, | ||
singleRun: process.env.TRAVIS ? true : false, | ||
|
||
files: [ | ||
'app/**/*.test.js' | ||
], | ||
|
||
preprocessors: { | ||
['app/**/*.test.js']: ['webpack', 'sourcemap'], | ||
}, | ||
|
||
webpack: webpackConfig, | ||
|
||
// make Webpack bundle generation quiet | ||
webpackMiddleware: { | ||
noInfo: true | ||
}, | ||
|
||
customLaunchers: { | ||
ChromeTravis: { | ||
base: 'Chrome', | ||
flags: ['--no-sandbox'] | ||
} | ||
} | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** | ||
* TEST WEBPACK CONFIGURATION | ||
*/ | ||
|
||
module.exports = { | ||
devtool: 'inline-source-map', | ||
module: { | ||
// Some libraries don't like being run through babel. | ||
// If they gripe, put them here. | ||
noParse: [ | ||
/node_modules\/sinon/, | ||
/node_modules\/acorn/, | ||
], | ||
loaders: [ | ||
{ test: /\.json$/, loader: 'json-loader' }, | ||
{ test: /\.css$/, loader: 'null-loader' }, | ||
{ test: /\.js$/, | ||
loader: 'babel', | ||
exclude: [/node_modules/], | ||
query: { | ||
plugins: ['babel-plugin-rewire'] | ||
} | ||
}, | ||
] | ||
}, | ||
// Some node_modules pull in Node-specific dependencies. | ||
// Since we're running in a browser we have to stub them out. See: | ||
// https://webpack.github.io/docs/configuration.html#node | ||
// https://github.com/webpack/node-libs-browser/tree/master/mock | ||
// https://github.com/webpack/jade-loader/issues/8#issuecomment-55568520 | ||
node: { | ||
fs: 'empty', | ||
child_process: 'empty', | ||
net: 'empty', | ||
tls: 'empty', | ||
}, | ||
// required for enzyme to work properly | ||
externals: { | ||
jsdom: 'window', | ||
cheerio: 'window', | ||
'react/lib/ExecutionEnvironment': true, | ||
'react/lib/ReactContext': 'window' | ||
}, | ||
resolve: { | ||
alias: { | ||
// required for enzyme to work properly | ||
sinon: 'sinon/pkg/sinon' | ||
}, | ||
}, | ||
}; |