-
Notifications
You must be signed in to change notification settings - Fork 3
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
Doesn't work with TypeScript #2
Comments
I fixed the issue by using a custom // base config used in all situations
const config = {
presets: ["babel-preset-solid"],
plugins: []
}
module.exports = (api) => {
if (api.env("test")) {
// modify the config for Jest
config.presets.push("@babel/preset-typescript")
config.plugins.push("@babel/plugin-transform-modules-commonjs")
}
return config
} |
Hmm.. I wonder if it is as easy as adding it here: https://github.com/solidui/solid-jest/blob/main/preset/browser/transform.js#L4 and the equivalent on the server. I'm just thinking that the config only is setup to transform JSX files and whether adding that is sufficient. So far I have been just adding it for TypeScript projects as needed. Things like create-solid already are setup this way. I can get around to testing this, but if you have a project handy and can confirm that is sufficient I can go and add that easily. |
I made it working with babel. Here is my config: // base config used in all situations
const config = {
presets: ["babel-preset-solid"],
plugins: [],
}
module.exports = (api) => {
if (api.env("test")) {
// modify the config for Jest
config.presets.push("@babel/preset-typescript", [
"@babel/preset-env",
{
targets: {
node: "current",
esmodules: false,
},
},
])
}
return config
} |
There is also an esbuild-jest package. If we can use that instead, that would be much faster! I couldn't configure esbuild-jest, but you may be able to do this with the help of esbuild-plugin-solid |
https://jestjs.io/docs/getting-started#using-typescript The jest docs are already quite clear about how to add TypeScript support, shouldn't that be enough? Seems like a separate concern from transforming solid components. Also, looks like |
Unless I add
@babel/preset-typescript
myself, it doesn't work.I am simplifying my babel.config.json because Parcel has switched to SWC, which handles everything in the build process. But that doesn't work for the jest tests.
The text was updated successfully, but these errors were encountered: