Skip to content

fix watch mode --fix with multiple files #353

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

wolfgangwalther
Copy link

I ran into a problem, where toggling --fix via the watch plugin worked fine when I filtered the list of files to 1 file. As soon as I started watching multiple files, however, --fix did not work anymore.

It took me quite a while to figure this out, but it looks like somehow this way of creating the runner

createJestRunner(require.resolve("./run"));

leads to a situation where the import for configOverrides in run.js creates new objects for each file the runner is run on. Since this object is not the same as the one imported in the watch plugin itself, .getFix() always returned undefined, and the fix never worked.

The change in here fixes that, because configOverrides is only imported once in index.js.

This approach is actually taken from jest-runner-eslint, which worked fine for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant