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

chore: update type definitions for coverageReporters #10275

Merged
merged 2 commits into from Jul 30, 2020

Conversation

@not-a-doctor
Copy link
Contributor

not-a-doctor commented Jul 14, 2020

Summary

import { Config } from '@jest/types';

const config: Config.InitialOptions = {
  coverageReporters: ['html', { subdir: 'dir' }] // typing error
}

Typing the config object as Config.InitialOptions resulted in error, because coverageReporters property in Config.InitialOptions was listed as an array of strings.

Test plan

Since there is only a change in typing precision, there is none.

@facebook-github-bot
Copy link
Contributor

facebook-github-bot commented Jul 14, 2020

Hi @not-a-doctor!

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file.

In order for us to review and merge your code, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@not-a-doctor not-a-doctor force-pushed the not-a-doctor:istanbul-reporters-typing branch 2 times, most recently from f37b3c2 to b057851 Jul 14, 2020
@facebook-github-bot
Copy link
Contributor

facebook-github-bot commented Jul 14, 2020

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@@ -193,7 +193,7 @@ Indicates which provider should be used to instrument code for coverage. Allowed

Note that using `v8` is considered experimental. This uses V8's builtin code coverage rather than one based on Babel. It is not as well tested, and it has also improved in the last few releases of Node. Using the latest versions of node (v14 at the time of this writing) will yield better results.

### `coverageReporters` [array\<string | [string,any]>]
### `coverageReporters` [CoverageReporters]

This comment has been minimized.

@SimenB

SimenB Jul 15, 2020 Collaborator

This type is not defined in the docs, do you think it'll be confusing for users?

This comment has been minimized.

@not-a-doctor

not-a-doctor Jul 15, 2020 Author Contributor

I did hesitate a bit editing this line because of the reason you've mentioned. I then searched docs and here in the file we also have a ProjectConfig type in a signature and as "projects" config field definition, although it is not "defined" itself.

Several combinations of options shape make it tedious to list and not pleasant to maintain; and [string, any] type is not quite correct as we are about to become limited to these shapes. While I decided to use the custom TS type, it still is not terrible to leave it as it were before, imo. So what do you think?

This comment has been minimized.

@SimenB

SimenB Jul 15, 2020 Collaborator

We could link to the types (code)?

This comment has been minimized.

@not-a-doctor

not-a-doctor Jul 15, 2020 Author Contributor

thanks for the tip, done.

@not-a-doctor not-a-doctor force-pushed the not-a-doctor:istanbul-reporters-typing branch from b057851 to bc517c1 Jul 15, 2020
@SimenB
SimenB approved these changes Jul 28, 2020
Copy link
Collaborator

SimenB left a comment

Can you update the versioned docs as well?

docs/Configuration.md Outdated Show resolved Hide resolved
@SimenB SimenB changed the title chore: update type definitions for coverageReporters; chore: update type definitions for coverageReporters Jul 30, 2020
@SimenB SimenB merged commit e3f4f93 into facebook:master Jul 30, 2020
16 of 23 checks passed
16 of 23 checks passed
cleanup-runs
Details
Running TypeScript compiler & ESLint
Details
Node v10.x on ubuntu-latest
Details
Node v10.x on macOS-latest
Details
Node v10.x on windows-latest
Details
Node v12.x on ubuntu-latest
Details
Node v12.x on macOS-latest
Details
Node v12.x on windows-latest
Details
Node v13.x on ubuntu-latest
Details
Node v13.x on macOS-latest
Details
Node v13.x on windows-latest
Details
Node v14.x on ubuntu-latest
Details
Node v14.x on macOS-latest
Details
Node v14.x on windows-latest
Details
ci/circleci: test-jest-circus CircleCI is running your tests
Details
ci/circleci: test-node-10 CircleCI is running your tests
Details
ci/circleci: test-node-12 CircleCI is running your tests
Details
ci/circleci: test-node-13 CircleCI is running your tests
Details
ci/circleci: test-node-14 CircleCI is running your tests
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
facebook.jest queued
Details
Facebook CLA Check Contributor License Agreement is valid!
Details
ci/circleci: test-or-deploy-website Your tests passed on CircleCI!
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.