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

Optimize unit tests for apps/staking #18

Closed
5 tasks
nevendyulgerov opened this issue Jun 16, 2023 · 0 comments · Fixed by #26
Closed
5 tasks

Optimize unit tests for apps/staking #18

nevendyulgerov opened this issue Jun 16, 2023 · 0 comments · Fixed by #26
Assignees
Labels
type:refactor A code change that neither fixes a bug nor adds a feature

Comments

@nevendyulgerov
Copy link
Contributor

nevendyulgerov commented Jun 16, 2023

📄 Context

We noticed that unit tests take a lot of time to execute while not containing anything heavy in terms of computations.

Most of the time, those tests contain some mocks and simple checks that should be rather fast. Mocks are stored in memory and we are not calling any third-party services so the large amounts of time required for tests to execute are not justified. This also impacts our builds as they are slower than expected.

✔️ Solution

There are multiple things we can do to improve unit tests speed. An example is to optimize imports since jest (our test runner) takes more time to process large imports than specific ones.

Example from packages/ui:

This is slower:

import { StakePlusIcon } from '../../src/components';

than this:

import { StakePlusIcon } from '../../src/components/Icons';

📈 Subtasks

🎯 Definition of Done

  • Tests speed is increased so that we see significant improvement in build times.
@nevendyulgerov nevendyulgerov added the type:refactor A code change that neither fixes a bug nor adds a feature label Jun 16, 2023
@nevendyulgerov nevendyulgerov self-assigned this Jun 27, 2023
@nevendyulgerov nevendyulgerov linked a pull request Jun 29, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:refactor A code change that neither fixes a bug nor adds a feature
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant