jestjs/jest

[Feature]: Expand perfStats to time test loading vs test execution

glenjamin opened this issue ยท 4 comments

๐Ÿš€ Feature Proposal

In #14622 perfStats was expanded to provide breakdowns of parts of the test init process

However, it doesn't include a timer for the interval between calling import/require on the test file, and starting the actual test execution.

Motivation

In my experience this timing is a common cause of slow test suite execution, I'm currently exploring ways of collecting timing information about this phase, to help people target improvements in module loading for tests.

Example

No response

Pitch

This needs to live in core, as only jest-circus have the relevant context to be able to perform this timing.

I'm happy to submit a PR for this if I get the nod that the proposal makes sense

I've been able to get something close enough to the correct numbers by reading the code closely and assigning slightly different meanings to the timestamps provided:

const {
  loadTestEnvironmentStart: testInitStart,
  setupAfterEnvEnd: testImportStart,
  end: testEnd,
} = testResult.perfStats;
const firstTestStart = testResult.testResults[0].startAt;

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.

This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.

This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.