Skip to content

[Bug] Code coverage threshold doesn't work in monorepo setup #46

Open

Description

Describe the Bug

Tests do not fail in the terminal when using the --coverage flag because the .nycrc file is not being recognized.

I have an Nx monorepo with a separate app for Storybook. The Storybook configuration and .nycrc configuration file are located in this app.

It works correctly if:

  1. The .nycrc file is in the workspace root.
  2. The current working directory (cwd) is explicitly set to the Storybook app.

However, neither of these approaches fit the desired architecture.

After investigation, it seems that the loadNycConfig function does not receive the .nycrcPath and cwd parameters when creating a report or checking the threshold. These parameters are passed elsewhere but not here.

If you have any questions, please feel free to ask :)

Steps to Reproduce

  1. Create a monorepo.
  2. Create an app with Storybook configuration.
  3. In .storybook/main.ts, add .nycrcPath to the coverage configuration.
  4. Run test-storybook with the --coverage flag.

Expected Behavior

The .nycrc file path should be correctly recognized, and tests should fail if they do not meet the coverage threshold.

Environment

  • OS: macOS 14.1
  • Node.js version: 20.1
  • NPM version: 10.2.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions