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

chore: setup jest for use with Typescript tests #106

Merged
merged 13 commits into from
Aug 11, 2020
Merged

Conversation

karrui
Copy link
Contributor

@karrui karrui commented Aug 7, 2020

This PR adds the ability to run Typescript tests with Jest. All tests with file names that match

**/?(*.)+(spec|test).[t]s?(x)

will be run with Jest.

This PR also migrates a few tests to Typescript to check if ts-jest is working.

Features:

  • A small lint improvement has been made to the autosorting and autogrouping of imports.
  • Typescript tests are now ran with Jest.
  • Update tsconfig.json to now allow for absolute imports: ../../../../../<root>/some/path -> src/some/path
  • Add jest-mongodb-config. With this, we can eventually stop using npm run download-binary and delete tests/end-to-end/helpers/get-mongo-binary.js since the config automatically retrieves that information for us.

New scripts:

  • Add test-backend-jest script to run jest tests
  • test-backend script now runs both jasmine and jest tests. Jasmine tests will be run first, followed by jest tests. Eventually, all tests will be written in Jest and Jasmine tests can be deleted.

@karrui karrui marked this pull request as draft August 7, 2020 08:13
@karrui
Copy link
Contributor Author

karrui commented Aug 7, 2020

Drafting this, I want to explore using Jest's automatic mongodb setup.

@karrui karrui force-pushed the chore/setup-ts-jest branch 4 times, most recently from ea72089 to 8b42524 Compare August 7, 2020 17:25
@karrui
Copy link
Contributor Author

karrui commented Aug 7, 2020

Ready for review. I think tests can be written in Typescript moving forward :)

@karrui karrui marked this pull request as ready for review August 7, 2020 17:32
@karrui karrui requested a review from liangyuanruo August 7, 2020 17:32
jest-mongodb-config.js Outdated Show resolved Hide resolved
Copy link
Contributor

@liangyuanruo liangyuanruo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

largely lgtm! can i confirm the way to have jest run the tests instead of jasmine, is to convert them to TypeScript?

@karrui
Copy link
Contributor Author

karrui commented Aug 9, 2020 via email

@karrui karrui force-pushed the chore/setup-ts-jest branch from 1d62e66 to f7e544a Compare August 11, 2020 02:47
@karrui karrui force-pushed the chore/setup-ts-jest branch from f7e544a to d41fd00 Compare August 11, 2020 04:33
@karrui karrui merged commit 56e9b89 into develop Aug 11, 2020
@karrui karrui deleted the chore/setup-ts-jest branch August 11, 2020 06:10
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.

2 participants