mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
cleanup collections before starting tests
This commit is contained in:
@@ -109,7 +109,7 @@ Package.onTest(function (api) {
|
||||
api.use('ecmascript');
|
||||
api.use('npm-mongo', 'server');
|
||||
api.use(['tinytest', 'test-helpers', 'ejson', 'random',
|
||||
'ddp', 'base64']);
|
||||
'ddp', 'base64', 'typescript']);
|
||||
// XXX test order dependency: the allow_tests "partial allow" test
|
||||
// fails if it is run before mongo_livedata_tests.
|
||||
api.addFiles("mongo_livedata_tests.js", ["client", "server"]);
|
||||
|
||||
@@ -12,7 +12,7 @@ export { Tinytest };
|
||||
const handlesForRun = new Map;
|
||||
const reportsForRun = new Map;
|
||||
|
||||
Meteor.publish(ServerTestResultsSubscription, function (runId) {
|
||||
Meteor.publish(ServerTestResultsSubscription, async function (runId) {
|
||||
check(runId, String);
|
||||
|
||||
if (! handlesForRun.has(runId)) {
|
||||
@@ -36,9 +36,16 @@ Meteor.publish(ServerTestResultsSubscription, function (runId) {
|
||||
});
|
||||
|
||||
Meteor.methods({
|
||||
'tinytest/run'(runId, pathPrefix) {
|
||||
async 'tinytest/run'(runId, pathPrefix) {
|
||||
check(runId, String);
|
||||
check(pathPrefix, Match.Optional([String]));
|
||||
|
||||
const collections = await MongoInternals.defaultRemoteCollectionDriver().mongo.db.collections();
|
||||
|
||||
for (const collection of collections) {
|
||||
await collection.drop();
|
||||
}
|
||||
|
||||
this.unblock();
|
||||
|
||||
reportsForRun.set(runId, Object.create(null));
|
||||
@@ -84,4 +91,4 @@ Meteor.methods({
|
||||
handlesForRun.delete(runId);
|
||||
reportsForRun.delete(runId);
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user