Skip to content

Commit

Permalink
fix: plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
9aoy committed Oct 12, 2024
1 parent 2021ab1 commit 90a7f16
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions tests/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,26 +54,36 @@ export async function test(options: RunOptions) {
console.warn(`not found package.json in ${pkgFolder}`)
}

return { hasTest: false }
return {
hasTest: false,
}
}

for (const repo of plugins) {
const { hasTest, playwright } = checkTest(repo)

if (!hasTest) {
console.warn(`not found test script in ${repo}`)
}

let hasTestScript = false
await runInRepo({
...options,
repo,
branch: 'main',
beforeTest: async () => {
const { hasTest, playwright } = checkTest(repo)

hasTestScript = hasTest

if (playwright) {
await $`pnpm exec playwright install --with-deps`
}
},
test: hasTest ? ['build', 'test'] : ['build'],
test: [
'build',
async () => {
if (hasTestScript) {
await $`pnpm run test`
} else {
console.warn(`not found test script in ${repo}`)
}
},
],
}).catch((err) => {
errors.push({
repo,
Expand All @@ -88,11 +98,11 @@ export async function test(options: RunOptions) {

if (errors.length) {
console.info(
`plugin test succeed ${plugins.length - errors.length}, failed ${
`plugins test succeed ${plugins.length - errors.length}, failed ${
errors.length
} (${errors.map((e) => e.repo).join(',')})`,
)
} else {
console.info('plugin test all passed!')
console.info('plugins test all passed!')
}
}

0 comments on commit 90a7f16

Please sign in to comment.