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
Ignore param matchers that match .{spec,test}.{js,ts} #8250
Ignore param matchers that match .{spec,test}.{js,ts} #8250
Conversation
This allows for param matcher tests to be collocated. fixes sveltejs#7583
🦋 Changeset detectedLatest commit: 4e24a6a The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There are other places we might need special handling for test extensions. E.g. #8180 may need it. Perhaps we should create a list of extensions that can be referenced other places where it may be needed |
Makes sense. Don't know if it makes sense to abstract out the const langExtensions = ['js', 'ts']
const testFlags = ['spec', 'test']
const testExtensions = langExtensions.map(lang => testFlags.map(flag => `.${flag}.${lang}`)).flat()
function isTestFile(file: string) {
return testExtensions.some(ext => file.endsWith(ext))
} |
There's a setting for |
Are you saying there'd be a config option that allows you do to e.g. |
No, just that we could refactor |
I looked into #8180 and the solution is unrelated, so I'm going to file the test extensions array under YAGNI |
thank you! |
This allows for param matcher tests to be collocated with their matchers
fixes #7583
Collocation of tests is a common practice, and the current param matcher scanning will throw an error if there are
.{test,spec}.{js,ts}
files in thesrc/params
directory, as it sees them as malformed param names.This is a simple change that just skips over those files instead of throwing an exception.
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpm changeset
and following the prompts. All changesets should bepatch
until SvelteKit 1.0