Add tests for web instance

This commit is contained in:
linguist
2020-12-30 18:14:20 +01:00
parent a8fe11b7b5
commit 6290ca575c
9 changed files with 294 additions and 226 deletions

View File

@@ -195,26 +195,19 @@
const die = bool(core.getInput("plugins_errors_fatal"))
console.log(`Plugin errors │ ${die ? "die" : "warn"}`)
//Verify svg
const verify = bool(core.getInput("verify"))
console.log(`Verify SVG │ ${verify}`)
//Build query
const query = JSON.parse(core.getInput("query") || "{}")
console.log(`Query additional params │ ${JSON.stringify(query)}`)
q = {...query, ...q, base:false, ...base, ...config, repositories, template}
//Render metrics
const rendered = await metrics({login:user, q, dflags}, {graphql, rest, plugins, conf, die}, {Plugins, Templates})
const rendered = await metrics({login:user, q, dflags}, {graphql, rest, plugins, conf, die, verify}, {Plugins, Templates})
console.log(`Render │ complete`)
//Verify svg
const verify = bool(core.getInput("verify"))
console.log(`Verify SVG │ ${verify}`)
if (verify) {
const [libxmljs] = [await import("libxmljs")].map(m => (m && m.default) ? m.default : m)
const parsed = libxmljs.parseXml(rendered)
if (parsed.errors.length)
throw new Error(`Malformed SVG : \n${parsed.errors.join("\n")}`)
console.log(`SVG valid │ yes`)
}
//Commit to repository
const dryrun = bool(core.getInput("dryrun"))
if (dryrun)