Skip to content

Commit

Permalink
export as function
Browse files Browse the repository at this point in the history
  • Loading branch information
balazsorban44 committed Mar 27, 2024
1 parent a5e99bb commit 47393f8
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions scripts/run-related-test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,14 @@ async function getChangedFilesFromPackages(baseBranch = 'canary') {
.filter((line) => line.startsWith('packages/'))
}

const args = process.argv.slice(2)
const paths = args.length ? args : await getChangedFilesFromPackages()
const marker = '// TEST:'
const files = await findFiles(paths, marker)
const lines = []
for (const file of files) lines.push(...(await readTestLines(file, marker)))
export async function getRelatedTests(args = []) {
const paths = args.length ? args : await getChangedFilesFromPackages()
const marker = '// TEST:'
const files = await findFiles(paths, marker)
const lines = []
for (const file of files) lines.push(...(await readTestLines(file, marker)))

console.log(Array.from(new Set(lines)).join('\n'))
return Array.from(new Set(lines))
}

// console.log(await getRelatedTest(process.argv.slice(2)))

0 comments on commit 47393f8

Please sign in to comment.