-
I am trying to use solid-testing-library + ts-jest The config and test are simple: // jest.config.js module.exports = {
preset: "ts-jest",
testEnvironment: "jsdom",
}; // button.test.tsx import { cleanup, render } from "solid-testing-library";
test("1 + 1 = 2", () => {
expect(1 + 1).toBe(2);
});
it("should render a button", () => {
const result = render(() => <button>Test Button</button>);
console.log(result);
cleanup();
}); // babel.config.json {
"presets": [
[
"@babel/preset-env",
{
"targets": "defaults",
"modules": false
}
],
"@babel/preset-typescript",
[
"babel-preset-solid",
{
"delegateEvents": false
}
]
],
"plugins": [
"@babel/plugin-transform-runtime",
"@babel/plugin-proposal-class-properties"
]
} // ts.config.json {
"include": [
"src"
],
"exclude": [
"node_modules"
],
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"moduleResolution": "Node",
"strict": true,
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"esModuleInterop": true,
"allowJs": true,
"resolveJsonModule": true,
"experimentalDecorators": true,
"jsx": "preserve",
"jsxImportSource": "solid-js"
}
} Not sure what is going wrong. Could you please share how you test your solid libs? |
Beta Was this translation helpful? Give feedback.
Answered by
zhaoyao91
Apr 12, 2021
Replies: 2 comments
-
Beta Was this translation helpful? Give feedback.
0 replies
-
well, all done. first, install solid-jest: https://github.com/ryansolid/solid-jest then, update jest.config.js
then, update babel config
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
zhaoyao91
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
well, all done.
first, install solid-jest: https://github.com/ryansolid/solid-jest
then, update jest.config.js
then, update babel config