Skip to content

feat(test): moving unit tests over to vitest - #691

Merged
erunion merged 7 commits into
mainfrom
feat/move-to-vitest
Aug 14, 2023
Merged

feat(test): moving unit tests over to vitest#691
erunion merged 7 commits into
mainfrom
feat/move-to-vitest

Conversation

@erunion

@erunion erunion commented Aug 10, 2023

Copy link
Copy Markdown
Member

🧰 Changes

I've been wildy impressed with Vitest so this is moving us off Jest and over to that. The performance gains aren't going to break the bank, but I'll happily take a couple seconds off of the api suite any day.

◀️ Before

api
Test Suites: 18 passed, 18 total
Tests:       7 todo, 216 passed, 223 total
Snapshots:   0 total
Time:        29.639 s
Ran all test suites matching /test\/core\/index.test.ts|test\/core\/getJSONSchemaDefaults.test.ts|test\/core\/parseResponse.test.ts|test\/core\/prepareParams.test.ts|test\/core\/prepareAuth.test.ts|test\/auth.test.ts|test\/index.test.ts|test\/cache.test.ts|test\/cli\/codegen\/languages\/typescript\/utils.test.ts|test\/cli\/codegen\/languages\/typescript.test.ts|test\/cli\/storage.test.ts|test\/fetcher.test.ts|test\/cache-tmp.test.ts|test\/dist.test.ts|test\/cache-custom.test.ts|test\/config.test.ts|test\/integration.test.ts|test\/server.test.ts/i.
npx jest --coverage   77.67s user 5.05s system 275% cpu 30.033 total
httpsnippet-client-api
Test Suites: 1 passed, 1 total
Tests:       68 passed, 68 total
Snapshots:   0 total
Time:        4.174 s, estimated 5 s
Ran all test suites.
npx jest  6.69s user 0.40s system 149% cpu 4.739 total

⏭️ After

api
 Test Files  18 passed (18)
      Tests  216 passed | 7 todo (223)
   Start at  18:22:46
   Duration  26.88s (transform 817ms, setup 305ms, collect 4.15s, tests 35.72s, environment 2ms, prepare 1.38s)

npx vitest run  56.27s user 4.04s system 220% cpu 27.316 total
httpsnippet-client-api
 Test Files  1 passed (1)
      Tests  68 passed (68)
   Start at  18:24:35
   Duration  3.32s (transform 184ms, setup 0ms, collect 245ms, tests 2.87s, environment 0ms, prepare 52ms)

npx vitest run  5.34s user 0.50s system 155% cpu 3.750 total

@erunion erunion added the refactor Issues about tackling technical debt label Aug 10, 2023
@erunion erunion changed the title feat: moving unit tests over to vitest feat(test): moving unit tests over to vitest Aug 10, 2023
@erunion
erunion marked this pull request as ready for review August 10, 2023 01:52
@erunion
erunion requested a review from kanadgupta August 10, 2023 01:52

@kanadgupta kanadgupta left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks good for the most part, just a few small comments! very jealous of how easy of a drop-in replacement this was... readmeio/rdme#857 is looking rough 😬

Comment thread packages/httpsnippet-client-api/package.json Outdated
"fetch-mock": "^9.11.0",
"isomorphic-fetch": "^3.0.0",
"jest": "^29.6.1",
"ts-jest": "^29.1.1",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

love how we don't need any additional packages to support TS 😌

Comment thread packages/api/test/helpers/vitest.matchers.ts Outdated
@@ -1,3 +1 @@
import 'jest-extended';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we really were living like gremlins huh

Comment thread packages/api/test/auth.test.ts Outdated
Comment thread packages/api/package.json Outdated
Comment thread packages/api/.npmignore Outdated
erunion and others added 5 commits August 14, 2023 07:53
Co-authored-by: Kanad Gupta <8854718+kanadgupta@users.noreply.github.com>
Co-authored-by: Kanad Gupta <8854718+kanadgupta@users.noreply.github.com>
Co-authored-by: Kanad Gupta <8854718+kanadgupta@users.noreply.github.com>
Co-authored-by: Kanad Gupta <8854718+kanadgupta@users.noreply.github.com>
@erunion
erunion requested a review from kanadgupta August 14, 2023 17:09
@erunion
erunion merged commit 00bedb0 into main Aug 14, 2023
@erunion
erunion deleted the feat/move-to-vitest branch August 14, 2023 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Issues about tackling technical debt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants