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

Support svelte.config.cjs file naming #35

Closed
mcmxcdev opened this issue Mar 27, 2021 · 5 comments
Closed

Support svelte.config.cjs file naming #35

mcmxcdev opened this issue Mar 27, 2021 · 5 comments

Comments

@mcmxcdev
Copy link

When trying to run unit tests with SvelteKit, svelte-jester throws Could not find svelte.config.js.

It would be great to have SvelteKit support!

@forrestjacobs
Copy link
Contributor

forrestjacobs commented Apr 12, 2021

It looks like Cosmiconfig v7 handles .cjs files. I don't think that updating this project's Cosmiconfig dependency is the only change necessary, but it would probably remove the No loader specified for extension ".cjs" error that I'm getting when I try this transform config: transform: { "^.+\\.svelte$": ["svelte-jester", { preprocess: "./svelte.config.cjs" }] }

@forrestjacobs
Copy link
Contributor

forrestjacobs commented Apr 12, 2021

Actually, I just tried it and { preprocess: "./svelte.config.cjs" } totally works if svelte-jester uses Cosmiconfig v7! The change I'm talking about is here, but it's literally just updating the dependency version.

The other question is what should { preprocess: true } do -- should it look for "svelte.config.cjs" if "svelte.config.js" doesn't exist? And the same for { rootMode: "upward" } -- should it search for "svelte.config.cjs" as well as "svelte.config.js"?

@mihar-22
Copy link
Collaborator

Hey @forrestjacobs thanks for looking into all this! If you can throw a PR my way for this I'm happy to pull it in and release ASAP. The answer to both questions is yes, it should look for both svelte.config.js and svelte.config.cjs.

@forrestjacobs
Copy link
Contributor

@mihar-22 sure thing! Just opened one.

@mihar-22
Copy link
Collaborator

mihar-22 commented Apr 12, 2021

Released in 1.4.0 thanks to @forrestjacobs!

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

3 participants