Skip to content

chore: ignore test directories left over from other branches #10525

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions packages/svelte/tests/suite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ export function suite_with_variants<Test extends BaseTest, Variants extends stri
};
}

// If a directory only contains these children, it's a sign that it's leftover
// from a different branch, and we can skip the test
const ignored = ['_output', '_actual.json'];

async function for_each_dir<Test extends BaseTest>(
cwd: string,
samples_dir = 'samples',
Expand All @@ -76,13 +80,14 @@ async function for_each_dir<Test extends BaseTest>(
let created_test = false;

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

const file = `${cwd}/${samples_dir}/${dir}/_config.js`;
if (!filter.test(dir)) {
if (fs.readdirSync(`${cwd}/${samples_dir}/${dir}`).every((file) => ignored.includes(file))) {
continue;
}

const file = `${cwd}/${samples_dir}/${dir}/_config.js`;

created_test = true;
const config = (fs.existsSync(file) ? (await import(file)).default : {}) as Test;

Expand Down