mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
Merge branch 'develop' into api-v3
This commit is contained in:
14
package.json
14
package.json
@@ -94,6 +94,20 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "gulp test",
|
"test": "gulp test",
|
||||||
|
"test:api-v2:unit": "mocha test/server_side",
|
||||||
|
"test:api-v2:integration": "mocha test/api/v2 --recursive",
|
||||||
|
"test:api-v3": "mocha test/api/v3 --recursive",
|
||||||
|
"test:api-v3:unit": "mocha test/api/v3/unit --recursive",
|
||||||
|
"test:api-v3:integration": "mocha test/api/v3/integration --recursive",
|
||||||
|
"test:api-legacy": "istanbul cover -i \"website/src/**\" --dir coverage/api mocha test/api-legacy",
|
||||||
|
"test:common": "mocha test/common",
|
||||||
|
"test:content": "mocha test/content",
|
||||||
|
"test:karma": "karma start --single-run",
|
||||||
|
"test:karma:watch": "karma start",
|
||||||
|
"test:prepare:webdriver": "webdriver-manager update",
|
||||||
|
"test:e2e:webdriver": "webdriver-manager start",
|
||||||
|
"test:e2e": "DISPLAY=:99 NODE_ENV=testing protractor protractor.conf.js",
|
||||||
|
"test:nodemon": "gulp test:nodemon",
|
||||||
"start": "gulp run:dev",
|
"start": "gulp run:dev",
|
||||||
"sprites": "gulp sprites:compile",
|
"sprites": "gulp sprites:compile",
|
||||||
"postinstall": "bower --config.interactive=false install -f; gulp build;",
|
"postinstall": "bower --config.interactive=false install -f; gulp build;",
|
||||||
|
|||||||
@@ -18,16 +18,15 @@ 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';
|
const API_V2_TEST_COMMAND = 'npm run test:api-v2:integration';
|
||||||
const API_V3_TEST_COMMAND = 'mocha test/api/v3 --recursive';
|
const API_V3_TEST_COMMAND = 'npm run test:api-v3';
|
||||||
const LEGACY_API_TEST_COMMAND = 'mocha test/api-legacy';
|
const LEGACY_API_TEST_COMMAND = 'npm run test:api-legacy';
|
||||||
const COMMON_TEST_COMMAND = 'mocha test/common';
|
const COMMON_TEST_COMMAND = 'npm run test:common';
|
||||||
const CONTENT_TEST_COMMAND = 'mocha test/content';
|
const CONTENT_TEST_COMMAND = 'npm run test:content';
|
||||||
const CONTENT_OPTIONS = {maxBuffer: 1024 * 500};
|
const CONTENT_OPTIONS = {maxBuffer: 1024 * 500};
|
||||||
const KARMA_TEST_COMMAND = 'karma start';
|
const KARMA_TEST_COMMAND = 'npm run test:karma';
|
||||||
const SERVER_SIDE_TEST_COMMAND = 'mocha test/server_side';
|
const SERVER_SIDE_TEST_COMMAND = 'npm run test:api-v2:unit';
|
||||||
|
const ISTANBUL_TEST_COMMAND = 'npm run test:api-legacy';
|
||||||
const ISTANBUL_TEST_COMMAND = `istanbul cover -i "website/src/**" --dir coverage/api ./node_modules/.bin/${LEGACY_API_TEST_COMMAND}`;
|
|
||||||
|
|
||||||
/* Helper methods for reporting test summary */
|
/* Helper methods for reporting test summary */
|
||||||
let testResults = [];
|
let testResults = [];
|
||||||
@@ -37,7 +36,7 @@ let testCount = (stdout, regexp) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let testBin = (string, additionalEnvVariables = '') => {
|
let testBin = (string, additionalEnvVariables = '') => {
|
||||||
return `NODE_ENV=testing ${additionalEnvVariables} ./node_modules/.bin/${string}`;
|
return `NODE_ENV=testing ${additionalEnvVariables} ${string}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
gulp.task('test:nodemon', (done) => {
|
gulp.task('test:nodemon', (done) => {
|
||||||
@@ -70,7 +69,7 @@ gulp.task('test:prepare:build', (cb) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('test:prepare:webdriver', (cb) => {
|
gulp.task('test:prepare:webdriver', (cb) => {
|
||||||
exec('./node_modules/protractor/bin/webdriver-manager update', cb);
|
exec('npm run test:prepare:webdriver', cb);
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('test:prepare', [
|
gulp.task('test:prepare', [
|
||||||
@@ -214,7 +213,7 @@ gulp.task('test:api-legacy:watch', [
|
|||||||
|
|
||||||
gulp.task('test:karma', ['test:prepare:build'], (cb) => {
|
gulp.task('test:karma', ['test:prepare:build'], (cb) => {
|
||||||
let runner = exec(
|
let runner = exec(
|
||||||
testBin(`${KARMA_TEST_COMMAND} --single-run`),
|
testBin(KARMA_TEST_COMMAND),
|
||||||
(err, stdout) => {
|
(err, stdout) => {
|
||||||
cb(err);
|
cb(err);
|
||||||
}
|
}
|
||||||
@@ -224,7 +223,7 @@ gulp.task('test:karma', ['test:prepare:build'], (cb) => {
|
|||||||
|
|
||||||
gulp.task('test:karma:watch', ['test:prepare:build'], (cb) => {
|
gulp.task('test:karma:watch', ['test:prepare:build'], (cb) => {
|
||||||
let runner = exec(
|
let runner = exec(
|
||||||
testBin(KARMA_TEST_COMMAND),
|
testBin(`${KARMA_TEST_COMMAND}:watch`),
|
||||||
(err, stdout) => {
|
(err, stdout) => {
|
||||||
cb(err);
|
cb(err);
|
||||||
}
|
}
|
||||||
@@ -234,7 +233,7 @@ gulp.task('test:karma:watch', ['test:prepare:build'], (cb) => {
|
|||||||
|
|
||||||
gulp.task('test:karma:safe', ['test:prepare:build'], (cb) => {
|
gulp.task('test:karma:safe', ['test:prepare:build'], (cb) => {
|
||||||
let runner = exec(
|
let runner = exec(
|
||||||
testBin(`${KARMA_TEST_COMMAND} --single-run`),
|
testBin(KARMA_TEST_COMMAND),
|
||||||
(err, stdout) => {
|
(err, stdout) => {
|
||||||
testResults.push({
|
testResults.push({
|
||||||
suite: 'Karma Specs\t',
|
suite: 'Karma Specs\t',
|
||||||
@@ -251,7 +250,7 @@ gulp.task('test:karma:safe', ['test:prepare:build'], (cb) => {
|
|||||||
gulp.task('test:e2e', ['test:prepare', 'test:prepare:server'], (cb) => {
|
gulp.task('test:e2e', ['test:prepare', 'test:prepare:server'], (cb) => {
|
||||||
let support = [
|
let support = [
|
||||||
'Xvfb :99 -screen 0 1024x768x24 -extension RANDR',
|
'Xvfb :99 -screen 0 1024x768x24 -extension RANDR',
|
||||||
'./node_modules/protractor/bin/webdriver-manager start',
|
'npm run test:e2e:webdriver',
|
||||||
].map(exec);
|
].map(exec);
|
||||||
support.push(server);
|
support.push(server);
|
||||||
|
|
||||||
@@ -260,7 +259,7 @@ gulp.task('test:e2e', ['test:prepare', 'test:prepare:server'], (cb) => {
|
|||||||
awaitPort(4444)
|
awaitPort(4444)
|
||||||
]).then(() => {
|
]).then(() => {
|
||||||
let runner = exec(
|
let runner = exec(
|
||||||
'DISPLAY=:99 NODE_ENV=testing ./node_modules/protractor/bin/protractor protractor.conf.js',
|
'npm run test:e2e',
|
||||||
(err, stdout, stderr) => {
|
(err, stdout, stderr) => {
|
||||||
/*
|
/*
|
||||||
* Note: As it stands, protractor wont report pending specs
|
* Note: As it stands, protractor wont report pending specs
|
||||||
@@ -276,7 +275,7 @@ gulp.task('test:e2e', ['test:prepare', 'test:prepare:server'], (cb) => {
|
|||||||
gulp.task('test:e2e:safe', ['test:prepare', 'test:prepare:server'], (cb) => {
|
gulp.task('test:e2e:safe', ['test:prepare', 'test:prepare:server'], (cb) => {
|
||||||
let support = [
|
let support = [
|
||||||
'Xvfb :99 -screen 0 1024x768x24 -extension RANDR',
|
'Xvfb :99 -screen 0 1024x768x24 -extension RANDR',
|
||||||
'./node_modules/protractor/bin/webdriver-manager start',
|
'npm run test:e2e:webdriver',
|
||||||
].map(exec);
|
].map(exec);
|
||||||
|
|
||||||
Q.all([
|
Q.all([
|
||||||
@@ -284,7 +283,7 @@ gulp.task('test:e2e:safe', ['test:prepare', 'test:prepare:server'], (cb) => {
|
|||||||
awaitPort(4444)
|
awaitPort(4444)
|
||||||
]).then(() => {
|
]).then(() => {
|
||||||
let runner = exec(
|
let runner = exec(
|
||||||
'DISPLAY=:99 NODE_ENV=testing ./node_modules/protractor/bin/protractor protractor.conf.js',
|
'npm run test:e2e',
|
||||||
(err, stdout, stderr) => {
|
(err, stdout, stderr) => {
|
||||||
/*
|
/*
|
||||||
* Note: As it stands, protractor wont report pending specs
|
* Note: As it stands, protractor wont report pending specs
|
||||||
|
|||||||
Reference in New Issue
Block a user