mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-14 05:07:22 +01:00
MongoDB Transactions (#12335)
* add run-rs to dependencies
* wip: add replica set to api unit github action
* wip: add replica set to api unit github action
* wip: fix gh actions mongodb replica set setting
* usa replica set for integration tests
* add correct mongodb version matrix for integration tests
* use different db connection on gh actions
* Revert "use different db connection on gh actions"
This reverts commit aa8db759d3.
* add example transaction
* add mongo script to package.json
* abstract mongodb utils, connect using hostname on windows
* npm scripts: mongo -> mongo:dev
* add setup script for run-rs on windows
* gh actions: run in test environment
* remove test files
* better error handling, use cross-spawn to avoid issues on windows
* fix lint
This commit is contained in:
@@ -6,6 +6,10 @@ import nconf from 'nconf';
|
||||
import {
|
||||
pipe,
|
||||
} from './taskHelper';
|
||||
import {
|
||||
getDevelopmentConnectionUrl,
|
||||
getDefaultConnectionOptions,
|
||||
} from '../website/server/libs/mongodb';
|
||||
|
||||
// TODO rewrite
|
||||
|
||||
@@ -44,7 +48,10 @@ gulp.task('test:nodemon', gulp.series(done => {
|
||||
}, 'nodemon'));
|
||||
|
||||
gulp.task('test:prepare:mongo', cb => {
|
||||
mongoose.connect(TEST_DB_URI, err => {
|
||||
const mongooseOptions = getDefaultConnectionOptions();
|
||||
const connectionUrl = getDevelopmentConnectionUrl(TEST_DB_URI);
|
||||
|
||||
mongoose.connect(connectionUrl, mongooseOptions, err => {
|
||||
if (err) return cb(`Unable to connect to mongo database. Are you sure it's running? \n\n${err}`);
|
||||
return mongoose.connection.dropDatabase(err2 => {
|
||||
if (err2) return cb(err2);
|
||||
|
||||
Reference in New Issue
Block a user