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

feat(jest): Add ./global-types as an alias to ./index #51587

Closed
wants to merge 6 commits into from

Conversation

qnighy
Copy link
Contributor

@qnighy qnighy commented Mar 6, 2021

Please fill in this template.

Select one of these and delete the others:

If changing an existing definition:

  • Provide a URL to documentation or source code which provides context for the suggested changes: chore: migrate jest-cli to TypeScript jestjs/jest#8024
  • If this PR brings the type definitions up to date with a new version of the JS library, update the version number in the header.

Starting from jest v24.3.0, the jest package provides its own type definition.
@types/jest now serves a different purpose than that; it declares global variables injeced by jest, rather than jest's own API.

Unfortunately, that led to types: ["jest"] being resolved to the jest package, causing problems when typeRoots is configured. (example repository)

This file enables users to specify types: ["jest/global-types"] in tsconfig.json to clarify their intention.

@typescript-bot typescript-bot added Critical package Untested Change This PR does not touch tests labels Mar 6, 2021
@typescript-bot typescript-bot added this to Waiting for Code Reviews in New Pull Request Status Board Mar 6, 2021
@typescript-bot
Copy link
Contributor

typescript-bot commented Mar 6, 2021

@qnighy Thank you for submitting this PR!

This is a live comment which I will keep updated.

1 package in this PR

Code Reviews

Because this is a widely-used package, a DT maintainer will need to review it before it can be merged.

Status

  • ✅ No merge conflicts
  • ❌ Continuous integration tests have failed
  • 🕐 A DT maintainer needs to approve changes which affect module config files

Once every item on this list is checked, I'll ask you for permission to merge and publish the changes.

Inactive

This PR has been inactive for 31 days — it is considered abandoned, and therefore closed!


Diagnostic Information: What the bot saw about this PR
{
  "type": "info",
  "now": "-",
  "pr_number": 51587,
  "author": "qnighy",
  "headCommitOid": "614b1fd722239dbcc99d3e8223f2bd79fd0a502c",
  "lastPushDate": "2021-03-07T04:23:50.000Z",
  "lastActivityDate": "2021-03-07T04:23:50.000Z",
  "maintainerBlessed": false,
  "hasMergeConflict": false,
  "isFirstContribution": false,
  "popularityLevel": "Critical",
  "pkgInfo": [
    {
      "name": "jest",
      "kind": "edit",
      "files": [
        {
          "path": "types/jest/global-types.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/jest/test/global-types-tests.ts",
          "kind": "test"
        },
        {
          "path": "types/jest/tsconfig.json",
          "kind": "package-meta-ok"
        },
        {
          "path": "types/jest/tslint.json",
          "kind": "package-meta",
          "suspect": "not [the expected form](https://github.com/DefinitelyTyped/DefinitelyTyped#user-content-linter-tslintjson) and not moving towards it"
        }
      ],
      "owners": [
        "NoHomey",
        "jwbay",
        "asvetliakov",
        "alexjoverm",
        "epicallan",
        "ikatyang",
        "wsmd",
        "JamieMason",
        "douglasduteil",
        "ahnpnl",
        "joshuakgoldberg",
        "UselessPickles",
        "r3nya",
        "hotell",
        "sebald",
        "andys8",
        "antoinebrault",
        "gstamac",
        "ExE-Boss",
        "quassnoi",
        "Belco90",
        "tonyhallett",
        "ycmjason",
        "devanshj",
        "pawfa",
        "regevbr",
        "gerkindev"
      ],
      "addedOwners": [],
      "deletedOwners": [],
      "popularityLevel": "Critical"
    }
  ],
  "reviews": [
    {
      "type": "stale",
      "reviewer": "ExE-Boss",
      "date": "2021-03-06T09:55:15.000Z",
      "abbrOid": "bc106a5"
    }
  ],
  "ciResult": "fail",
  "ciUrl": "https://github.com/DefinitelyTyped/DefinitelyTyped/commit/614b1fd722239dbcc99d3e8223f2bd79fd0a502c/checks?check_suite_id=2196263734"
}

@typescript-bot
Copy link
Contributor

🔔 @NoHomey @jwbay @asvetliakov @alexjoverm @epicallan @ikatyang @wsmd @JamieMason @douglasduteil @ahnpnl @JoshuaKGoldberg @UselessPickles @r3nya @Hotell @sebald @andys8 @antoinebrault @gstamac @ExE-Boss @quassnoi @Belco90 @tonyhallett @ycmjason @devanshj @pawfa @regevbr @GerkinDev — please review this PR in the next few days. Be sure to explicitly select Approve or Request Changes in the GitHub UI so I know what's going on.

@typescript-bot typescript-bot added Check Config Changes a module config files and removed Untested Change This PR does not touch tests labels Mar 6, 2021
@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Maintainer Review in New Pull Request Status Board Mar 6, 2021
@typescript-bot
Copy link
Contributor

👋 Hi there! I’ve run some quick measurements against master and your PR. These metrics should help the humans reviewing this PR gauge whether it might negatively affect compile times or editor responsiveness for users who install these typings.

Let’s review the numbers, shall we?

Comparison details 📊
master #51587 diff
Batch compilation
Memory usage (MiB) 89.0 90.0 +1.2%
Type count 15483 15488 0%
Assignability cache size 5055 5057 0%
Language service
Samples taken 2612 2612 0%
Identifiers in tests 2612 2615 0%
getCompletionsAtPosition
    Mean duration (ms) 433.5 436.6 +0.7%
    Mean CV 6.8% 6.5%
    Worst duration (ms) 600.6 646.9 +7.7%
    Worst identifier toBe toBe
getQuickInfoAtPosition
    Mean duration (ms) 436.4 440.6 +0.9%
    Mean CV 7.4% 7.3%
    Worst duration (ms) 575.6 612.2 +6.4%
    Worst identifier expect callback

It looks like nothing changed too much. I won’t post performance data again unless it gets worse.

@typescript-bot typescript-bot added the Perf: Same typescript-bot determined that this PR will not significantly impact compilation performance. label Mar 6, 2021
Copy link
Contributor

@ExE-Boss ExE-Boss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import "./index" doesn’t work in JavaScript: #43315

// This file enables users to specify `types: ["jest/global-types"]` in tsconfig.json
// to clarify their intention.

import "./index";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import "./index";
/// <reference path="./index.d.ts"/>

@@ -0,0 +1,5 @@
import "./global-types";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import "./global-types";
/// <reference types="jest/global-types.d.ts"/>

@@ -0,0 +1 @@
global-types.d.ts
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
global-types.d.ts

Comment on lines 19 to 21
"index.d.ts",
"jest-tests.ts"
"jest-tests.ts",
"test/global-types-tests.ts"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"index.d.ts",
"jest-tests.ts"
"jest-tests.ts",
"test/global-types-tests.ts"
"jest-tests.ts",
"test/global-types.ts",
"index.d.ts"

@typescript-bot typescript-bot added the Revision needed This PR needs code changes before it can be merged. label Mar 6, 2021
@typescript-bot typescript-bot moved this from Needs Maintainer Review to Needs Author Action in New Pull Request Status Board Mar 6, 2021
@typescript-bot
Copy link
Contributor

@qnighy One or more reviewers has requested changes. Please address their comments. I'll be back once they sign off or you've pushed new commits. Thank you!

@typescript-bot typescript-bot added the The CI failed When GH Actions fails label Mar 7, 2021
@typescript-bot
Copy link
Contributor

@qnighy The CI build failed! Please review the logs for more information.

Once you've pushed the fixes, the build will automatically re-run. Thanks!

@typescript-bot typescript-bot removed the Revision needed This PR needs code changes before it can be merged. label Mar 7, 2021
@typescript-bot typescript-bot added the Abandoned This PR had no activity for a long time, and is considered abandoned label Mar 30, 2021
@typescript-bot
Copy link
Contributor

@qnighy I haven't seen any activity on this PR in more than three weeks, and it still has problems that prevent it from being merged. The PR will be closed on Apr 6th (in a week) if the issues aren't addressed.

@typescript-bot typescript-bot removed this from Needs Author Action in New Pull Request Status Board Apr 7, 2021
@typescript-bot
Copy link
Contributor

@qnighy To keep things tidy, we have to close PRs that aren't mergeable and don't have activity in the last month. No worries, though — please open a new PR if you'd like to continue with this change. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Abandoned This PR had no activity for a long time, and is considered abandoned Check Config Changes a module config files Critical package Perf: Same typescript-bot determined that this PR will not significantly impact compilation performance. The CI failed When GH Actions fails
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants