Set up content tests

This commit is contained in:
Blade Barringer
2015-09-29 07:55:13 -05:00
parent 2db4b7b7b2
commit 1b9c7c51c2
5 changed files with 83 additions and 1 deletions

View File

@@ -11,8 +11,9 @@ const TEST_DB = 'habitrpg_test'
const TEST_DB_URI = `mongodb://localhost/${TEST_DB}`
const API_TEST_COMMAND = 'mocha test/api';
const API_TEST_COMMAND = 'mocha test/api --opts test/mocha.opts';
const COMMON_TEST_COMMAND = 'mocha test/common';
const CONTENT_TEST_COMMAND = 'mocha test/content --opts test/content/mocha.content.opts';
const KARMA_TEST_COMMAND = 'karma start';
const SERVER_SIDE_TEST_COMMAND = 'mocha test/server_side';
@@ -85,6 +86,40 @@ gulp.task('test:common:safe', ['test:prepare:build'], (cb) => {
pipe(runner);
});
gulp.task('test:content', ['test:prepare:build'], (cb) => {
let runner = exec(
testBin(CONTENT_TEST_COMMAND),
(err, stdout, stderr) => {
cb(err);
}
);
pipe(runner);
});
gulp.task('test:content:clean', (cb) => {
pipe(exec(testBin(CONTENT_TEST_COMMAND), () => cb()));
});
gulp.task('test:content:watch', ['test:content:clean'], () => {
gulp.watch(['common/script/src/content/**', 'test/**'], ['test:content:clean']);
});
gulp.task('test:content:safe', ['test:prepare:build'], (cb) => {
let runner = exec(
testBin(CONTENT_TEST_COMMAND),
(err, stdout, stderr) => {
testResults.push({
suite: 'Content Specs\t',
pass: testCount(stdout, /(\d+) passing/),
fail: testCount(stderr, /(\d+) failing/),
pend: testCount(stdout, /(\d+) pending/)
});
cb();
}
);
pipe(runner);
});
gulp.task('test:server_side', ['test:prepare:build'], (cb) => {
let runner = exec(
testBin(SERVER_SIDE_TEST_COMMAND),
@@ -243,6 +278,7 @@ gulp.task('test:e2e:safe', ['test:prepare'], (cb) => {
gulp.task('test', [
'test:common:safe',
'test:content:safe',
'test:server_side:safe',
'test:karma:safe',
'test:api:safe',