Skip to content

Commit

Permalink
Update dependencies, jest 13.x -> 15.x, react 15.x -> 15.3+, eslint 3
Browse files Browse the repository at this point in the history
The other biggish change is the test file syntax has now been switched
to promote *.spec.js instead of __tests__/index.js. This keeps tests
closer to what they're targeting and has, in practice, helped to
make things more obvious for our developers.
  • Loading branch information
Evan Jacobs committed Sep 13, 2016
1 parent b99e9d3 commit 42d9bb8
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 24 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ __A React webapp scaffolding tool with best practice enforcement, automated test
Scaffolding for automation of basic tooling and tasks typically required by React projects, including:

- CommonJS module bundling via [Browserify](http://browserify.org/)
- ES2015 syntax support and transpilation via [Babel](https://babeljs.io/)
- ES2015+ (ES6+) syntax support and transpilation via [Babel](https://babeljs.io/)
- Code quality assessment & style enforcement via [ESLint](http://eslint.org/)
- [Stylus](http://stylus-lang.com/) CSS preprocessing & automatic vendor prefix management via [Autoprefixer](https://github.com/postcss/autoprefixer#autoprefixer-)
- Unit testing via the [Jest](https://facebook.github.io/jest/) framework and [Jasmine2](http://jasmine.github.io/2.0/introduction.html) test runner
Expand Down Expand Up @@ -61,7 +61,7 @@ Once you've set up your app, check out the targets available in `package.json`.

The [Jasmine 2](http://jasmine.github.io/2.0/introduction.html) test runner is included by default, as a part of the [Jest](https://facebook.github.io/jest/) unit testing framework.

Jest's [automocking functionality](https://facebook.github.io/jest/docs/automatic-mocking.html) is disabled via the `"jest": {"automock": false}` `package.json` field. We've found this dramatically reduces the complexity of writing tests, but you can choose to enable it if desired.
Jest supports a broad spectrum of matchers and test-writing styles, so check out their documentation to customize things to your liking!

[back to top](#generator-enigma)

Expand Down
6 changes: 3 additions & 3 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ module.exports = yeoman.Base.extend({
message: formatPrompt(chalk.bold.white('Would you like routing to be set up? (via react-router)')),
}];

this.prompt(prompts, function(answers) {
this.prompt(prompts).then(function(answers) {
this.answers = answers;
this.answers.appName = _.kebabCase(this.answers.appName);

Expand All @@ -91,7 +91,7 @@ module.exports = yeoman.Base.extend({

mkdirp('public/assets');
mkdirp('scripts');
mkdirp('src/example/__tests__');
mkdirp('src/example');
mkdirp('src/static/assets/images');

copier([
Expand All @@ -102,8 +102,8 @@ module.exports = yeoman.Base.extend({
'scripts/budo.js',
'scripts/parallelize.sh',
'src/example/index.js',
'src/example/index.spec.js',
'src/example/style.styl',
'src/example/__tests__/index.js',
'src/style.styl',
]);

Expand Down
14 changes: 8 additions & 6 deletions generators/app/templates/_eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@

"env": {
"browser": true,
"node": true
"node": true,
"jasmine": true
},

"globals": {
"expect": true
"expect": true,
"jest": true
},

"parserOptions": {
"ecmaVersion": 6,
"ecmaVersion": 7,
"ecmaFeatures": {
"jsx": true
},
Expand Down Expand Up @@ -139,12 +141,12 @@
"react/jsx-sort-prop-types": 0,
"react/jsx-uses-react": 2,
"react/jsx-uses-vars": 2,
"react/jsx-wrap-multilines": 2,
"react/no-did-mount-set-state": 0,
"react/no-did-update-set-state": 2,
"react/no-multi-comp": 2,
"react/no-multi-comp": 0,
"react/no-unknown-property": 2,
"react/prop-types": 1,
"react/self-closing-comp": 2,
"react/wrap-multilines": 2
"react/self-closing-comp": 2
}
}
15 changes: 6 additions & 9 deletions generators/app/templates/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,24 @@
"email": "<%= authorEmail %>"
},
"dependencies": {
"react": "^15.0.0",
"react": "^15.3.0",
<% if (include_routing) { %>"react-router": "^2.0.0",<% } %>
"react-dom": "^15.0.0"
"react-dom": "^15.3.0"
},
"devDependencies": {
"autoprefixer-stylus": "^0.9.2",
"babel-eslint": "^6.0.0",
"babel-jest": "^12.0.2",
"babel-jest": "^15.0.0",
"babel-plugin-transform-class-properties": "^6.6.0",
"babel-preset-es2015": "^6.6.0",
"babel-preset-react": "^6.5.0",
"babel-preset-stage-2": "^6.5.0",
"babelify": "^7.2.0",
"browserify": "^13.0.0",
"budo": "^8.1.0",
"eslint": "^2.7.0",
"eslint-plugin-react": "^4.2.3",
"jest-cli": "^12.0.2",
"eslint": "^3.0.0",
"eslint-plugin-react": "^6.0.0",
"jest-cli": "^15.1.0",
"mkdirp": "latest",
"stylus": "^0.54.2",
"uglify-js": "^2.6.2",
Expand All @@ -47,9 +47,6 @@
"babelify"
]
},
"jest": {
"automock": false
},
"scripts": {
"postinstall": "mkdirp public/assets",
"js": "browserify src/index.js --debug > public/assets/bundle.js",
Expand Down
4 changes: 2 additions & 2 deletions generators/app/templates/scripts/budo.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ require('budo')('src/index.js', {
stream: process.stdout,

watchGlob: [
'{public,src}/**/*.{html,css,json}'
]
'{public,src}/**/*.{html,css,json}',
],
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import React from 'react';
import {render, unmountComponentAtNode as cleanup} from 'react-dom';
import Example from '../index';
import Example from './index';

describe('Example', () => {
const testingRootNode = document.body.appendChild(document.createElement('div'));
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@
"stylus"
],
"dependencies": {
"yeoman-generator": "^0.22.0",
"yeoman-generator": "^0.24.0",
"chalk": "^1.0.0",
"yosay": "^1.0.2",
"lodash": "^4.0.0",
"mkdirp": "^0.5.1"
},
"peerDependencies": {
"yo": ">= 1.8"
},
"engines": {
"node": ">= 4"
},
Expand Down

0 comments on commit 42d9bb8

Please sign in to comment.