Permalink
Browse files

add testing skeleton

  • Loading branch information...
Ian McNally
Ian McNally committed Feb 24, 2015
1 parent 9fdc1fc commit 3813d28f8c0767db3bb4d671529e1a4811911f35
Showing with 43 additions and 7 deletions.
  1. +17 −1 Gulpfile.js
  2. +5 −1 README.md
  3. +9 −5 package.json
  4. +12 −0 src/components/__tests__/fare_input-test.js
  5. 0 src/test/preprocessor.js
View
@@ -1,9 +1,12 @@
require('harmonize')();
var gulp = require('gulp');
var browserify = require('browserify');
var connect = require('gulp-connect');
var babelify = require('babelify');
var rename = require('gulp-rename');
var source = require('vinyl-source-stream');
var jest = require('gulp-jest');
gulp.task('compile', ['index.html'], function(){
browserify('./src/app.jsx')
@@ -26,9 +29,22 @@ gulp.task('index.html', function(){
.pipe(gulp.dest('dist'))
})
gulp.task('jest', function(){
gulp.src('src/**/*-test.js')
.pipe(jest({
rootDir : 'src',
scriptPreprocessor : "../node_modules/babel-jest",
testFileExtensions : ["es6", "js"],
moduleFileExtensions : ["js", "json", "es6"],
unmockedModulePathPatterns : ["./node_modules/react"]
}));
});
gulp.task('watch', function(){
gulp.watch(['src/**/*.js*'], ['compile']);
gulp.watch(['src/**/*.html*'], ['index.html']);
});
gulp.task('default', ['compile', 'connect', 'watch']);
gulp.task('default', ['compile', 'connect', 'watch']);
gulp.task('test', ['jest']);
View
@@ -10,4 +10,8 @@ Note: Having `node` installed is a prerequisite.
## Dev
1. `gulp` - Compile, start server, watch for file changes
1. `gulp` - Compile, start server, watch for file changes
## Test
2. `gulp test` - Run test suite
View
@@ -7,21 +7,25 @@
"scripts": {
"test": "gulp test"
},
"author": "",
"author": "Ian McNally <ianmcnally@gmail.com>",
"license": "ISC",
"dependencies": {
"flux": "^2.0.1"
},
"devDependencies": {
"babel-jest": "^4.0.0",
"babelify": "^5.0.3",
"bl": "^0.9.4",
"browserify": "^8.1.3",
"flux": "^2.0.1",
"gulp": "^3.8.11",
"gulp-connect": "^2.2.0",
"gulp-jest": "^0.4.0",
"gulp-rename": "^1.2.0",
"harmonize": "^1.4.1",
"react": "^0.12.2",
"react-tools": "^0.12.2",
"through2": "^0.6.3",
"vinyl": "^0.4.6",
"vinyl-source-stream": "^1.0.0"
},
"devDependencies": {
"babelify": "^5.0.3"
}
}
@@ -0,0 +1,12 @@
import {addons} from 'react/addons';
var TestUtils = addons.TestUtils;
jest.dontMock('../fare_input.jsx');
describe('FareInput', () => {
it('runs', () => {
expect(2).toEqual(2);
});
});
View
No changes.

0 comments on commit 3813d28

Please sign in to comment.