Even faster tests (#4868)
* Various improvements in test name / de-duplications * Reverts to class by class deletion, introduced fast mode that just delete data for mongo - Speeds up are incredible Executed 1695 of 1713 specs INCOMPLETE (18 PENDING) in 4 mins 19 secs. * Adds documentation about the deleteEverything
This commit is contained in:
@@ -1,14 +1,17 @@
|
||||
import AppCache from './cache';
|
||||
|
||||
//Used by tests
|
||||
export function destroyAllDataPermanently() {
|
||||
/**
|
||||
* Destroys all data in the database
|
||||
* @param {boolean} fast set to true if it's ok to just drop objects and not indexes.
|
||||
*/
|
||||
export function destroyAllDataPermanently(fast) {
|
||||
if (!process.env.TESTING) {
|
||||
throw 'Only supported in test environment';
|
||||
}
|
||||
return Promise.all(Object.keys(AppCache.cache).map(appId => {
|
||||
const app = AppCache.get(appId);
|
||||
if (app.databaseController) {
|
||||
return app.databaseController.deleteEverything();
|
||||
return app.databaseController.deleteEverything(fast);
|
||||
} else {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user