How to write a Jest configuration file

后端 未结 5 1012
我在风中等你
我在风中等你 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:55

    The docs were updated to explain the configuration. Here is the link for anyone looking for more information:

    https://facebook.github.io/jest/docs/en/configuration.html#content

    The gist:

    If using the --config to direct jest to your configuration json file, you only put the JSON information in the file without the "jest" keyword.

    // config.json at 
    {
       "verbose": true
    }
    

    If you want to use the package.json to configure jest, add the "jest" key and then your configuration.

    // package.json 
    { 
       "name": "packageName",
       "version": "1.0.0",
       "jest": {
         "verbose": true
       }
    }
    

提交回复
热议问题