Skip to content

Specifying multiple collectCoverageFrom paths #5198

@satazor

Description

@satazor

Do you want to request a feature or report a bug?

bug

What is the current behavior?

Calling:

jest --collectCoverageFrom foo/**/*.js bar/**/*.js

Does not assume both patterns as collectCoverageFrom. Though, this works:

jest --collectCoverageFrom foo/**/*.js --collectCoverageFrom bar/**/*.js
jest --collectCoverageFrom '["foo/**/*.js", "bar/**/*.js"]'

If the current behavior is a bug, please provide the steps to reproduce and
either a repl.it demo through https://repl.it/languages/jest or a minimal
repository on GitHub that we can yarn install and yarn test.

See above.

What is the expected behavior?

The expected behavior is that the first form should work. The current behavior is inconsistent with collectCoverageOnlyFrom and many other options. This is due to the collectCoverageFrom type being a string instead of an array, see https://github.com/facebook/jest/blob/8549900b8e98d5cf6c9983cdd34d4a089c9f2bed/packages/jest-cli/src/cli/args.js#L143.

Please provide your exact Jest configuration and mention your Jest, node,
yarn/npm version and operating system.

The jest configuration does not apply here.

Jest 22.0.0
Node: 8.9.3
npm: 5.6.0
OS: Mac

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions