Why: Suppressing errors and not failing the execution will lead to misleading errors of the following tests. Fixes CORE-461
31 lines
635 B
JavaScript
31 lines
635 B
JavaScript
const path = require("path")
|
|
const express = require("express")
|
|
const getPort = require("get-port")
|
|
const importFrom = require("import-from")
|
|
|
|
module.exports = {
|
|
bootstrapApp: async ({ cwd } = {}) => {
|
|
const app = express()
|
|
|
|
const loaders = importFrom(
|
|
cwd || process.cwd(),
|
|
"@medusajs/medusa/dist/loaders"
|
|
).default
|
|
|
|
const { container, dbConnection } = await loaders({
|
|
directory: path.resolve(cwd || process.cwd()),
|
|
expressApp: app,
|
|
isTest: false,
|
|
})
|
|
|
|
const PORT = await getPort()
|
|
|
|
return {
|
|
container,
|
|
db: dbConnection,
|
|
app,
|
|
port: PORT,
|
|
}
|
|
},
|
|
}
|