Skip to content

Commit

Permalink
docs(test-runners): fix jest example to also work in ESM (#866)
Browse files Browse the repository at this point in the history
this is necessary because in ESM mongoose does not export `connection`, because in ESM exports cannot be modified after they are exported
  • Loading branch information
Darkmift committed Apr 22, 2024
1 parent f13d72f commit ea21ffc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/guides/integration-examples/test-runners.md
Expand Up @@ -57,8 +57,8 @@ export = async function globalSetup() {
}

// The following is to make sure the database is clean before an test starts
await mongoose.connect(`${process.env.MONGO_URI}/${config.Database}`);
await mongoose.connection.db.dropDatabase();
const conn = await mongoose.connect(`${process.env.MONGO_URI}/${config.Database}`);
await conn.connection.db.dropDatabase();
await mongoose.disconnect();
};

Expand Down

0 comments on commit ea21ffc

Please sign in to comment.