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

Use ts-jest so that test files can be run without transpiling #1032

Closed
trivikr opened this issue Mar 23, 2020 · 4 comments · Fixed by #2088
Closed

Use ts-jest so that test files can be run without transpiling #1032

trivikr opened this issue Mar 23, 2020 · 4 comments · Fixed by #2088
Labels
feature-request New feature or enhancement. May require GitHub community feedback.

Comments

@trivikr
Copy link
Member

trivikr commented Mar 23, 2020

Is your feature request related to a problem? Please describe.
The test files *.spec.ts are currently transpiled to JavaScript before being run

Describe the solution you'd like
Use ts-jest so that *.spec.ts files can be run without transpiling

Describe alternatives you've considered
Continue transpiling files before running tests

@trivikr trivikr added the feature-request New feature or enhancement. May require GitHub community feedback. label Mar 23, 2020
@trivikr
Copy link
Member Author

trivikr commented Mar 23, 2020

compilerOptions.paths needs to be set up in order to use ts-jest:

@ghost
Copy link

ghost commented Apr 15, 2020

https://jestjs.io/blog/2019/01/25/jest-24-refreshing-polished-typescript-friendly
jest v24+ already has native support for typescript.

@trivikr
Copy link
Member Author

trivikr commented Apr 15, 2020

One caveat to the default TypeScript support, similar to Flow, is that Babel will only strip out the type annotations to make your code valid JavaScript. It will not typecheck your code.
If you want to run typechecks while you test, you should use ts-jest

The native support for TypeScript in Jest 24+ won't typecheck the code.

@github-actions
Copy link

github-actions bot commented Apr 3, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request New feature or enhancement. May require GitHub community feedback.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant