-
Notifications
You must be signed in to change notification settings - Fork 55
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
feat: ts test setup #1001
feat: ts test setup #1001
Conversation
any changes after this one require "imploding" the repo types a little bit, so i want to do a little more groundwork before that |
jest.config.js
Outdated
setupFiles: ['<rootDir>/test/setup.ts'], | ||
testPathIgnorePatterns: ['/node_modules/', '<rootDir>/types/'], | ||
transform: { | ||
'^.+\\.tsx?$': ['ts-jest', { tsconfig: './tsconfig.json' }], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does ts-jest offer more over using babel-jest?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not really, picked ts-jest mainly cause i'm more familiar with it and it has a out-of-the-box preset for ts-with-js setup
https://jestjs.io/docs/getting-started#using-typescript
Because TypeScript support in Babel is purely transpilation, Jest will not type-check your tests as they are run. If you want that, you can use ts-jest instead, or just run the TypeScript compiler tsc separately (or as part of your build process).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't have strong opinions other than its nice to compile stuff the same way for tests as when building?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah i agree - converted to babel
@@ -8,6 +8,7 @@ module.exports = (api) => ({ | |||
includePolyfills: false, | |||
}, | |||
], | |||
'@babel/preset-typescript', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how did we not have this already?
Adds testing setup + all the low-hanging fruit types conversion