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(test): moving unit tests over to vitest #857

Merged
merged 25 commits into from
Sep 7, 2023
Merged

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

merged 25 commits into from
Sep 7, 2023

Conversation

erunion
Copy link
Member

@erunion erunion commented Aug 10, 2023

🧰 Changes

🧬 QA & Testing

If tests pass we should be good to go! Sadly in splitting out the tests and requiring certain tests to be single-threaded, the performance benefits are mostly a wash.

🐳 Outdated Performance Benchmarks

Before

Test Suites: 33 passed, 33 total
Tests:       1 todo, 502 passed, 503 total
Snapshots:   1 written, 83 passed, 84 total
Time:        81.823 s
Ran all test suites.
npx jest  58.51s user 9.23s system 82% cpu 1:22.60 total

After

I'm seeing some flakiness in a couple tests but running the entire a bit slower than Jest because we can't use --threads due to our usage of process.chdir(). See #857 (comment) below for some more deets.

 Test Files  1 failed | 32 passed (33)
      Tests  1 failed | 501 passed | 1 todo (503)
   Start at  00:39:27
   Duration  126.40s (transform 295ms, setup 110ms, collect 1.66s, tests 124.41s, environment 0ms, prepare 43ms)

npx vitest run  31.68s user 6.17s system 29% cpu 2:06.83 total

@erunion erunion added the refactor Issues about tackling technical debt label Aug 10, 2023
@erunion erunion changed the title feat(test): moving unit tests over to vitest + prettier 3 feat(test): moving unit tests over to vitest + prettier 3 + drop node 14 Aug 10, 2023
@erunion erunion changed the title feat(test): moving unit tests over to vitest + prettier 3 + drop node 14 feat(test): moving unit tests over to vitest + prettier 3 Aug 10, 2023
vitest.config.ts Outdated Show resolved Hide resolved
@erunion erunion assigned erunion and kanadgupta and unassigned erunion Aug 10, 2023
if you return a function within before* hooks, they'll run on teardown. so these functions are currently doing the opposite of what we're intending 😮‍💨

see: https://vitest.dev/api/#beforeall
This reverts commit 22f7904, reversing
changes made to 3298545.

... weird. so i tried merging from next and reinstalling using `npm i`, which removed these packages and will cause node 14 tests to fail.... i hate it here
kanadgupta and others added 3 commits September 5, 2023 17:01
* test: try splitting out tests

* ci: knip fix

* ci: oops

* chore: remove unused snapshots

* refactor: try using MSW instead of nock in single-threaded tests

* chore: temporarily don't worry about coverage 🤐

* chore: backfill headers-polyfill

* ci: re-enable tests on node 14

* test: add JSON error body

* ci: try matrix for threads

* ci: oops

* chore: copy edits

* chore: run build before tests

* fix(ci): split out ci and test steps

* chore: fix lockfile

* Revert "fix(ci): split out ci and test steps"

This reverts commit 112ec66.

* chore: clean out some comment junk

* chore: try fixing lockfile (again)

@esbuild/android-arm wasn't showing up in here, i think it got accidentally removed which is causing node 14 tests to break

* feat: better header checking
@kanadgupta kanadgupta changed the title feat(test): moving unit tests over to vitest + prettier 3 feat(test): moving unit tests over to vitest Sep 5, 2023
@kanadgupta kanadgupta marked this pull request as ready for review September 5, 2023 22:33
Copy link
Member

@kanadgupta kanadgupta left a comment

Choose a reason for hiding this comment

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

@erunion this is your PR but most of the recent work has been mine, mind taking one final glance before I merge?

vitest.config.ts Outdated Show resolved Hide resolved
@erunion erunion merged commit 36d561b into next Sep 7, 2023
9 of 10 checks passed
@erunion erunion deleted the feat/vitest branch September 7, 2023 18:19
kanadgupta pushed a commit that referenced this pull request Sep 7, 2023
# [8.7.0-next.1](v8.6.6...v8.7.0-next.1) (2023-09-07)

### Features

* **test:** moving unit tests over to vitest ([#857](#857)) ([36d561b](36d561b)), closes [#870](#870)

[skip ci]
@kanadgupta kanadgupta added this to the v9 milestone Sep 14, 2023
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
Development

Successfully merging this pull request may close these issues.

None yet

2 participants