Skip to content
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

Is it possible to exclude +page.test.ts ? #7121

Closed
frck006 opened this issue Oct 2, 2022 · 6 comments
Closed

Is it possible to exclude +page.test.ts ? #7121

frck006 opened this issue Oct 2, 2022 · 6 comments
Milestone

Comments

@frck006
Copy link

frck006 commented Oct 2, 2022

Describe the problem

Sveltkit fails with this message:

error when starting dev server:
Error: Files prefixed with + are reserved (saw src/routes/+page.test.ts)
at analyze (file:///C:/_app/frontend/node_modules/@sveltejs/kit/src/core/sync/create_manifest_data/index.js:383:10)

Describe the proposed solution

Possibility to exclude some files

Alternatives considered

No response

Importance

nice to have

Additional Information

Not really important, it's just to have
+page.svelte
+page.test.ts
close together in explorer.
image

@madeleineostoja
Copy link

I think sveltekit should continue treating all files with the + prefix as special route files and throw this error. The whole point of having runes in route file names was to delineate them as special for sveltekit, this would undo that and at that point why have a weird prefix for files at all

@frck006
Copy link
Author

frck006 commented Oct 4, 2022

@madeleineostoja so what you suggest to call file name for tests of "+page.svelte" ? Simply like "page.test.ts ?
Do you have recommendations for +error.svelte, +page.ts ?

@gterras
Copy link

gterras commented Oct 17, 2022

By simply removing + and adding a test or spec suffix to any file you would get a comprehensive structure. I'm not sure where the problem is here. Keeping + for non-router files would be incredibly confusing.

@madeleineostoja
Copy link

agree, dunno why this is still open

@dominikg
Copy link
Member

You can also use a different prefix char, eg -page.test.js to avoid the test files getting sorted far away from +page.js in a directory with some colocated files, so there is only a very minor inconvenience.

Adding an exception to the + files are special for sveltekit rule would require a more complex implementation and reduce the usefulness of being able to search for files starting with + to get a quick overview of your route files.

@dummdidumm
Copy link
Member

Closing as we reached consensus that we don't want to make an exception for tests here.

@dummdidumm dummdidumm closed this as not planned Won't fix, can't repro, duplicate, stale Oct 19, 2022
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

No branches or pull requests

6 participants