How to write a Jest configuration file

后端 未结 5 1053
我在风中等你
我在风中等你 2021-02-02 07:17

I am trying to pass along a configuration file to Jest in order to run tests only from a given directory.

According to documentation, you can use config.testPathDi

5条回答
  •  天命终不由人
    2021-02-02 07:42

    For JEST V20+:

    {
     "roots": ["__tests__/"]
    }
    

    For v 20-, you will get following warning if you use testPathDirs:

    Deprecation Warning:

    Option "testPathDirs" was replaced by "roots".

    Jest now treats your current configuration as: { "roots": ["tests/unit/"] }

    Please update your configuration.

提交回复
热议问题