mirror of
https://github.com/ascribe/onion.git
synced 2025-02-14 21:10:27 +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 concat = require('gulp-concat');
|
||||||
var _ = require('lodash');
|
var _ = require('lodash');
|
||||||
var eslint = require('gulp-eslint');
|
var eslint = require('gulp-eslint');
|
||||||
|
var jest = require('gulp-jest');
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
bootstrapDir: './node_modules/bootstrap-sass'
|
bootstrapDir: './node_modules/bootstrap-sass'
|
||||||
@ -24,14 +25,14 @@ gulp.task('build', function() {
|
|||||||
bundle(false);
|
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);
|
bundle(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('browser-sync', function() {
|
gulp.task('browser-sync', function() {
|
||||||
browserSync({
|
browserSync({
|
||||||
server: {
|
server: {
|
||||||
baseDir: "."
|
baseDir: '.'
|
||||||
},
|
},
|
||||||
port: process.env.PORT || 3000
|
port: process.env.PORT || 3000
|
||||||
});
|
});
|
||||||
@ -44,7 +45,8 @@ gulp.task('sass', function () {
|
|||||||
includePaths: [
|
includePaths: [
|
||||||
config.bootstrapDir + '/assets/stylesheets'
|
config.bootstrapDir + '/assets/stylesheets'
|
||||||
]
|
]
|
||||||
}).on('error', sass.logError))
|
})
|
||||||
|
.on('error', sass.logError))
|
||||||
.pipe(sourcemaps.write('./maps'))
|
.pipe(sourcemaps.write('./maps'))
|
||||||
.pipe(gulp.dest('./build/css'))
|
.pipe(gulp.dest('./build/css'))
|
||||||
.pipe(browserSync.stream());;
|
.pipe(browserSync.stream());;
|
||||||
@ -84,9 +86,34 @@ gulp.task('lint:watch', function () {
|
|||||||
gulp.watch('js/**/*.js', ['lint']);
|
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) {
|
function bundle(watch) {
|
||||||
var bro;
|
var bro;
|
||||||
|
|
||||||
if (watch) {
|
if (watch) {
|
||||||
bro = watchify(browserify('./js/app.js',
|
bro = watchify(browserify('./js/app.js',
|
||||||
// Assigning debug to have sourcemaps
|
// Assigning debug to have sourcemaps
|
||||||
@ -101,11 +128,11 @@ function bundle(watch) {
|
|||||||
debug: true
|
debug: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
bro.transform(babelify.configure({
|
bro.transform(babelify.configure({
|
||||||
compact: false
|
compact: false
|
||||||
}));
|
}));
|
||||||
|
|
||||||
function rebundle(bundler, watch) {
|
function rebundle(bundler, watch) {
|
||||||
return bundler.bundle()
|
return bundler.bundle()
|
||||||
.on('error', notify.onError('Error: <%= error.message %>'))
|
.on('error', notify.onError('Error: <%= error.message %>'))
|
||||||
@ -118,6 +145,6 @@ function bundle(watch) {
|
|||||||
.pipe(gulp.dest('./build'))
|
.pipe(gulp.dest('./build'))
|
||||||
.pipe(browserSync.stream());
|
.pipe(browserSync.stream());
|
||||||
}
|
}
|
||||||
|
|
||||||
return rebundle(bro);
|
return rebundle(bro);
|
||||||
}
|
}
|
@ -63,14 +63,14 @@ let Edition = React.createClass({
|
|||||||
<CollapsibleEditionDetails
|
<CollapsibleEditionDetails
|
||||||
title="Provenance/Ownership History"
|
title="Provenance/Ownership History"
|
||||||
show={this.props.edition.ownership_history && this.props.edition.ownership_history.length > 0}>
|
show={this.props.edition.ownership_history && this.props.edition.ownership_history.length > 0}>
|
||||||
<EditionDetailHistoryIterator
|
<EditionDetailHistoryIterator
|
||||||
history={this.props.edition.ownership_history} />
|
history={this.props.edition.ownership_history} />
|
||||||
</CollapsibleEditionDetails>
|
</CollapsibleEditionDetails>
|
||||||
|
|
||||||
<CollapsibleEditionDetails
|
<CollapsibleEditionDetails
|
||||||
title="Loan History"
|
title="Loan History"
|
||||||
show={this.props.edition.loan_history && this.props.edition.loan_history.length > 0}>
|
show={this.props.edition.loan_history && this.props.edition.loan_history.length > 0}>
|
||||||
<EditionDetailHistoryIterator
|
<EditionDetailHistoryIterator
|
||||||
history={this.props.edition.loan_history} />
|
history={this.props.edition.loan_history} />
|
||||||
</CollapsibleEditionDetails>
|
</CollapsibleEditionDetails>
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ let Edition = React.createClass({
|
|||||||
|
|
||||||
<CollapsibleEditionDetails
|
<CollapsibleEditionDetails
|
||||||
title="Delete Actions">
|
title="Delete Actions">
|
||||||
<Button
|
<Button
|
||||||
bsStyle="danger"
|
bsStyle="danger"
|
||||||
onClick={this.props.deleteEdition}>
|
onClick={this.props.deleteEdition}>
|
||||||
Remove this artwork from your list
|
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,
|
"private": true,
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-eslint": "^3.1.11",
|
"babel-eslint": "^3.1.11",
|
||||||
"babel-jest": "^4.0.0",
|
"babel-jest": "^5.2.0",
|
||||||
"babelify": "^6.1.2",
|
"babelify": "^6.1.2",
|
||||||
"bootstrap-sass": "^3.3.4",
|
"bootstrap-sass": "^3.3.4",
|
||||||
"browser-sync": "^2.7.5",
|
"browser-sync": "^2.7.5",
|
||||||
@ -23,6 +23,7 @@
|
|||||||
"gulp-concat": "^2.5.2",
|
"gulp-concat": "^2.5.2",
|
||||||
"gulp-eslint": "^0.13.2",
|
"gulp-eslint": "^0.13.2",
|
||||||
"gulp-if": "^1.2.5",
|
"gulp-if": "^1.2.5",
|
||||||
|
"gulp-jest": "^0.4.0",
|
||||||
"gulp-notify": "^2.2.0",
|
"gulp-notify": "^2.2.0",
|
||||||
"gulp-sass": "^2.0.1",
|
"gulp-sass": "^2.0.1",
|
||||||
"gulp-sourcemaps": "^1.5.2",
|
"gulp-sourcemaps": "^1.5.2",
|
||||||
@ -45,8 +46,7 @@
|
|||||||
"react-datepicker": "~0.8.0",
|
"react-datepicker": "~0.8.0",
|
||||||
"react-router": "^0.13.3",
|
"react-router": "^0.13.3",
|
||||||
"shmui": "^0.1.0",
|
"shmui": "^0.1.0",
|
||||||
"uglifyjs": "^2.4.10",
|
"uglifyjs": "^2.4.10"
|
||||||
"react-datepicker": "~0.8.0"
|
|
||||||
},
|
},
|
||||||
"jest": {
|
"jest": {
|
||||||
"scriptPreprocessor": "node_modules/babel-jest",
|
"scriptPreprocessor": "node_modules/babel-jest",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user