Skip to content

Commit d3d06c5

Browse files
committed
setup: babel, webpack, etc.
1 parent c53a543 commit d3d06c5

File tree

3 files changed

+94
-0
lines changed

3 files changed

+94
-0
lines changed

.babelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["airbnb", "es2015", "stage-0"]
3+
}

package.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"name": "react-testing-components-enzyme",
3+
"version": "1.0.0",
4+
"description": "Sample repo for a blog post on testing react components with enzyme",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "mocha test/helpers/browser.js test/**/*.spec.js",
8+
"dev:hot": "webpack-dev-server --hot --inline --progress --colors --watch --display-error-details --display-cached --content-base ./"
9+
},
10+
"ava": {
11+
"require": [
12+
"./test/helpers/setup-browser-env.js"
13+
]
14+
},
15+
"repository": {
16+
"type": "git",
17+
"url": "git+https://github.com/markthethomas/react-testing-components-enzyme.git"
18+
},
19+
"author": "Mark Thomas <markthethomas@gmail.com>",
20+
"license": "MIT",
21+
"bugs": {
22+
"url": "https://github.com/markthethomas/react-testing-components-enzyme/issues"
23+
},
24+
"homepage": "https://github.com/markthethomas/react-testing-components-enzyme#readme",
25+
"devDependencies": {
26+
"ava": "^0.12.0",
27+
"babel-core": "^6.6.4",
28+
"babel-loader": "^6.2.4",
29+
"babel-preset-airbnb": "^1.1.1",
30+
"babel-preset-es2015": "^6.6.0",
31+
"babel-preset-react": "^6.5.0",
32+
"babel-preset-stage-0": "^6.5.0",
33+
"bell-on-bundler-error-plugin": "^1.0.8",
34+
"chai": "^3.5.0",
35+
"enzyme": "^2.0.0",
36+
"react-addons-test-utils": "^0.14.7",
37+
"webpack": "^1.12.14",
38+
"webpack-dev-server": "^1.14.1"
39+
},
40+
"dependencies": {
41+
"axios": "^0.9.1",
42+
"md5": "^2.0.0",
43+
"react": "^0.14.7",
44+
"react-dom": "^0.14.7"
45+
}
46+
}

webpack.config.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
const path = require('path');
2+
const webpack = require('webpack');
3+
const BellOnBundlerErrorPlugin = require('bell-on-bundler-error-plugin');
4+
5+
// env
6+
const buildDirectory = './dist/';
7+
8+
module.exports = {
9+
externals: {
10+
'cheerio': 'window',
11+
'react/lib/ExecutionEnvironment': true,
12+
'react/lib/ReactContext': true,
13+
},
14+
entry: './lib/gravatar.jsx',
15+
devServer: {
16+
hot: true,
17+
inline: true,
18+
port: 7700,
19+
historyApiFallback: true,
20+
},
21+
resolve: {
22+
extensions: ['', '.js', '.jsx'],
23+
},
24+
output: {
25+
path: path.resolve(buildDirectory),
26+
filename: 'app.js',
27+
publicPath: 'http://localhost:7700/dist',
28+
},
29+
module: {
30+
loaders: [{
31+
test: /\.jsx?$/,
32+
exclude: /(node_modules|bower_components)/,
33+
loader: 'babel',
34+
query: {
35+
presets: ['react', 'es2015', 'stage-0'],
36+
},
37+
}],
38+
},
39+
plugins: [
40+
new BellOnBundlerErrorPlugin(),
41+
new webpack.optimize.OccurenceOrderPlugin(true),
42+
// new webpack.optimize.DedupePlugin(),
43+
// new webpack.optimize.UglifyJsPlugin(),
44+
],
45+
};

0 commit comments

Comments
 (0)