mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 06:37:23 +01:00
Add gulp tasks for v3 testing
This commit is contained in:
@@ -18,6 +18,7 @@ let server;
|
|||||||
const TEST_DB_URI = `mongodb://localhost/${TEST_DB}`
|
const TEST_DB_URI = `mongodb://localhost/${TEST_DB}`
|
||||||
|
|
||||||
const API_V2_TEST_COMMAND = 'mocha test/api/v2 --recursive --compilers js:babel/register';
|
const API_V2_TEST_COMMAND = 'mocha test/api/v2 --recursive --compilers js:babel/register';
|
||||||
|
const API_V3_TEST_COMMAND = 'mocha test/api/v3 --recursive --compilers js:babel/register';
|
||||||
const LEGACY_API_TEST_COMMAND = 'mocha test/api-legacy';
|
const LEGACY_API_TEST_COMMAND = 'mocha test/api-legacy';
|
||||||
const COMMON_TEST_COMMAND = 'mocha test/common --compilers coffee:coffee-script';
|
const COMMON_TEST_COMMAND = 'mocha test/common --compilers coffee:coffee-script';
|
||||||
const CONTENT_TEST_COMMAND = 'mocha test/content --compilers js:babel/register';
|
const CONTENT_TEST_COMMAND = 'mocha test/content --compilers js:babel/register';
|
||||||
@@ -296,7 +297,6 @@ gulp.task('test:e2e:safe', ['test:prepare', 'test:prepare:server'], (cb) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('test:api-v2', ['test:prepare:server'], (done) => {
|
gulp.task('test:api-v2', ['test:prepare:server'], (done) => {
|
||||||
|
|
||||||
awaitPort(TEST_SERVER_PORT).then(() => {
|
awaitPort(TEST_SERVER_PORT).then(() => {
|
||||||
runMochaTests('./test/api/v2/**/*.js', server, done)
|
runMochaTests('./test/api/v2/**/*.js', server, done)
|
||||||
});
|
});
|
||||||
@@ -313,7 +313,48 @@ gulp.task('test:api-v2:safe', ['test:prepare:server'], (done) => {
|
|||||||
testBin(API_V2_TEST_COMMAND),
|
testBin(API_V2_TEST_COMMAND),
|
||||||
(err, stdout, stderr) => {
|
(err, stdout, stderr) => {
|
||||||
testResults.push({
|
testResults.push({
|
||||||
suite: 'API Specs\t',
|
suite: 'API V2 Specs\t',
|
||||||
|
pass: testCount(stdout, /(\d+) passing/),
|
||||||
|
fail: testCount(stderr, /(\d+) failing/),
|
||||||
|
pend: testCount(stdout, /(\d+) pending/)
|
||||||
|
});
|
||||||
|
done();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
pipe(runner);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('test:api-v3', ['test:api-v3:unit', 'test:api-v3:integration']);
|
||||||
|
|
||||||
|
gulp.task('test:api-v3:watch', ['test:api-v3:unit:watch', 'test:api-v3:integration:watch']);
|
||||||
|
|
||||||
|
gulp.task('test:api-v3:unit', ['test:prepare:server'], (done) => {
|
||||||
|
runMochaTests('./test/api/v3/unit/**/*.js', null, done)
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('test:api-v3:unit:watch', ['test:prepare:server'], () => {
|
||||||
|
gulp.watch(['website/src/**', 'test/api/v3/unit/**'], ['test:api-v3:unit']);
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('test:api-v3:integration', ['test:prepare:server'], (done) => {
|
||||||
|
awaitPort(TEST_SERVER_PORT).then(() => {
|
||||||
|
runMochaTests('./test/api/v3/unit/**/*.js', server, done)
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('test:api-v3:integration:watch', ['test:prepare:server'], () => {
|
||||||
|
process.env.RUN_INTEGRATION_TEST_FOREVER = true;
|
||||||
|
gulp.watch(['website/src/**', 'test/api/v3/integration/**'], ['test:api-v3:integration']);
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('test:api-v3:safe', ['test:prepare:server'], (done) => {
|
||||||
|
awaitPort(TEST_SERVER_PORT).then(() => {
|
||||||
|
let runner = exec(
|
||||||
|
testBin(API_V3_TEST_COMMAND),
|
||||||
|
(err, stdout, stderr) => {
|
||||||
|
testResults.push({
|
||||||
|
suite: 'API V3 Specs\t',
|
||||||
pass: testCount(stdout, /(\d+) passing/),
|
pass: testCount(stdout, /(\d+) passing/),
|
||||||
fail: testCount(stderr, /(\d+) failing/),
|
fail: testCount(stderr, /(\d+) failing/),
|
||||||
pend: testCount(stdout, /(\d+) pending/)
|
pend: testCount(stdout, /(\d+) pending/)
|
||||||
@@ -326,6 +367,7 @@ gulp.task('test:api-v2:safe', ['test:prepare:server'], (done) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('test', [
|
gulp.task('test', [
|
||||||
|
'lint',
|
||||||
'test:e2e:safe',
|
'test:e2e:safe',
|
||||||
'test:common:safe',
|
'test:common:safe',
|
||||||
// 'test:content:safe',
|
// 'test:content:safe',
|
||||||
@@ -333,7 +375,7 @@ gulp.task('test', [
|
|||||||
'test:karma:safe',
|
'test:karma:safe',
|
||||||
'test:api-legacy:safe',
|
'test:api-legacy:safe',
|
||||||
'test:api-v2:safe',
|
'test:api-v2:safe',
|
||||||
'lint'
|
'test:api-v3:safe',
|
||||||
], () => {
|
], () => {
|
||||||
let totals = [0,0,0];
|
let totals = [0,0,0];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user