mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 09:23:13 +01:00
integrate jest - not working yet though
This commit is contained in:
parent
7f82d49278
commit
82bea4c241
41
gulpfile.js
41
gulpfile.js
@ -15,6 +15,7 @@ var sass = require('gulp-sass');
|
||||
var concat = require('gulp-concat');
|
||||
var _ = require('lodash');
|
||||
var eslint = require('gulp-eslint');
|
||||
var jest = require('gulp-jest');
|
||||
|
||||
var config = {
|
||||
bootstrapDir: './node_modules/bootstrap-sass'
|
||||
@ -24,14 +25,14 @@ gulp.task('build', function() {
|
||||
bundle(false);
|
||||
});
|
||||
|
||||
gulp.task('serve', ['browser-sync', 'lint:watch', 'sass', 'sass:watch', 'copy'], function() {
|
||||
gulp.task('serve', ['browser-sync', 'lint:watch', 'sass', 'sass:watch', 'copy', 'jest:watch'], function() {
|
||||
bundle(true);
|
||||
});
|
||||
|
||||
gulp.task('browser-sync', function() {
|
||||
browserSync({
|
||||
server: {
|
||||
baseDir: "."
|
||||
baseDir: '.'
|
||||
},
|
||||
port: process.env.PORT || 3000
|
||||
});
|
||||
@ -44,7 +45,8 @@ gulp.task('sass', function () {
|
||||
includePaths: [
|
||||
config.bootstrapDir + '/assets/stylesheets'
|
||||
]
|
||||
}).on('error', sass.logError))
|
||||
})
|
||||
.on('error', sass.logError))
|
||||
.pipe(sourcemaps.write('./maps'))
|
||||
.pipe(gulp.dest('./build/css'))
|
||||
.pipe(browserSync.stream());;
|
||||
@ -84,9 +86,34 @@ gulp.task('lint:watch', function () {
|
||||
gulp.watch('js/**/*.js', ['lint']);
|
||||
});
|
||||
|
||||
gulp.task('jest', function () {
|
||||
return gulp.src('__tests__').pipe(jest({
|
||||
scriptPreprocessor: "./node_modules/babel-jest",
|
||||
testDirectoryName: '__tests__',
|
||||
testPathIgnorePatterns: [
|
||||
'node_modules',
|
||||
'spec/support'
|
||||
],
|
||||
testFileExtensions: [
|
||||
'es6',
|
||||
'js'
|
||||
],
|
||||
moduleFileExtensions: [
|
||||
'js',
|
||||
'json',
|
||||
'react',
|
||||
'es6'
|
||||
]
|
||||
})
|
||||
.on('error', console.error));
|
||||
});
|
||||
|
||||
gulp.task('jest:watch', function () {
|
||||
gulp.watch('__tests__', ['jest']);
|
||||
});
|
||||
|
||||
function bundle(watch) {
|
||||
var bro;
|
||||
|
||||
if (watch) {
|
||||
bro = watchify(browserify('./js/app.js',
|
||||
// Assigning debug to have sourcemaps
|
||||
@ -101,11 +128,11 @@ function bundle(watch) {
|
||||
debug: true
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
bro.transform(babelify.configure({
|
||||
compact: false
|
||||
}));
|
||||
|
||||
|
||||
function rebundle(bundler, watch) {
|
||||
return bundler.bundle()
|
||||
.on('error', notify.onError('Error: <%= error.message %>'))
|
||||
@ -118,6 +145,6 @@ function bundle(watch) {
|
||||
.pipe(gulp.dest('./build'))
|
||||
.pipe(browserSync.stream());
|
||||
}
|
||||
|
||||
|
||||
return rebundle(bro);
|
||||
}
|
@ -63,14 +63,14 @@ let Edition = React.createClass({
|
||||
<CollapsibleEditionDetails
|
||||
title="Provenance/Ownership History"
|
||||
show={this.props.edition.ownership_history && this.props.edition.ownership_history.length > 0}>
|
||||
<EditionDetailHistoryIterator
|
||||
<EditionDetailHistoryIterator
|
||||
history={this.props.edition.ownership_history} />
|
||||
</CollapsibleEditionDetails>
|
||||
|
||||
<CollapsibleEditionDetails
|
||||
title="Loan History"
|
||||
show={this.props.edition.loan_history && this.props.edition.loan_history.length > 0}>
|
||||
<EditionDetailHistoryIterator
|
||||
<EditionDetailHistoryIterator
|
||||
history={this.props.edition.loan_history} />
|
||||
</CollapsibleEditionDetails>
|
||||
|
||||
@ -89,7 +89,7 @@ let Edition = React.createClass({
|
||||
|
||||
<CollapsibleEditionDetails
|
||||
title="Delete Actions">
|
||||
<Button
|
||||
<Button
|
||||
bsStyle="danger"
|
||||
onClick={this.props.deleteEdition}>
|
||||
Remove this artwork from your list
|
||||
|
9
js/utils/__tests__/general_utils-test.js
Normal file
9
js/utils/__tests__/general_utils-test.js
Normal file
@ -0,0 +1,9 @@
|
||||
jest.autoMockOff();
|
||||
|
||||
import * as GeneralUtils from '../general_utils';
|
||||
|
||||
describe('GeneralUtils', () => {
|
||||
it('should do something', () => {
|
||||
console.log('asdasdasd');
|
||||
});
|
||||
});
|
@ -11,7 +11,7 @@
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"babel-eslint": "^3.1.11",
|
||||
"babel-jest": "^4.0.0",
|
||||
"babel-jest": "^5.2.0",
|
||||
"babelify": "^6.1.2",
|
||||
"bootstrap-sass": "^3.3.4",
|
||||
"browser-sync": "^2.7.5",
|
||||
@ -23,6 +23,7 @@
|
||||
"gulp-concat": "^2.5.2",
|
||||
"gulp-eslint": "^0.13.2",
|
||||
"gulp-if": "^1.2.5",
|
||||
"gulp-jest": "^0.4.0",
|
||||
"gulp-notify": "^2.2.0",
|
||||
"gulp-sass": "^2.0.1",
|
||||
"gulp-sourcemaps": "^1.5.2",
|
||||
@ -45,8 +46,7 @@
|
||||
"react-datepicker": "~0.8.0",
|
||||
"react-router": "^0.13.3",
|
||||
"shmui": "^0.1.0",
|
||||
"uglifyjs": "^2.4.10",
|
||||
"react-datepicker": "~0.8.0"
|
||||
"uglifyjs": "^2.4.10"
|
||||
},
|
||||
"jest": {
|
||||
"scriptPreprocessor": "node_modules/babel-jest",
|
||||
|
Loading…
Reference in New Issue
Block a user