mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
gulp test
This commit is contained in:
parent
f9eaf8db3b
commit
a8dcb52ac5
49
gulpfile.js
49
gulpfile.js
|
@ -2,6 +2,8 @@ const gulp = require('gulp')
|
|||
const babel = require('gulp-babel')
|
||||
const cache = require('gulp-cached')
|
||||
const notify_ = require('gulp-notify')
|
||||
const ava = require('gulp-ava')
|
||||
const sequence = require('run-sequence')
|
||||
const webpack = require('webpack-stream')
|
||||
const del = require('del')
|
||||
|
||||
|
@ -19,7 +21,8 @@ gulp.task('compile', [
|
|||
'compile-bin',
|
||||
'compile-lib',
|
||||
'compile-server',
|
||||
'compile-client'
|
||||
'compile-client',
|
||||
'compile-test'
|
||||
])
|
||||
|
||||
gulp.task('compile-bin', () => {
|
||||
|
@ -54,6 +57,19 @@ gulp.task('compile-client', () => {
|
|||
.pipe(notify('Compiled client files'))
|
||||
})
|
||||
|
||||
gulp.task('compile-test', () => {
|
||||
return gulp.src('test/*.js')
|
||||
.pipe(cache('test'))
|
||||
.pipe(babel(babelOptions))
|
||||
.pipe(gulp.dest('dist/test'))
|
||||
.pipe(notify('Compiled test files'))
|
||||
})
|
||||
|
||||
gulp.task('copy-test-fixtures', () => {
|
||||
return gulp.src('test/fixtures/**/*')
|
||||
.pipe(gulp.dest('dist/test/fixtures'))
|
||||
});
|
||||
|
||||
gulp.task('build', [
|
||||
'build-dev-client',
|
||||
])
|
||||
|
@ -92,6 +108,11 @@ gulp.task('build-release-client', ['compile-lib', 'compile-client'], () => {
|
|||
.pipe(notify('Built release client'))
|
||||
})
|
||||
|
||||
gulp.task('test', ['compile', 'copy-test-fixtures'], () => {
|
||||
return gulp.src('dist/test/*.js')
|
||||
.pipe(ava())
|
||||
})
|
||||
|
||||
gulp.task('watch', [
|
||||
'watch-bin',
|
||||
'watch-lib',
|
||||
|
@ -99,26 +120,26 @@ gulp.task('watch', [
|
|||
'watch-client'
|
||||
])
|
||||
|
||||
gulp.task('watch-bin', function () {
|
||||
gulp.task('watch-bin', () => {
|
||||
return gulp.watch('bin/*', [
|
||||
'compile-bin'
|
||||
])
|
||||
})
|
||||
|
||||
gulp.task('watch-lib', function () {
|
||||
gulp.task('watch-lib', () => {
|
||||
return gulp.watch('lib/**/*.js', [
|
||||
'compile-lib',
|
||||
'build-dev-client'
|
||||
])
|
||||
})
|
||||
|
||||
gulp.task('watch-server', function () {
|
||||
gulp.task('watch-server', () => {
|
||||
return gulp.watch('server/**/*.js', [
|
||||
'compile-server'
|
||||
])
|
||||
})
|
||||
|
||||
gulp.task('watch-client', function () {
|
||||
gulp.task('watch-client', () => {
|
||||
return gulp.watch('client/**/*.js', [
|
||||
'compile-client',
|
||||
'build-dev-client'
|
||||
|
@ -126,19 +147,27 @@ gulp.task('watch-client', function () {
|
|||
})
|
||||
|
||||
gulp.task('clean', () => {
|
||||
return del(['dist'])
|
||||
return del('dist')
|
||||
})
|
||||
|
||||
gulp.task('clean-test', () => {
|
||||
return del('dist/test')
|
||||
})
|
||||
|
||||
gulp.task('default', [
|
||||
'compile',
|
||||
'build',
|
||||
'test',
|
||||
'watch'
|
||||
])
|
||||
|
||||
gulp.task('release', [
|
||||
'compile',
|
||||
'build-release'
|
||||
])
|
||||
gulp.task('release', (cb) => {
|
||||
sequence('clean', [
|
||||
'compile',
|
||||
'build-release',
|
||||
'test'
|
||||
], 'clean-test', cb)
|
||||
})
|
||||
|
||||
// avoid logging to the console
|
||||
// that we created a notification
|
||||
|
|
19
package.json
19
package.json
|
@ -3,6 +3,7 @@
|
|||
"version": "0.0.0",
|
||||
"description": "",
|
||||
"main": "./dist/lib/index.js",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
|
@ -36,18 +37,32 @@
|
|||
"react": "15.3.2",
|
||||
"react-dom": "15.3.2",
|
||||
"resolve": "1.1.7",
|
||||
"run-sequence": "1.2.2",
|
||||
"send": "0.14.1",
|
||||
"url": "0.11.0",
|
||||
"webpack": "1.13.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "0.16.0",
|
||||
"del": "2.2.2",
|
||||
"gulp": "3.9.1",
|
||||
"gulp-ava": "0.14.1",
|
||||
"gulp-babel": "6.1.2",
|
||||
"gulp-cached": "1.1.0",
|
||||
"gulp-notify": "2.2.0",
|
||||
"webpack-stream": "3.2.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
"ava": {
|
||||
"babel": {
|
||||
"presets": [
|
||||
"es2015",
|
||||
"react"
|
||||
],
|
||||
"plugins": [
|
||||
"transform-async-to-generator",
|
||||
"transform-object-rest-spread",
|
||||
"transform-class-properties",
|
||||
"transform-runtime"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue