Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Roll up coverageThresholds set in project configs #6998

Closed
wldcordeiro opened this issue Sep 19, 2018 · 6 comments
Closed

Roll up coverageThresholds set in project configs #6998

wldcordeiro opened this issue Sep 19, 2018 · 6 comments

Comments

@wldcordeiro
Copy link

🚀 Feature Proposal

Roll up the coverageThresholds config blocks from projects to work like you had added the projects to the coverageThresholds paths.

Motivation

Allowing users to configure their project thresholds individually and rolling up is a lot like what is already in place for configuring thresholds, only it would be more convenient with how projects are used.

Example

jest.config.js

module.exports = {
  collectCoverage: true,
  collectCoverageFrom: ['**/src/**/*.js'],
  coverageThreshold: {
    global: {
      statements: 78,
      branches: 65,
      functions: 70,
      lines: 70,
    },
  },
  projects: ['packages/*/jest.config.js'],
  watchPlugins: [
    'jest-watch-typeahead/filename',
    'jest-watch-typeahead/testname',
  ],
};

packages/a/jest.config.js

const { resolve } = require('path');
const base = require('@cnc/config/jest/jest.config');

const rootDir = resolve(__dirname);

module.exports = {
  collectCoverageFrom: ['**/src/**/*.js'],
  transform: {
    '^.+\\.jsx?$': resolve(__dirname, 'babel-transform.js'),
    '.*': '@brimstone/jest-static-assets-mocker',
  },
  snapshotSerializers: ['@wldcordeiro-stuffz/snapshot-diff-serializer'],
  testURL: 'http://localhost',
  watchPlugins: [
    'jest-watch-typeahead/filename',
    'jest-watch-typeahead/testname',
  ],
  rootDir,
  displayName: 'breadcrumb tests',
  setupTestFrameworkScriptFile: './test-setup.js',
  coverageThreshold: {
    global: {
      statements: 100,
      branches: 100,
      functions: 100,
      lines: 100,
    },
  },
};

packages/b/jest.config.js

const { resolve } = require('path');
const base = require('@cnc/config/jest/jest.config');

const rootDir = resolve(__dirname);

module.exports = {
  collectCoverageFrom: ['**/src/**/*.js'],
  transform: {
    '^.+\\.jsx?$': resolve(__dirname, 'babel-transform.js'),
    '.*': '@brimstone/jest-static-assets-mocker',
  },
  snapshotSerializers: ['@wldcordeiro-stuffz/snapshot-diff-serializer'],
  testURL: 'http://localhost',
  watchPlugins: [
    'jest-watch-typeahead/filename',
    'jest-watch-typeahead/testname',
  ],
  rootDir,
  displayName: 'breadcrumb tests',
  setupTestFrameworkScriptFile: './test-setup.js',
  coverageThreshold: {
    global: {
      statements: 100,
      branches: 100,
      functions: 100,
      lines: 100,
    },
  },
};

Pitch

You can already go into your root configuration and define thresholds on a per path/file basis, this would be similar only it would allow for each package in a monorepo to define a threshold close to itself.

@wldcordeiro
Copy link
Author

@rickhanlonii @SimenB anyone? This seems like something that should work with the projects feature. 🤔

@rickhanlonii
Copy link
Member

@wldcordeiro sorry for the delay!

This makes a ton of sense to me, are you interested in submitting the PR?

@wldcordeiro
Copy link
Author

@rickhanlonii I would be, I think I'd need some help though as I haven't done any coding in the Jest codebase before.

General questions:

  • Do I need to get the CLA signed?
  • What packages would I work on this change in?
  • Are there any PRs I could use as a "template" for how to best contribute?

I want to get off on the right foot here and make things as easy for maintainer to review once I have a PR ready.

@github-actions
Copy link

This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions github-actions bot added the Stale label Feb 25, 2022
@github-actions
Copy link

This issue was closed because it has been stalled for 7 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.

@github-actions
Copy link

github-actions bot commented May 1, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants