mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-03 06:09:02 +02:00
dc157392ae
[web] convert final acceptance tests to es modules GitOrigin-RevId: d0d0cd3dfedbe494ce51dd6f8c180dff02429ad8
40 lines
871 B
JavaScript
40 lines
871 B
JavaScript
import { execFile } from 'node:child_process'
|
|
import {
|
|
connectionPromise,
|
|
cleanupTestDatabase,
|
|
dropTestDatabase,
|
|
} from '../../../../app/src/infrastructure/mongodb.js'
|
|
import Settings from '@overleaf/settings'
|
|
|
|
const DEFAULT_ENV = 'saas'
|
|
|
|
export default {
|
|
initialize() {
|
|
before('wait for db', async function () {
|
|
await connectionPromise
|
|
})
|
|
if (process.env.CLEANUP_MONGO === 'true') {
|
|
before('drop test database', dropTestDatabase)
|
|
}
|
|
|
|
before('run migrations', function (done) {
|
|
const args = [
|
|
'run',
|
|
'migrations',
|
|
'--',
|
|
'migrate',
|
|
'-t',
|
|
Settings.env || DEFAULT_ENV,
|
|
]
|
|
execFile('npm', args, (error, stdout, stderr) => {
|
|
if (error) {
|
|
throw error
|
|
}
|
|
done()
|
|
})
|
|
})
|
|
|
|
afterEach('purge mongo data', cleanupTestDatabase)
|
|
},
|
|
}
|