Skip to content
Prev Previous commit
Next Next commit
Docs on allowed config options in WatchPlugins
  • Loading branch information
tdd committed Jun 22, 2018
commit bd8a325b4c3a77ca094235ce9f080efde202bf6f
21 changes: 21 additions & 0 deletions docs/WatchPlugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,24 @@ class MyWatchPlugin {
}
}
```

**Note**: If you do call `updateConfigAndRun`, your `run` method should not resolve to a truthy value, as that would trigger a double-run.

#### Authorized configuration keys

For stability and safety reasons, only part of the global configuration keys can be updated with `updateConfigAndRun`. The current white list is as follows:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @SimenB!

  • --changedSince and --lastCommit do not have any direct equivalent in the global configuration object. They're used by getChangedFilesForRoots in jest-changed-files, and are also ignored when --onlyChanged (which is the default watch mode), so they don't seem to make sense in that mode. At any rate, the watch architecture would not let us change that on the fly right now, this is a bootstrap-time computation.
  • --onlyChanged is already togglable in watch mode: these are the a key (all tests, same as --watchAll) vs. o key (only changed tests, same as --onlyChanged).
  • --logHeapUsage does have a matching boolean in the global config, so I'm open to adding it, what do others think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the same way toggling onlyChanged is useful, I think changedSince would be useful. It would then overwrite onlyChanged.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SimenB I agree it would be nice, but Jest's current architecture doesn't let us do it. It computes the watched list at boot time, then keeps it in a closure where specific global config options may amend it (such as the watch mode). There's no stuff in there right now for changedSince or lastCommit, and I feel the change would be significant.

This specific PR is bound by what's in the global config. Should this feature set become config-based, I'll be glad to expand the white list, but it's a different feature scope IMHO.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rogeliog sounds like we need another of your magical refactor runs 😀

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah we would need to change a couple of things in order to make that happen 🙃


- [`bail`](configuration.html#bail-boolean)
- [`collectCoverage`](configuration.html#collectcoverage-boolean)
- [`collectCoverageFrom`](configuration.html#collectcoveragefrom-array)
- [`collectCoverageOnlyFrom`](configuration.html#collectcoverageonlyfrom-array)
- [`coverageDirectory`](configuration.html#coveragedirectory-string)
- [`coverageReporters`](configuration.html#coveragereporters-array)
- [`notify`](configuration.html#notify-boolean)
- [`notifyMode`](configuration.html#notifymode-string)
- [`onlyFailures`](configuration.html#onlyfailures-boolean)
- [`reporters`](configuration.html#reporters-array-modulename-modulename-options)
- [`testNamePattern`](cli.html#testnamepattern-regex)
- [`testPathPattern`](cli.html#testpathpattern-regex)
- [`updateSnapshot`](cli.html#updatesnapshot)
- [`verbose`](configuration.html#verbose-boolean)