Skip to content

Commit 42d9bb8

Browse files
author
Evan Jacobs
committed
Update dependencies, jest 13.x -> 15.x, react 15.x -> 15.3+, eslint 3
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.
1 parent b99e9d3 commit 42d9bb8

File tree

7 files changed

+26
-24
lines changed

7 files changed

+26
-24
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ __A React webapp scaffolding tool with best practice enforcement, automated test
1212
Scaffolding for automation of basic tooling and tasks typically required by React projects, including:
1313

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

6262
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.
6363

64-
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.
64+
Jest supports a broad spectrum of matchers and test-writing styles, so check out their documentation to customize things to your liking!
6565

6666
[back to top](#generator-enigma)
6767

generators/app/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ module.exports = yeoman.Base.extend({
7474
message: formatPrompt(chalk.bold.white('Would you like routing to be set up? (via react-router)')),
7575
}];
7676

77-
this.prompt(prompts, function(answers) {
77+
this.prompt(prompts).then(function(answers) {
7878
this.answers = answers;
7979
this.answers.appName = _.kebabCase(this.answers.appName);
8080

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

9292
mkdirp('public/assets');
9393
mkdirp('scripts');
94-
mkdirp('src/example/__tests__');
94+
mkdirp('src/example');
9595
mkdirp('src/static/assets/images');
9696

9797
copier([
@@ -102,8 +102,8 @@ module.exports = yeoman.Base.extend({
102102
'scripts/budo.js',
103103
'scripts/parallelize.sh',
104104
'src/example/index.js',
105+
'src/example/index.spec.js',
105106
'src/example/style.styl',
106-
'src/example/__tests__/index.js',
107107
'src/style.styl',
108108
]);
109109

generators/app/templates/_eslintrc

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@
77

88
"env": {
99
"browser": true,
10-
"node": true
10+
"node": true,
11+
"jasmine": true
1112
},
1213

1314
"globals": {
14-
"expect": true
15+
"expect": true,
16+
"jest": true
1517
},
1618

1719
"parserOptions": {
18-
"ecmaVersion": 6,
20+
"ecmaVersion": 7,
1921
"ecmaFeatures": {
2022
"jsx": true
2123
},
@@ -139,12 +141,12 @@
139141
"react/jsx-sort-prop-types": 0,
140142
"react/jsx-uses-react": 2,
141143
"react/jsx-uses-vars": 2,
144+
"react/jsx-wrap-multilines": 2,
142145
"react/no-did-mount-set-state": 0,
143146
"react/no-did-update-set-state": 2,
144-
"react/no-multi-comp": 2,
147+
"react/no-multi-comp": 0,
145148
"react/no-unknown-property": 2,
146149
"react/prop-types": 1,
147-
"react/self-closing-comp": 2,
148-
"react/wrap-multilines": 2
150+
"react/self-closing-comp": 2
149151
}
150152
}

generators/app/templates/package.json

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,24 @@
99
"email": "<%= authorEmail %>"
1010
},
1111
"dependencies": {
12-
"react": "^15.0.0",
12+
"react": "^15.3.0",
1313
<% if (include_routing) { %>"react-router": "^2.0.0",<% } %>
14-
"react-dom": "^15.0.0"
14+
"react-dom": "^15.3.0"
1515
},
1616
"devDependencies": {
1717
"autoprefixer-stylus": "^0.9.2",
1818
"babel-eslint": "^6.0.0",
19-
"babel-jest": "^12.0.2",
19+
"babel-jest": "^15.0.0",
2020
"babel-plugin-transform-class-properties": "^6.6.0",
2121
"babel-preset-es2015": "^6.6.0",
2222
"babel-preset-react": "^6.5.0",
2323
"babel-preset-stage-2": "^6.5.0",
2424
"babelify": "^7.2.0",
2525
"browserify": "^13.0.0",
2626
"budo": "^8.1.0",
27-
"eslint": "^2.7.0",
28-
"eslint-plugin-react": "^4.2.3",
29-
"jest-cli": "^12.0.2",
27+
"eslint": "^3.0.0",
28+
"eslint-plugin-react": "^6.0.0",
29+
"jest-cli": "^15.1.0",
3030
"mkdirp": "latest",
3131
"stylus": "^0.54.2",
3232
"uglify-js": "^2.6.2",
@@ -47,9 +47,6 @@
4747
"babelify"
4848
]
4949
},
50-
"jest": {
51-
"automock": false
52-
},
5350
"scripts": {
5451
"postinstall": "mkdirp public/assets",
5552
"js": "browserify src/index.js --debug > public/assets/bundle.js",

generators/app/templates/scripts/budo.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ require('budo')('src/index.js', {
1313
stream: process.stdout,
1414

1515
watchGlob: [
16-
'{public,src}/**/*.{html,css,json}'
17-
]
16+
'{public,src}/**/*.{html,css,json}',
17+
],
1818
});

generators/app/templates/src/example/__tests__/index.js renamed to generators/app/templates/src/example/index.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import React from 'react';
44
import {render, unmountComponentAtNode as cleanup} from 'react-dom';
5-
import Example from '../index';
5+
import Example from './index';
66

77
describe('Example', () => {
88
const testingRootNode = document.body.appendChild(document.createElement('div'));

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,15 @@
1616
"stylus"
1717
],
1818
"dependencies": {
19-
"yeoman-generator": "^0.22.0",
19+
"yeoman-generator": "^0.24.0",
2020
"chalk": "^1.0.0",
2121
"yosay": "^1.0.2",
2222
"lodash": "^4.0.0",
2323
"mkdirp": "^0.5.1"
2424
},
25+
"peerDependencies": {
26+
"yo": ">= 1.8"
27+
},
2528
"engines": {
2629
"node": ">= 4"
2730
},

0 commit comments

Comments
 (0)