Skip to content

[testing-library] create @testing-library/* definitions#37606

Merged
johnnyreilly merged 7 commits intoDefinitelyTyped:masterfrom
alexkrolick:testing-lib
Aug 15, 2019
Merged

[testing-library] create @testing-library/* definitions#37606
johnnyreilly merged 7 commits intoDefinitelyTyped:masterfrom
alexkrolick:testing-lib

Conversation

@alexkrolick
Copy link
Copy Markdown
Contributor

@alexkrolick alexkrolick commented Aug 14, 2019

Please fill in this template.

  • Use a meaningful title for the pull request. Include the name of the package modified.
  • Test the change in your own code. (Compile and run.)
  • Add or edit tests to reflect the change. (Run with npm test.)
  • Follow the advice from the readme.
  • Avoid common mistakes.
  • Run npm run lint package-name (or tsc if no tslint.json is present).

Select one of these and delete the others:

If adding a new definition:

  • The package does not already provide its own types, or cannot have its .d.ts files generated via --declaration
  • If this is for an NPM package, match the name. If not, do not conflict with the name of an NPM package.
  • Create it with dts-gen --dt, not by basing it on an existing project.
  • tslint.json should be present, and tsconfig.json should have noImplicitAny, noImplicitThis, strictNullChecks, and strictFunctionTypes set to true.

@typescript-bot
Copy link
Copy Markdown
Contributor

typescript-bot commented Aug 14, 2019

@alexkrolick Thank you for submitting this PR!

Because this is a new definition, a DefinitelyTyped maintainer will be reviewing this PR in the next few days once the Travis CI build passes.

In the meantime, if the build fails or a merge conflict occurs, I'll let you know. Have a nice day!

@typescript-bot
Copy link
Copy Markdown
Contributor

typescript-bot commented Aug 14, 2019

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

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

* fix(lint): Fix lint issues for `@testing-library/dom`

* fix(lint): Fix lint issues in `@testing-library/react`

* chore(format): Format `@testing-library/react`

* chore(format): Format `@testing-library/dom`

* chore: Add `@eps1lon` as collaborator
@typescript-bot
Copy link
Copy Markdown
Contributor

👋 Hi there! I’ve run some quick performance metrics against master and your PR. This is still an experiment, so don’t panic if I say something crazy! I’m still learning how to interpret these metrics.

Let’s review the numbers, shall we?

testing-library__dom/v6

These typings are for a package that doesn’t yet exist on master, so I don’t have anything to compare against yet! In the future, I’ll be able to compare PRs to testing-library__dom with its source on master.

Comparison details for testing-library__dom/v6 📊
Batch compilation
Type count 10115
Assignability cache size 33916
Subtype cache size 0
Identity cache size 3
Language service measurements
Samples taken 24
Identifiers in tests 24
getCompletionsAtPosition
    Mean duration (ms) 391.9
    Median duration (ms) 386.1
    Mean CV 13.9%
    Worst duration (ms) 479.7
    Worst identifier element
getQuickInfoAtPosition
    Mean duration (ms) 370.2
    Median duration (ms) 368.5
    Mean CV 12.3%
    Worst duration (ms) 425.9
    Worst identifier findAllByText
System information
Node version v10.16.1
CPU count 2
CPU speed 2.397 GHz
CPU model Intel(R) Xeon(R) CPU E5-2673 v3 @ 2.40GHz
CPU Architecture x64
Memory 6.8 GiB
Platform linux
Release 4.15.0-1052-azure

testing-library__react/v9

These typings are for a package that doesn’t yet exist on master, so I don’t have anything to compare against yet! In the future, I’ll be able to compare PRs to testing-library__react with its source on master.

Comparison details for testing-library__react/v9 📊
Batch compilation
Type count 52278
Assignability cache size 52517
Subtype cache size 5
Identity cache size 6
Language service measurements
Samples taken 39
Identifiers in tests 39
getCompletionsAtPosition
    Mean duration (ms) 699.7
    Median duration (ms) 690.9
    Mean CV 8.0%
    Worst duration (ms) 792.5
    Worst identifier div
getQuickInfoAtPosition
    Mean duration (ms) 594.0
    Median duration (ms) 585.1
    Mean CV 9.7%
    Worst duration (ms) 684.5
    Worst identifier container
System information
Node version v10.16.1
CPU count 2
CPU speed 2.397 GHz
CPU model Intel(R) Xeon(R) CPU E5-2673 v3 @ 2.40GHz
CPU Architecture x64
Memory 6.8 GiB
Platform linux
Release 4.15.0-1052-azure

If you have any questions or comments about me, you can ping @andrewbranch. Have a nice day!

@typescript-bot
Copy link
Copy Markdown
Contributor

typescript-bot commented Aug 14, 2019

@alexkrolick The Travis 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
Copy link
Copy Markdown
Contributor

Updated numbers for you here from 28f6ff8:

testing-library__dom/v6

These typings are for a package that doesn’t yet exist on master, so I don’t have anything to compare against yet! In the future, I’ll be able to compare PRs to testing-library__dom with its source on master.

Comparison details for testing-library__dom/v6 📊
Batch compilation
Type count 10115
Assignability cache size 33916
Subtype cache size 0
Identity cache size 3
Language service measurements
Samples taken 24
Identifiers in tests 24
getCompletionsAtPosition
    Mean duration (ms) 382.6
    Median duration (ms) 378.2
    Mean CV 13.1%
    Worst duration (ms) 471.8
    Worst identifier element
getQuickInfoAtPosition
    Mean duration (ms) 357.3
    Median duration (ms) 354.3
    Mean CV 13.8%
    Worst duration (ms) 404.5
    Worst identifier getAllByText
System information
Node version v10.16.1
CPU count 2
CPU speed 2.394 GHz
CPU model Intel(R) Xeon(R) CPU E5-2673 v3 @ 2.40GHz
CPU Architecture x64
Memory 6.8 GiB
Platform linux
Release 4.15.0-1052-azure

testing-library__react/v9

These typings are for a package that doesn’t yet exist on master, so I don’t have anything to compare against yet! In the future, I’ll be able to compare PRs to testing-library__react with its source on master.

Comparison details for testing-library__react/v9 📊
Batch compilation
Type count 52278
Assignability cache size 52517
Subtype cache size 5
Identity cache size 6
Language service measurements
Samples taken 39
Identifiers in tests 39
getCompletionsAtPosition
    Mean duration (ms) 685.7
    Median duration (ms) 679.5
    Mean CV 8.7%
    Worst duration (ms) 841.2
    Worst identifier container
getQuickInfoAtPosition
    Mean duration (ms) 588.7
    Median duration (ms) 583.0
    Mean CV 9.6%
    Worst duration (ms) 697.8
    Worst identifier findByText
System information
Node version v10.16.1
CPU count 2
CPU speed 2.394 GHz
CPU model Intel(R) Xeon(R) CPU E5-2673 v3 @ 2.40GHz
CPU Architecture x64
Memory 6.8 GiB
Platform linux
Release 4.15.0-1052-azure

@typescript-bot
Copy link
Copy Markdown
Contributor

typescript-bot commented Aug 14, 2019

@alexkrolick The Travis 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
Copy link
Copy Markdown
Contributor

Updated numbers for you here from 0c9a05f:

testing-library__dom/v6

These typings are for a package that doesn’t yet exist on master, so I don’t have anything to compare against yet! In the future, I’ll be able to compare PRs to testing-library__dom with its source on master.

Comparison details for testing-library__dom/v6 📊
Batch compilation
Type count 10115
Assignability cache size 33916
Subtype cache size 0
Identity cache size 3
Language service measurements
Samples taken 24
Identifiers in tests 24
getCompletionsAtPosition
    Mean duration (ms) 387.6
    Median duration (ms) 386.6
    Mean CV 13.2%
    Worst duration (ms) 430.9
    Worst identifier element
getQuickInfoAtPosition
    Mean duration (ms) 366.5
    Median duration (ms) 367.7
    Mean CV 11.5%
    Worst duration (ms) 410.6
    Worst identifier getByText
System information
Node version v10.16.1
CPU count 2
CPU speed 2.397 GHz
CPU model Intel(R) Xeon(R) CPU E5-2673 v3 @ 2.40GHz
CPU Architecture x64
Memory 6.8 GiB
Platform linux
Release 4.15.0-1052-azure

testing-library__react/v9

These typings are for a package that doesn’t yet exist on master, so I don’t have anything to compare against yet! In the future, I’ll be able to compare PRs to testing-library__react with its source on master.

Comparison details for testing-library__react/v9 📊
Batch compilation
Type count 52278
Assignability cache size 52517
Subtype cache size 5
Identity cache size 6
Language service measurements
Samples taken 39
Identifiers in tests 39
getCompletionsAtPosition
    Mean duration (ms) 677.2
    Median duration (ms) 671.2
    Mean CV 11.0%
    Worst duration (ms) 822.7
    Worst identifier container
getQuickInfoAtPosition
    Mean duration (ms) 605.2
    Median duration (ms) 599.2
    Mean CV 11.2%
    Worst duration (ms) 669.6
    Worst identifier page
System information
Node version v10.16.1
CPU count 2
CPU speed 2.397 GHz
CPU model Intel(R) Xeon(R) CPU E5-2673 v3 @ 2.40GHz
CPU Architecture x64
Memory 6.8 GiB
Platform linux
Release 4.15.0-1052-azure

@johnnyreilly
Copy link
Copy Markdown
Member

This PR is marked as draft - is it ready for review? Also @weyert did you want to add your name to the header so you get notifications about this package?

* chore: Added my name

* chore: Added me

* chore: Hooks

* chore: Hooks

* Update index.d.ts
@alexkrolick alexkrolick marked this pull request as ready for review August 15, 2019 04:32
@alexkrolick
Copy link
Copy Markdown
Contributor Author

@johnnyreilly looks like we are ready for the review!

cc @kentcdodds @weyert @eps1lon

@typescript-bot
Copy link
Copy Markdown
Contributor

Updated numbers for you here from 5e806bc:

testing-library__dom/v6

These typings are for a package that doesn’t yet exist on master, so I don’t have anything to compare against yet! In the future, I’ll be able to compare PRs to testing-library__dom with its source on master.

Comparison details for testing-library__dom/v6 📊
Batch compilation
Type count 10115
Assignability cache size 33916
Subtype cache size 0
Identity cache size 3
Language service measurements
Samples taken 24
Identifiers in tests 24
getCompletionsAtPosition
    Mean duration (ms) 422.2
    Median duration (ms) 419.5
    Mean CV 13.8%
    Worst duration (ms) 513.1
    Worst identifier element
getQuickInfoAtPosition
    Mean duration (ms) 410.9
    Median duration (ms) 406.5
    Mean CV 13.3%
    Worst duration (ms) 456.5
    Worst identifier queryAllByText
System information
Node version v10.16.1
CPU count 2
CPU speed 2.294 GHz
CPU model Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz
CPU Architecture x64
Memory 6.8 GiB
Platform linux
Release 4.15.0-1052-azure

testing-library__react/v9

These typings are for a package that doesn’t yet exist on master, so I don’t have anything to compare against yet! In the future, I’ll be able to compare PRs to testing-library__react with its source on master.

Comparison details for testing-library__react/v9 📊
Batch compilation
Type count 52278
Assignability cache size 52517
Subtype cache size 5
Identity cache size 6
Language service measurements
Samples taken 39
Identifiers in tests 39
getCompletionsAtPosition
    Mean duration (ms) 752.0
    Median duration (ms) 759.1
    Mean CV 9.3%
    Worst duration (ms) 877.0
    Worst identifier container
getQuickInfoAtPosition
    Mean duration (ms) 647.5
    Median duration (ms) 646.2
    Mean CV 10.1%
    Worst duration (ms) 717.8
    Worst identifier debug
System information
Node version v10.16.1
CPU count 2
CPU speed 2.294 GHz
CPU model Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz
CPU Architecture x64
Memory 6.8 GiB
Platform linux
Release 4.15.0-1052-azure

testing-library__user-event/v4

Comparison details for testing-library__user-event/v4 📊
master #37606 diff
Batch compilation
Memory usage (MiB) 76.3 71.2 -6.8%
Type count 9875 9875 0.0%
Assignability cache size 33877 33877 0.0%
Subtype cache size 0 0
Identity cache size 3 3 0.0%
Language service
Samples taken 42 42 0.0%
Identifiers in tests 42 42 0.0%
getCompletionsAtPosition
    Mean duration (ms) 317.0 403.1 +27.2% 🔸
    Median duration (ms) 314.1 396.5 +26.2% 🔸
    Mean CV 18.4% 16.2% -12.2%
    Worst duration (ms) 400.5 468.6 +17.0%
    Worst identifier userEvent userEvent
getQuickInfoAtPosition
    Mean duration (ms) 303.8 392.5 +29.2% 🔸
    Median duration (ms) 300.4 390.5 +30.0% 🔸
    Mean CV 16.7% 16.8% +0.7%
    Worst duration (ms) 357.8 476.8 +33.2% 🔸
    Worst identifier userEvent type

It looks like there are several metrics that changed quite a bit. You might want to take a look and make sure your changes won’t cause slow-downs for users consuming these types.

@johnnyreilly
Copy link
Copy Markdown
Member

Lovely!

@typescript-bot typescript-bot added the Other Approved This PR was reviewed and signed-off by a community member. label Aug 15, 2019
@johnnyreilly
Copy link
Copy Markdown
Member

Let's wait until the discussion here has concluded before merging: testing-library/react-testing-library#437 (comment)

@typescript-bot
Copy link
Copy Markdown
Contributor

Updated numbers for you here from 13cd847:

testing-library__dom/v7

These typings are for a package that doesn’t yet exist on master, so I don’t have anything to compare against yet! In the future, I’ll be able to compare PRs to testing-library__dom with its source on master.

Comparison details for testing-library__dom/v7 📊
Batch compilation
Type count 10115
Assignability cache size 33916
Subtype cache size 0
Identity cache size 3
Language service measurements
Samples taken 24
Identifiers in tests 24
getCompletionsAtPosition
    Mean duration (ms) 379.0
    Median duration (ms) 384.1
    Mean CV 14.0%
    Worst duration (ms) 425.6
    Worst identifier element
getQuickInfoAtPosition
    Mean duration (ms) 363.5
    Median duration (ms) 365.3
    Mean CV 11.9%
    Worst duration (ms) 426.9
    Worst identifier element
System information
Node version v10.16.1
CPU count 2
CPU speed 2.294 GHz
CPU model Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz
CPU Architecture x64
Memory 6.8 GiB
Platform linux
Release 4.15.0-1052-azure

testing-library__react/v10

These typings are for a package that doesn’t yet exist on master, so I don’t have anything to compare against yet! In the future, I’ll be able to compare PRs to testing-library__react with its source on master.

Comparison details for testing-library__react/v10 📊
Batch compilation
Type count 52278
Assignability cache size 52517
Subtype cache size 5
Identity cache size 6
Language service measurements
Samples taken 39
Identifiers in tests 39
getCompletionsAtPosition
    Mean duration (ms) 685.3
    Median duration (ms) 683.8
    Mean CV 8.6%
    Worst duration (ms) 747.1
    Worst identifier div
getQuickInfoAtPosition
    Mean duration (ms) 600.9
    Median duration (ms) 598.9
    Mean CV 11.6%
    Worst duration (ms) 692.9
    Worst identifier container
System information
Node version v10.16.1
CPU count 2
CPU speed 2.294 GHz
CPU model Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz
CPU Architecture x64
Memory 6.8 GiB
Platform linux
Release 4.15.0-1052-azure

testing-library__user-event/v4

Comparison details for testing-library__user-event/v4 📊
master #37606 diff
Batch compilation
Memory usage (MiB) 76.3 71.7 -6.0%
Type count 9875 9875 0.0%
Assignability cache size 33877 33877 0.0%
Subtype cache size 0 0
Identity cache size 3 3 0.0%
Language service
Samples taken 42 42 0.0%
Identifiers in tests 42 42 0.0%
getCompletionsAtPosition
    Mean duration (ms) 317.0 362.9 +14.5%
    Median duration (ms) 314.1 361.2 +15.0%
    Mean CV 18.4% 16.2% -12.4%
    Worst duration (ms) 400.5 432.6 +8.0%
    Worst identifier userEvent document
getQuickInfoAtPosition
    Mean duration (ms) 303.8 356.7 +17.4%
    Median duration (ms) 300.4 357.9 +19.1%
    Mean CV 16.7% 15.0% -10.5%
    Worst duration (ms) 357.8 480.4 +34.3% 🔸
    Worst identifier userEvent document

Looks like there were a couple significant differences—take a look at worst-case duration for getting quick info at a position to make sure everything looks ok.

@typescript-bot
Copy link
Copy Markdown
Contributor

typescript-bot commented Aug 15, 2019

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

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

@johnnyreilly
Copy link
Copy Markdown
Member

Ha! It turns out that whilst TypeScript doesn't care about version numbers of packages, the definitely typed tooling does. We'll have to do this in 2 stages (each with a different version number) for a smooth transition. Sorry for time waste there - didn't know definitely typed was doing those checks.

@weyert
Copy link
Copy Markdown
Contributor

weyert commented Aug 15, 2019

John, I will have a look when I am in the office :)

@johnnyreilly If you run lint locally it didn't complain about it.

@johnnyreilly
Copy link
Copy Markdown
Member

Can we revert the version number change of the last commit please? Then we can merge.

@weyert
Copy link
Copy Markdown
Contributor

weyert commented Aug 15, 2019

Yes, I will work on that in a bit once the build at work is working again 😇

This reverts commit 04b992e.
@alexkrolick
Copy link
Copy Markdown
Contributor Author

reverted the version bump

@typescript-bot
Copy link
Copy Markdown
Contributor

Updated numbers for you here from 9a77725:

testing-library__dom/v6

These typings are for a package that doesn’t yet exist on master, so I don’t have anything to compare against yet! In the future, I’ll be able to compare PRs to testing-library__dom with its source on master.

Comparison details for testing-library__dom/v6 📊
Batch compilation
Type count 10115
Assignability cache size 33916
Subtype cache size 0
Identity cache size 3
Language service measurements
Samples taken 24
Identifiers in tests 24
getCompletionsAtPosition
    Mean duration (ms) 358.0
    Median duration (ms) 367.7
    Mean CV 13.7%
    Worst duration (ms) 432.7
    Worst identifier findAllByText
getQuickInfoAtPosition
    Mean duration (ms) 346.8
    Median duration (ms) 345.8
    Mean CV 14.5%
    Worst duration (ms) 405.1
    Worst identifier findByText
System information
Node version v10.16.1
CPU count 2
CPU speed 2.294 GHz
CPU model Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz
CPU Architecture x64
Memory 6.8 GiB
Platform linux
Release 4.15.0-1052-azure

testing-library__react/v9

These typings are for a package that doesn’t yet exist on master, so I don’t have anything to compare against yet! In the future, I’ll be able to compare PRs to testing-library__react with its source on master.

Comparison details for testing-library__react/v9 📊
Batch compilation
Type count 52278
Assignability cache size 52517
Subtype cache size 5
Identity cache size 6
Language service measurements
Samples taken 39
Identifiers in tests 39
getCompletionsAtPosition
    Mean duration (ms) 647.0
    Median duration (ms) 648.5
    Mean CV 9.4%
    Worst duration (ms) 732.7
    Worst identifier container
getQuickInfoAtPosition
    Mean duration (ms) 544.4
    Median duration (ms) 541.0
    Mean CV 9.3%
    Worst duration (ms) 675.2
    Worst identifier container
System information
Node version v10.16.1
CPU count 2
CPU speed 2.294 GHz
CPU model Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz
CPU Architecture x64
Memory 6.8 GiB
Platform linux
Release 4.15.0-1052-azure

testing-library__user-event/v4

Comparison details for testing-library__user-event/v4 📊
master #37606 diff
Batch compilation
Memory usage (MiB) 70.8 70.5 -0.6%
Type count 9875 9875 0.0%
Assignability cache size 33877 33877 0.0%
Subtype cache size 0 0
Identity cache size 3 3 0.0%
Language service
Samples taken 42 42 0.0%
Identifiers in tests 42 42 0.0%
getCompletionsAtPosition
    Mean duration (ms) 371.3 348.6 -6.1%
    Median duration (ms) 369.6 349.8 -5.3%
    Mean CV 16.2% 16.1% -0.5%
    Worst duration (ms) 500.2 404.2 -19.2%
    Worst identifier userEvent document
getQuickInfoAtPosition
    Mean duration (ms) 359.4 331.0 -7.9%
    Median duration (ms) 354.9 332.1 -6.4%
    Mean CV 16.6% 15.2% -8.7%
    Worst duration (ms) 450.6 385.1 -14.5%
    Worst identifier selectOptions window

It looks like nothing changed too much. I’m pretty lenient since I’m still an experiment, so take a look anyways and make sure nothing looks out of place.

@johnnyreilly johnnyreilly merged commit 4cf3fef into DefinitelyTyped:master Aug 15, 2019
@johnnyreilly
Copy link
Copy Markdown
Member

Great - merged. Automation should publish this sometime tonight I think

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

New Definition This PR creates a new definition package. Other Approved This PR was reviewed and signed-off by a community member.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants