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
[Docs]: Include a GitHub repo with a minimal working demo #4286
Comments
This would be good to have given that If you're running into problems, here's what worked for me starting from an empty project folder: 1. Initialize a new NodeJS projectRun Creates file {
"name": "ts-testing",
"scripts": {
"test": "jest"
},
"devDependencies": {
"@types/jest": "^29.5.12",
"jest": "^29.7.0",
"ts-jest": "^29.1.2",
"typescript": "^5.4.3"
}
} 2. Install dependencies step from ts-jest docsRun 3. From the next step in the page, create a ts-jest configRun Creates file module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
}; 4. Create a new default typescript configRun Creates file {
"compilerOptions": {
"target": "es2016",
"module": "commonjs",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true
}
} 5. Create your typescript fileFor example export function add(a: number, b: number): number {
return a + b;
} 6. Create your unit test file.It should end in import { add } from "./calc";
describe("Addition", () => {
test("Two integers", () => {
expect(add(1, 2)).toBe(3);
});
}); 7. Start the testsRun Should get the following if you used the examples above
|
We have example repos here https://github.com/kulshekhar/ts-jest/tree/main/examples Would you pls check? |
🚀 Feature Proposal
It would be helpful if I could experiment with
ts-jest
in a independent project that is guaranteed to work and that I can just pull and run.Motivation
I'm trying to implement ts-jest into an existing project but I'm not able to run a single test. Using just jest works but with ts-jest it looks like it doesn't even read my
jest.config.ts
. I suppose there's something with babel config or tsconfigs that are already in the project. Maybe TypeScript version or I don't know what is the issue.When I run
npx ts-jest
I only get this response and it doesn't run any test:Example
No response
The text was updated successfully, but these errors were encountered: