Skip to content

Commit 4d8d292

Browse files
authored
chore: ignore test directories left over from other branches (#10525)
* chore: ignore test directories left over from other branches * tighten up * one comment will do --------- Co-authored-by: Rich Harris <[email protected]>
1 parent 3da6cef commit 4d8d292

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

packages/svelte/tests/suite.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ export function suite_with_variants<Test extends BaseTest, Variants extends stri
6767
};
6868
}
6969

70+
// If a directory only contains these children, it's a sign that it's leftover
71+
// from a different branch, and we can skip the test
72+
const ignored = ['_output', '_actual.json'];
73+
7074
async function for_each_dir<Test extends BaseTest>(
7175
cwd: string,
7276
samples_dir = 'samples',
@@ -76,13 +80,14 @@ async function for_each_dir<Test extends BaseTest>(
7680
let created_test = false;
7781

7882
for (const dir of fs.readdirSync(`${cwd}/${samples_dir}`)) {
79-
if (dir[0] === '.') continue;
83+
if (dir[0] === '.' || !filter.test(dir)) continue;
8084

81-
const file = `${cwd}/${samples_dir}/${dir}/_config.js`;
82-
if (!filter.test(dir)) {
85+
if (fs.readdirSync(`${cwd}/${samples_dir}/${dir}`).every((file) => ignored.includes(file))) {
8386
continue;
8487
}
8588

89+
const file = `${cwd}/${samples_dir}/${dir}/_config.js`;
90+
8691
created_test = true;
8792
const config = (fs.existsSync(file) ? (await import(file)).default : {}) as Test;
8893

0 commit comments

Comments
 (0)