fix(build): skip root-level test dirs when packaging examples - #304
Open
AlexPaiva wants to merge 1 commit into
Open
fix(build): skip root-level test dirs when packaging examples#304AlexPaiva wants to merge 1 commit into
AlexPaiva wants to merge 1 commit into
Conversation
shouldSkip gets a path relative to the example root, so the global `/test/` pattern only matches nested dirs like app/test/. A root-level test/ or tests/ has no leading slash and never matches, so next-app-router/tests ships its Playwright specs in the skill output. Adds an anchored regex for the root-level case, plus a regression test covering nested, root-level and the testing/ near-miss.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
shouldSkipinscripts/lib/example-processor.jsreceives a path relative to the example root (collectFilescomputes it withpath.relative(baseDir, fullPath)), therefore the global/test/pattern only matches nested directories likeapp/test/. A root-leveltest/ortests/has no leading slash and never matches.Running the current patterns through the repo's own
shouldSkip:So
example-apps/next-app-router/testsships its Playwright specs in the skill output today, and any example that adds tests at the root would do the same.This adds an anchored regex for the root-level case and a regression test covering nested, root-level, and the
testing/near-miss. The separator class coverspath.relativeoutput on Windows.I considered normalizing the path with leading and trailing separators before matching, which would fix the general class rather than this one case, but it changes behaviour for every existing pattern and seemed like the wrong call for an outside contribution. Happy to do it that way instead if preferred.
Please note that the suite has 6 failing test files on
mainbefore this change (bundle-writer.test.jshas an assertion failure). Unrelated, and this just adds one passing test on top.