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

Bug: typeCoverage config not working #5

Closed
tsaiDavid opened this issue Mar 25, 2020 · 12 comments · Fixed by #31
Closed

Bug: typeCoverage config not working #5

tsaiDavid opened this issue Mar 25, 2020 · 12 comments · Fixed by #31
Assignees
Labels
bug Something isn't working good first issue Good for newcomers
Milestone

Comments

@tsaiDavid
Copy link
Contributor

Describe the bug

In the provided example, I am expecting the tool to fail since the expected actual coverage is 92%, and my provided minimum is 99%. This works when using the CLI option, but not when using the typeCoverage property in package.json.

Provided config:

  "typeCoverage": {
    "atLeast": 99
  },

CLI output when using typeCoverage (wrong behavior):

image

CLI output when using --threshold option (expected behavior):
image

As a side note, noticed the cache option to generate .ts-coverage does not seem to work either, I suspect it may be related.

To Reproduce
See: https://codesandbox.io/s/crazy-sound-ujkcu

You can export the CodeSandbox as a zip and run locally after yarn install.

image

Expected behaviour
Using typeCoverage should have parity with typescript-coverage-report CLI options.

Screenshots
N/A

Environment

  • Tool version: 0.1.1
  • OS: MacOS 10.15.3
  • Node version: 12 LTS
  • Browser (if applicable): [e.g. chrome, safari]

Additional context
N/A

@tsaiDavid tsaiDavid added the bug Something isn't working label Mar 25, 2020
@tsaiDavid
Copy link
Contributor Author

@alexcanessa - I can try taking a stab at this

@tsaiDavid
Copy link
Contributor Author

@alexcanessa - PR is now open, looks like it will need some more work if you'd also like to see the ability to essentially "pass-through" any options that type-coverage supports.

@alexcanessa
Copy link
Owner

Nice.

For now, it only gets strict and debug, manually set. Otherwise, that's the complete Option type:

interface LintOptions {
    debug: boolean;
    files?: string[];
    oldProgram?: ts.Program;
    strict: boolean;
    enableCache: boolean;
    ignoreCatch: boolean;
    ignoreFiles?: string | string[];
    fileCounts: boolean;
    absolutePath?: boolean;
}

I think we could have a separate issue for tracking separate options 🤷‍♂

@tsaiDavid
Copy link
Contributor Author

Gotcha, that's not a bad idea - would make it easier to incrementally add those in if people seem to want to use it. Feel free to make changes where needed to this PR too!

Side note: How do you feel about adding all-contributors? 😬

@alexcanessa
Copy link
Owner

@tsaiDavid ha of course

@alexcanessa
Copy link
Owner

@all-contributors add @tsaiDavid for bug

@allcontributors
Copy link
Contributor

@alexcanessa

I've put up a pull request to add @tsaiDavid! 🎉

@alexcanessa alexcanessa modified the milestone: v0.1.3 Mar 29, 2020
@danvk
Copy link
Contributor

danvk commented Oct 19, 2020

+1 to this! I added an ignoreUnread option to type-coverage recently and would like to use it with typescript-coverage-report.

@alexcanessa alexcanessa self-assigned this Nov 8, 2020
@alexcanessa alexcanessa added this to the v0.3.0 milestone Nov 8, 2020
@alexcanessa alexcanessa added enhancement New feature or request bug Something isn't working and removed bug Something isn't working enhancement New feature or request labels Nov 8, 2020
@alexcanessa
Copy link
Owner

@danvk I just released this as part of v0.3.0

@danvk
Copy link
Contributor

danvk commented Nov 9, 2020

Hi @alexcanessa I tried the ignoreUnread option this morning and I'm not sure it's working.

In package.json:

{
  "typeCoverage": {
    "ignoreCatch": true,
    "ignoreUnread": true
  }
}

If I run:

$ yarn type-coverage
58871 / 59260 99.34%

But with type-coverage-report, I see:

image

The difference is because ignore-unread isn't being used:

image

When I run yarn type-coverage with --details, those symbols are not included (because they aren't read).

$ yarn type-coverage --version
Version: 2.14.0
$ yarn typescript-coverage-report --version
0.3.0

@alexcanessa
Copy link
Owner

@danvk interesting. That's quite weird.

@alexcanessa
Copy link
Owner

@danvk I got the problem, forgot to add one thing 🙈

Please track this on #33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants