ci: fix tests [skip ci]

This commit is contained in:
lowlighter
2022-01-15 09:03:42 -05:00
parent f33fe2dc00
commit 439abe0377

View File

@@ -94,16 +94,18 @@ const metadata = JSON.parse(`${
//Build tests index //Build tests index
const tests = [] const tests = []
for (const name in metadata.plugins) { for (const type of ["plugins", "templates"]) {
for (const name in metadata[type]) {
const cases = yaml const cases = yaml
.load(fs.readFileSync(path.join(__dirname, "../tests/cases", `${name}.yml`), "utf8")) .load(fs.readFileSync(path.join(__dirname, "../tests/cases", `${name}.${type.replace(/s$/, "")}.yml`), "utf8"))
?.map(({ name: test, with: inputs, modes = [], timeout }) => { ?.map(({ name: test, with: inputs, modes = [], timeout }) => {
const skip = new Set(Object.entries(metadata.templates).filter(([_, { readme: { compatibility } }]) => !compatibility[name]).map(([template]) => template)) const skip = new Set(Object.entries(metadata.templates).filter(([_, { readme: { compatibility } }]) => !compatibility[name]).map(([template]) => template))
if (!(metadata.plugins[name].supports.includes("repository"))) if (!(metadata[type][name].supports.includes("repository")))
skip.add("repository") skip.add("repository")
return [test, inputs, { skip: [...skip], modes, timeout }] return [test, inputs, { skip: [...skip], modes, timeout }]
}) ?? [] }) ?? []
tests.push(...cases) tests.push(...cases)
}
} }
//Tests run //Tests run