Commit 403fcf58 authored by Rik Smith-Unna's avatar Rik Smith-Unna
Browse files

Update async, mockapp uses local startnewapp

parent ec0b79dc
......@@ -55,8 +55,6 @@
"devDependencies": {
"babel-cli": "^6.18.0",
"babel-eslint": "^6.1.2",
"babel-preset-es2015": "^6.18.0",
"babel-preset-react": "^6.16.0",
"chai": "^3.5.0",
"chai-as-promised": "^5.3.0",
"eslint": "^3.2.2",
......@@ -75,6 +73,7 @@
"node-localstorage": "^1.3.0",
"pubsweet-cli": "git+https://gitlab.coko.foundation/pubsweet/pubsweet-cli.git#testing",
"pubsweet-component-login": "^0.1.0",
"pubsweet-server": "^0.7.2",
"require-dir": "^0.3.1",
"standard": "^8.0.0-beta.5",
"supertest": "^2.0.0",
......
......@@ -2,7 +2,7 @@ const fs = require('fs')
const path = require('path')
const mockdatafile = path.join(__dirname, 'mockapp.json')
const startnewapp = require('pubsweet-cli/test/helpers/startnewapp')
const startnewapp = require('./startnewapp')
startnewapp().then(
_app => {
......
const spawn = require('child_process').spawn
const spawn = require('child_process').spawnSync
const path = require('path')
module.exports = () => require('pubsweet-cli/test/helpers/working_dir')(
).then(
dir => require('pubsweet-cli/src/generate-config')()
).then(
require('pubsweet-cli/src/generate-env')
).then(
() => require('pubsweet-cli/src/initial-app')('someapp')
).then(
require('pubsweet-cli/src/setup-db')({
properties: require('pubsweet-cli/src/db-properties'),
override: require('pubsweet-cli/test/fixtures').dbconfig
})
).then(
dbsetup => new Promise(
(resolve, reject) => spawn(
'npm install',
[path.join(__dirname, '..', '..')],
{
cwd: process.cwd(),
stdio: 'ignore',
shell: true
}
).then(
() => resolve(dbsetup)
).catch(
reject
)
)
).then(
dbsetup => new Promise(
resolve => require('pubsweet-cli/test/src/start')(server => {
resolve({
server: server,
user: dbsetup.user,
collection: dbsetup.collection
})
})
)
const tmpdir = await require('pubsweet-cli/test/helpers/working_dir')()
const appname = 'testapp'
fs.mkdirsSync(path.join(tmpdir, appname))
logger.info('created directory')
await require('pubsweet-cli/src/generate-config')()
logger.info('config generated')
await require('pubsweet-cli/src/generate-env')()
logger.info('env generated')
await require('pubsweet-cli/src/initial-app')(appname)
logger.info('app generated')
await require('pubsweet-cli/src/setup-db')({
properties: require('pubsweet-cli/src/db-properties'),
override: dbconfig
})
logger.info('db created')
require('pubsweet-cli/src/load-config')(path.resolve('', './config'))
logger.info('config loaded')
spawn(
'npm install',
[path.join(__dirname, '..', '..')],
{
cwd: process.cwd(),
stdio: 'ignore',
shell: true
}
)
logger.info('starting server')
require('pubsweet-cli/src/start')(_server => {
server = _server
logger.info('server started')
done()
})
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment