Skip to content

Commit e06b131

Browse files
committed
Merge pull request #56 from aisk/gulp-test
add mocha test to gulpfile
2 parents 8efacd6 + e16749a commit e06b131

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

gulpfile.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
var gulp = require('gulp');
22
var gzip = require('gulp-gzip');
3+
var mocha = require('gulp-mocha');
34
var jsdoc = require("gulp-jsdoc");
45
var rename = require('gulp-rename');
56
var shell = require('gulp-shell');
67
var tar = require('gulp-tar');
78
var clean = require('gulp-clean');
89
var uglify = require('gulp-uglify');
10+
var order = require('gulp-order');
911

1012
getAVVersion = function() {
1113
return require('./lib/AV.js').AV.VERSION.replace('js', '');
@@ -54,6 +56,30 @@ gulp.task('compress-docs', ['docs'], function() {
5456
.pipe(gulp.dest('dist'));
5557
})
5658

59+
AV = require('./lib/av').AV;
60+
61+
gulp.task('test', function() {
62+
return gulp.src('tests/*.js', {read: false})
63+
.pipe(order([
64+
'test.js',
65+
'file.js',
66+
'error.js',
67+
'object.js',
68+
'collection.js',
69+
'user.js',
70+
'query.js',
71+
'geopoint.js',
72+
'acl.js',
73+
'master_key.js',
74+
'status.js',
75+
'sms.js',
76+
]))
77+
.pipe(mocha({
78+
timeout: 100000,
79+
globals: ['AV'],
80+
}));
81+
});
82+
5783
gulp.task('clean', function() {
5884
gulp.src(['dist/'])
5985
.pipe(clean({force: true}));

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
"gulp-clean": "^0.3.1",
1818
"gulp-gzip": "0.0.8",
1919
"gulp-jsdoc": "^0.1.4",
20+
"gulp-mocha": "^2.0.0",
21+
"gulp-order": "^1.1.1",
2022
"gulp-rename": "^1.2.0",
2123
"gulp-shell": "^0.2.11",
2224
"gulp-tar": "^1.3.2",

tests/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ AV.setProduction(true);
1010
//AV._initialize("a6jku4sqdxbgidzrxsy8u30evp8nltry2af4atncwg5br0qi","85gi8j21v7l5li9kquh3oy900macawjs4leyx8n788k7z4qy","5cy3lnf97bkznd9su76t05qi6zuzoygxbgtik4egsd9wtl2j");
1111
AV._useMasterKey = true;
1212
if(typeof require !="undefined"){
13-
require("./file.js")
13+
require("./file.js");
1414
}

0 commit comments

Comments
 (0)