Skip to content

Conversation

AriPerkkio
Copy link
Member

Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Comment on lines +5 to +17
test('getFilesRefList returns files', async () => {
const files = await getFilesRefList('test/fixtures/files', '');

expect(files).toMatchInlineSnapshot(`
[
"test-fixtures-files.json",
[
"/first.js",
"/nested/directory/second.ts",
],
]
`);
});
Copy link
Member Author

@AriPerkkio AriPerkkio Aug 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Failure on Windows CI before fix:

 ❯ src/default/utils/content/files-ref.spec.ts  (1 test | 1 failed) 26ms
   ❯ src/default/utils/content/files-ref.spec.ts > getFilesRefList returns files
     → Snapshot `getFilesRefList returns files 1` mismatched
⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯
 FAIL  src/default/utils/content/files-ref.spec.ts > getFilesRefList returns files
Error: Snapshot `getFilesRefList returns files 1` mismatched
- Expected
+ Received
  [
    "test-fixtures-files.json",
    [
      "/first.js",
-     "/nested/directory/second.ts",
+     "/nested\directory\second.ts",
    ],
  ]

https://github.com/stackblitz/tutorialkit/actions/runs/10287876681/job/28471979082?pr=225

Comment on lines 72 to 84
// create snapshot of lesson, solution and template file reference JSONs
const lessonJsons = distFiles.filter((file) => file.endsWith('-files.json'));
const solutionJsons = distFiles.filter((file) => file.endsWith('-solution.json'));
const templateJsons = distFiles.filter((file) => file.startsWith('template-') && file.endsWith('.json'));

const contents = [...lessonJsons, ...solutionJsons, ...templateJsons].reduce((jsons, current) => {
const fileJson = JSON.parse(readFileSync(path.join(dest, 'dist', current), 'utf8'));
const filenames = Object.keys(fileJson);

return { ...jsons, [current]: filenames };
}, {});

expect(JSON.stringify(contents, null, 2)).toMatchSnapshot('built project file references');
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assertion is unrelated to the bug. I first thought the problem would be here and created this test case to see if it passes on Windows - it did.

It seems useful so let's include it as well.

@AriPerkkio AriPerkkio force-pushed the fix/windows-sub-folders branch from c0af565 to e44d4c8 Compare August 7, 2024 16:28
@AriPerkkio AriPerkkio changed the title fix: sub folders not working on Windows fix(astro): sub folders not working on Windows Aug 7, 2024
@AriPerkkio AriPerkkio marked this pull request as ready for review August 7, 2024 16:32
@AriPerkkio AriPerkkio requested a review from Nemikolh August 7, 2024 16:32
@@ -5,6 +5,7 @@ on:
branches:
- main
pull_request:
workflow_dispatch:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is useful for contributors. It allows them (and me) to run CI manually on specific branch on forks.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh that's a really nice addition! 😃

Copy link
Member

@Nemikolh Nemikolh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really good find! I like the clean up and the new test! 🤌

@@ -5,6 +5,7 @@ on:
branches:
- main
pull_request:
workflow_dispatch:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh that's a really nice addition! 😃

@Nemikolh Nemikolh merged commit 694f5ca into stackblitz:main Aug 7, 2024
10 checks passed
@AriPerkkio AriPerkkio deleted the fix/windows-sub-folders branch August 8, 2024 03:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Subfolders on windows do not work
2 participants