From 2ee31047f57d3daa50cf1be72c75533683cb498f Mon Sep 17 00:00:00 2001 From: "Daniel (dB.) Doubrovkine" Date: Mon, 12 Aug 2024 17:31:46 -0400 Subject: [PATCH] Skip only known or hidden files. (#498) Signed-off-by: dblock --- tools/src/tester/TestRunner.ts | 7 +++---- tools/tests/tester/fixtures/stories/.ignore-dot-file | 1 + tools/tests/tester/fixtures/stories/docker-compose.yml | 1 + tools/tests/tester/fixtures/stories/ignore.wrong.extension | 1 - 4 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 tools/tests/tester/fixtures/stories/.ignore-dot-file create mode 100644 tools/tests/tester/fixtures/stories/docker-compose.yml delete mode 100644 tools/tests/tester/fixtures/stories/ignore.wrong.extension diff --git a/tools/src/tester/TestRunner.ts b/tools/src/tester/TestRunner.ts index 0c0f3c4ff..0b197d648 100644 --- a/tools/src/tester/TestRunner.ts +++ b/tools/src/tester/TestRunner.ts @@ -64,10 +64,9 @@ export default class TestRunner { #collect_story_files (folder: string, file: string, prefix: string): StoryFile[] { const path = file === '' ? folder : `${folder}/${file}` const next_prefix = prefix === '' ? file : `${prefix}/${file}` - if (fs.statSync(path).isFile()) { - if (!path.endsWith('.yaml')) { - return [] - } + if (file.startsWith('.') || file == 'docker-compose.yml') { + return [] + } else if (fs.statSync(path).isFile()) { const story: Story = read_yaml(path) return [{ display_path: next_prefix === '' ? basename(path) : next_prefix, diff --git a/tools/tests/tester/fixtures/stories/.ignore-dot-file b/tools/tests/tester/fixtures/stories/.ignore-dot-file new file mode 100644 index 000000000..11c2f4cfd --- /dev/null +++ b/tools/tests/tester/fixtures/stories/.ignore-dot-file @@ -0,0 +1 @@ +Hidden file, ignored. \ No newline at end of file diff --git a/tools/tests/tester/fixtures/stories/docker-compose.yml b/tools/tests/tester/fixtures/stories/docker-compose.yml new file mode 100644 index 000000000..a47276c99 --- /dev/null +++ b/tools/tests/tester/fixtures/stories/docker-compose.yml @@ -0,0 +1 @@ +# A docker-compose.yml file, ignored. diff --git a/tools/tests/tester/fixtures/stories/ignore.wrong.extension b/tools/tests/tester/fixtures/stories/ignore.wrong.extension deleted file mode 100644 index a649676ae..000000000 --- a/tools/tests/tester/fixtures/stories/ignore.wrong.extension +++ /dev/null @@ -1 +0,0 @@ -Not a .yaml file, should be ignored