mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
ci: run modified tests first (#24463)
Co-authored-by: Meghan Denny <meghan@bun.com>
This commit is contained in:
@@ -1891,6 +1891,27 @@ function getRelevantTests(cwd, testModifiers, testExpectations) {
|
||||
filteredTests.push(...availableTests);
|
||||
}
|
||||
|
||||
// Prioritize modified test files
|
||||
if (allFiles.length > 0) {
|
||||
const modifiedTests = new Set(
|
||||
allFiles
|
||||
.filter(filename => filename.startsWith("test/") && isTest(filename))
|
||||
.map(filename => filename.slice("test/".length)),
|
||||
);
|
||||
|
||||
if (modifiedTests.size > 0) {
|
||||
return filteredTests
|
||||
.map(testPath => testPath.replaceAll("\\", "/"))
|
||||
.sort((a, b) => {
|
||||
const aModified = modifiedTests.has(a);
|
||||
const bModified = modifiedTests.has(b);
|
||||
if (aModified && !bModified) return -1;
|
||||
if (!aModified && bModified) return 1;
|
||||
return 0;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return filteredTests;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user