Skip to content

Commit

Permalink
Update to babel 6 #78
Browse files Browse the repository at this point in the history
- tests pass with React 13 & 14
- npm run travis produces coverage
- npm link works
- use airbnb Babel6 preset
- modify react-compat to export functions individually
- update test commands to use babel-core
  • Loading branch information
lecstor committed Jan 22, 2016
1 parent 49e145b commit c0b30bc
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["airbnb"]
}
18 changes: 11 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
"version": "npm run build",
"clean": "rimraf build",
"lint": "eslint src/**",
"test": "mocha --compilers js:babel/register --recursive src/**/__tests__/*.js",
"test": "mocha --compilers js:babel-core/register --recursive src/**/__tests__/*.js",
"check": "npm run lint && npm run test:all",
"build": "babel src --out-dir build",
"test:watch": "mocha --compilers js:babel/register --recursive src/**/__tests__/*.js --watch",
"test:describeWithDOMOnly": "mocha --compilers js:babel/register --recursive src/**/__tests__/describeWithDOM/describeWithDOMOnly-spec.js",
"test:describeWithDOMSkip": "mocha --compilers js:babel/register --recursive src/**/__tests__/describeWithDOM/describeWithDOMSkip-spec.js",
"test:watch": "mocha --compilers js:babel-core/register --recursive src/**/__tests__/*.js --watch",
"test:describeWithDOMOnly": "mocha --compilers js:babel-core/register --recursive src/**/__tests__/describeWithDOM/describeWithDOMOnly-spec.js",
"test:describeWithDOMSkip": "mocha --compilers js:babel-core/register --recursive src/**/__tests__/describeWithDOM/describeWithDOMSkip-spec.js",
"test:all": "npm run react:13 && npm test && npm run test:describeWithDOMOnly && npm run test:describeWithDOMSkip && npm run react:14 && npm test && npm run test:describeWithDOMOnly && npm run test:describeWithDOMSkip",
"react:clean": "rimraf node_modules/react node_modules/react-dom node_modules/react-addons-test-utils",
"react:13": "npm run react:clean && npm i react@0.13",
Expand All @@ -25,7 +25,7 @@
"docs:build": "npm run docs:prepare && gitbook build",
"docs:watch": "npm run docs:prepare && gitbook serve",
"docs:publish": "npm run docs:clean && npm run docs:build && cd _book && git init && git commit --allow-empty -m 'update book' && git fetch https://github.com/airbnb/enzyme.git gh-pages && git checkout -b gh-pages && git add . && git commit -am 'update book' && git push https://github.com/airbnb/enzyme.git gh-pages --force",
"travis": "istanbul cover _mocha -- --compilers js:babel/register --recursive src/**/__tests__/*.js"
"travis": "babel-istanbul cover --report html _mocha -- --recursive src/**/__tests__/*.js"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -55,16 +55,20 @@
"underscore": "^1.8.3"
},
"devDependencies": {
"babel": "^5.8.21",
"babel-cli": "^6.3.17",
"babel-core": "^6.3.21",
"babel-eslint": "^4.1.4",
"babel-istanbul": "^0.5.9",
"babel-preset-airbnb": "^1.0.1",
"babel-register": "^6.3.13",
"chai": "^3.2.0",
"coveralls": "^2.11.4",
"eslint": "^1.10.3",
"eslint-config-airbnb": "^3.0.2",
"eslint-plugin-react": "^3.14.0",
"gitbook-cli": "^1.0.0",
"istanbul": "^0.4.0",
"mocha": "^2.2.5",
"mocha": "^2.3.4",
"rimraf": "^2.4.3"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion src/ReactWrapperComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default function createWrapperComponent(node, options = {}) {
// For full rendering, we are using this wrapper component to provide context if it is
// specified in both the options AND the child component defines `contextTypes` statically.
// In that case, we define both a `getChildContext()` function and a `childContextTypes` prop.
Object.assign(spec, {
objectAssign(spec, {
childContextTypes: node.type.contextTypes,
getChildContext() {
return this.state.context;
Expand Down
2 changes: 1 addition & 1 deletion src/react-compat.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const {
findAllInRenderedTree,
} = TestUtils;

export default {
export {
createShallowRenderer,
renderToStaticMarkup,
renderIntoDocument,
Expand Down

0 comments on commit c0b30bc

Please sign in to comment.