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

feat: ts test setup #1001

Merged
merged 6 commits into from
Dec 2, 2022
Merged

feat: ts test setup #1001

merged 6 commits into from
Dec 2, 2022

Conversation

golota60
Copy link
Collaborator

@golota60 golota60 commented Dec 1, 2022

Adds testing setup + all the low-hanging fruit types conversion

@golota60
Copy link
Collaborator Author

golota60 commented Dec 1, 2022

any changes after this one require "imploding" the repo types a little bit, so i want to do a little more groundwork before that

@golota60 golota60 requested a review from jquense December 1, 2022 19:38
jest.config.js Outdated
setupFiles: ['<rootDir>/test/setup.ts'],
testPathIgnorePatterns: ['/node_modules/', '<rootDir>/types/'],
transform: {
'^.+\\.tsx?$': ['ts-jest', { tsconfig: './tsconfig.json' }],
Copy link
Member

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?

Copy link
Collaborator Author

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).

Copy link
Member

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?

Copy link
Collaborator Author

@golota60 golota60 Dec 1, 2022

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',
Copy link
Member

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?

@golota60 golota60 changed the title feat: add ts-jest feat: ts test setup Dec 2, 2022
@golota60 golota60 merged commit f12f1d8 into master Dec 2, 2022
@golota60 golota60 deleted the sw/ts-tests branch December 2, 2022 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants