jest-community / jest-runner-eslint

An ESLint runner for Jest
MIT License
480 stars 46 forks source link

Files linted in random sequence #204

Closed overlookmotel closed 1 year ago

overlookmotel commented 1 year ago

Jest normally runs test files in order of how long they took to run last time, with the longest-running first.

jest-runner-eslint doesn't seem to do this. Files are linted in a seemingly random order.

It appears that the runner is not outputting timing information to Jest, or for some reason Jest is not recording it. In Jest's cache folder, for a normal test run, there's a perf-cache file which records timings. e.g.:

{
  "/modules/foo/test/methods.test.js":[1,931],
  "/modules/foo/test/other.test.js":[1,2955]
}

The last number represents the number of milliseconds the test file took to run.

In comparison, the perf-cache file created after an jest-runner-eslint run:

{
  "/modules/foo/test/methods.test.js":[1,0],
  "/modules/foo/test/other.test.js":[1,0]
}

Every file has a recorded duration of 0, so Jest cannot sequence the files.

I'd be happy to make a PR if someone can point me in the right direction.

overlookmotel commented 1 year ago

Actually it was really simple. Have submitted a PR #205.