question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:9
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
ArtiomTrcommented, Mar 5, 2022

@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.

1reaction
grahammccullochcommented, Feb 23, 2022

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"
    ]
  }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuring Jest
This will be used to configure minimum threshold enforcement for coverage results. Thresholds can be specified as global , as a glob, and...
Read more >
Configuring package.json · Jest
This config option lets you customize where Jest stores that cache data on disk.
Read more >
Configuring Jest compiled - w3resource
In this tutorial we will focus on configuring Jest. Jest's configuration can be defined inside the package.json file of your project, ...
Read more >
How to set coverageThreshold with CLI · Issue #7509 - GitHub
The argument should be a JSON string, but the below command always doesn't work. jest --coverage --coverageThreshold='{\"global\":{\"branches\": ...
Read more >
Configuring code coverage in Jest, the right way
coverageThreshold. As a good starting point for any project, here's a minimal package.json configuration on which you can build up (Jest can ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found