jest-coverage-report-action icon indicating copy to clipboard operation
jest-coverage-report-action copied to clipboard

Parse threshold information from jest configuration in 'package.json'

Open ArtiomTr opened this issue 3 years ago • 6 comments

Idea

Action should parse threshold information not only from jest.config.* files, but also from package.json.

Description

The schema of jest configuration in package.json file is described here

Additional context

Originally described in #223 issue.

ArtiomTr avatar Jan 31 '22 10:01 ArtiomTr

This would be great to have @ArtiomTr - adding to it, maybe there's a way to configure the path to the jest.config.* file so that one can also use this action on multiple directories within a npm workspace monorepo setup?

Thanks for all your work with this! Cheers

tobiasbueschel avatar Feb 21 '22 16:02 tobiasbueschel

Hello @tobiasbueschel :wave:,

There is an option working-directory. Is this option what you are looking for?

ArtiomTr avatar Feb 21 '22 17:02 ArtiomTr

I'm glad this has been suggested as it's a problem I'm encountering. Specifically, in my case, the config in package.json is for a Create React App:

{
  "jest": {
    "watchPathIgnorePatterns": [
      "<rootDir>\\/src\\/(.+\\/)+.+\\.stories\\.tsx"
    ],
    "collectCoverageFrom": [
      "<rootDir>/src/pages/**/*.+(ts|tsx|js)",
      "<rootDir>/src/components/**/*.+(ts|tsx|js)",
      "!<rootDir>/src/**/*.style.+(tsx)",
      "!<rootDir>/src/**/*.stories.+(tsx)",
      "!<rootDir>/src/**/*.index.+(tsx)"
    ],
    "coverageReporters": [
      "text",
      "text-summary"
    ]
  }
}

grahammcculloch avatar Feb 23 '22 21:02 grahammcculloch

@grahammcculloch,

Sorry, I just now realized how vague this issue is. This issue is not about parsing jest configuration, it is about taking threshold information from the jest configuration, because action should show clear message, when threshold values are not met.

This action don't use any jest configuration to actually run tests, it simply runs the script, which is specified as test-script input (here is the docs link). So if jest not takes information from package.json file, it is most likely that something is wrong with your test-script option.

ArtiomTr avatar Mar 05 '22 11:03 ArtiomTr

+1 I'm trying to use this action in a NestJS project , all jest configuration is in package.json

MarcosRava avatar Mar 21 '22 01:03 MarcosRava

bump +1 for CRA

simplewepro avatar May 12 '22 23:05 simplewepro