service-core/test/runner.mjs
Jonatan Nilsson 4f4bc8cf6a
All checks were successful
continuous-integration/appveyor/branch AppVeyor build succeeded
More core development, full integration started
2022-02-11 13:59:10 +00:00

47 lines
No EOL
906 B
JavaScript

import fs from 'fs'
import Core from '../core/core.mjs'
import GetDB from '../core/db.mjs'
import getLog from '../core/log.mjs'
import Util from '../core/util.mjs'
const name = 'service-core-runner'
const util = new Util(import.meta.url)
const log = getLog(name)
const config = {
name: name,
testapp: {
port: 31313,
provider: 'static',
}
}
try {
fs.rmSync(util.getPathFromRoot('./db.json'))
} catch {}
GetDB(config, log, util.getPathFromRoot('./db.json')).then(async function(db) {
const core = new Core(db, util, log, function() {})
console.log(db.data)
await core.init()
console.log(db.data)
db.data.core.testapp.versions.push({
id: 'ok',
version: 'ok',
stable: 0,
installed: true,
})
await core.run()
})
.then(
function() {
log.info('core is running')
},
function(err) {
log.error(err, 'Error starting runner')
process.exit(1)
})