Skip to content

[Q] How to speed up Jest? #4453

Closed
Closed
@CharlieIGG

Description

@CharlieIGG

Is this a bug report?

No, it's a question.

The Question: How to speed up Jest?

Tests are running at a very slow pace

I currently have only three tests: Two tests that validate the initial state of my app, plus the default 'renders without crashing' test that comes with CRA.

My other tests look like so:

import { AppState } from '../State/AppState';

describe("store", () => {
    const store = new AppState();
    it("initializes with default variableX", () => {
        expect(store.quote.variableX).toBe("SomeService");
    })
    it("cannot have variableZ without a defined variableX and variableY", () => {
        // (...)
    })
})

It takes 11.30 seconds (not ms) to run these tests. If I just test with the default CRA test it takes around 8 - 9 seconds.

What gives? How can I make tests run faster?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions