Skip to content

jest-watch-plugin - whitelist watchPathIgnorePatterns #8522

@YOU54F

Description

@YOU54F

Hey,

We are building an adaptor for Jest & Pact-JS which is available on Github & NPM as Jest-Pact

If I run the adaptor in watch mode, it gets stuck in an infinite loop, as pact-js will generate *.json & *.log files.

I have managed to get over this in consuming projects by telling users to add

watchPathIgnorePatterns: ["pact/logs/*","pact/pacts/*"] into their jest configuration.

I have been looking into how we can incorporate this into our adapter, so that the end-user doesn't have to add this.

I have been looking at the documentation Jest Watch-Plugins and noted that in the defined whitelist for configuration options that can be set, does not include watchPathIgnorePatterns

Is this something that has purposely been omitted, or is it something that we would be able to support?

Additionally, prior to a full test run, we delete all of the generated *.json files to avoid any clashes with previous test runs. In watch mode, we may only change one file, and therefore only want to delete the corresponding json file to the test, and not every single one. Is this something we can do

  • test1.(js|ts)
  • test2.(js|ts)
  • test3.(js|ts)

Results in

  • test1.json
  • test2.json
  • test3.json

If only test3 is updated, and therefore picked up by jest --watch, I would like to only delete test3.json

I need to dig further into the watch-plugin docs and some existing watch plugins, but thought it would be good to ask here as a first port of call, as it may not be something supported at the moment.

Many thanks for any help or advise!

Existing watch plugins

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions