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: run type tests using old version of TS #12449

Merged
merged 1 commit into from
Feb 21, 2022

Conversation

SimenB
Copy link
Member

@SimenB SimenB commented Feb 21, 2022

Summary

This currently fails, /cc @mrazauskas

 FAIL   types  packages/expect/__typetests__/expect.test.ts
  ● Test suite failed to run

    SyntaxError: ',' expected.

      at packages/expect/__typetests__/expect.test.ts:11:8

 PASS   types  packages/jest-types/__typetests__/config.test.ts
 PASS   types  packages/jest-expect/__typetests__/jest-expect.test.ts
 PASS   types  packages/jest-types/__typetests__/globals.test.ts
 PASS   types  packages/jest-types/__typetests__/expect.test.ts
 FAIL   types  packages/jest-types/__typetests__/jest.test.ts
  ● tsd typecheck

    Argument of type '((a: string, b: number) => boolean) & Mock<unknown, unknown[]>' is not assignable to parameter of type 'Mock<boolean, [a: string, b: number]>'.

    > 130 |   expectType<Mock<boolean, [a: string, b: number]>>(maybeMock);
          |   ^

      at packages/jest-types/__typetests__/jest.test.ts:130:3

    Parameter type 'Mock<boolean, [a: string, b: number]>' is declared too wide for argument type 'Mock<boolean, [a: string, b: number]> & Mock<unknown, unknown[]>'.

    > 143 |   expectType<Mock<boolean, [a: string, b: number]>>(surelyMock);
          |   ^

      at packages/jest-types/__typetests__/jest.test.ts:143:3

    Argument of type 'Mock<boolean, [a: string, b: number]>' is not assignable to parameter of type 'never'.

    > 150 |   expectType<never>(surelyMock);
          |   ^

      at packages/jest-types/__typetests__/jest.test.ts:150:3

    Parameter type 'string & Mock<unknown, unknown[]>' is not identical to argument type 'string & Mock<unknown, unknown[]>'.

    > 160 |   expectType<string & Mock<unknown, Array<unknown>>>(stringMaybeMock);
          |   ^

      at packages/jest-types/__typetests__/jest.test.ts:160:3

    Parameter type 'Mock<unknown, unknown[]>' is not identical to argument type 'Mock<unknown, unknown[]>'.

    > 170 |   expectType<Mock<unknown, Array<unknown>>>(anyMaybeMock);
          |   ^

      at packages/jest-types/__typetests__/jest.test.ts:170:3

    Parameter type 'Mock<unknown, unknown[]>' is not identical to argument type 'Mock<unknown, unknown[]>'.

    > 180 |   expectType<Mock<unknown, Array<unknown>>>(unknownMaybeMock);
          |   ^

      at packages/jest-types/__typetests__/jest.test.ts:180:3

    Argument of type 'SpyInstance<string, []>' is not assignable to parameter of type 'SpyInstance<Date, [value: string | number | Date]>'.

    > 271 | expectType<SpyInstance<Date, [value: string | number | Date]>>(
          | ^

      at packages/jest-types/__typetests__/jest.test.ts:271:1

    Argument of type 'string' is not assignable to parameter of type '(...args: any[]) => unknown'.

    > 155 | if (!jest.isMockFunction(stringMaybeMock)) {
          |                          ^

      at packages/jest-types/__typetests__/jest.test.ts:155:26

    Argument of type 'string' is not assignable to parameter of type '(...args: any[]) => unknown'.

    > 159 | if (jest.isMockFunction(stringMaybeMock)) {
          |                         ^

      at packages/jest-types/__typetests__/jest.test.ts:159:25

    Argument of type 'unknown' is not assignable to parameter of type '(...args: any[]) => unknown'.

    > 175 | if (!jest.isMockFunction(unknownMaybeMock)) {
          |                          ^

      at packages/jest-types/__typetests__/jest.test.ts:175:26

    Argument of type 'unknown' is not assignable to parameter of type '(...args: any[]) => unknown'.

    > 179 | if (jest.isMockFunction(unknownMaybeMock)) {
          |                         ^

      at packages/jest-types/__typetests__/jest.test.ts:179:25

    Expected an error, but found none.

    > 133 |   expectError(maybeMock.mockReturnValueOnce(123));
          |   ^

      at packages/jest-types/__typetests__/jest.test.ts:133:3

    Expected an error, but found none.

    > 146 |   expectError(surelyMock.mockReturnValueOnce(123));
          |   ^

      at packages/jest-types/__typetests__/jest.test.ts:146:3

    Expected an error, but found none.

    > 255 | expectError(jest.spyOn('abc', 'methodA'));
          | ^

      at packages/jest-types/__typetests__/jest.test.ts:255:1

Test Suites: 2 failed, 4 passed, 6 total
Tests:       14 failed, 447 passed, 461 total
Snapshots:   0 total
Time:        2.958 s

Closes #12444

Test plan

Green CI

@@ -58,7 +58,7 @@
"@types/micromatch": "^4.0.1",
"semver": "^7.3.5",
"ts-node": "^10.5.0",
"typescript": "^4.0.3"
"typescript": "^4.0.2"
Copy link
Member Author

@SimenB SimenB Feb 21, 2022

Choose a reason for hiding this comment

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

same as in root, simplifies the script a tiny bit

@mrazauskas
Copy link
Contributor

First one SyntaxError: ',' expected. is clear. Fixed it in #12448

The rest.. hm.. At first glance it feels like types from @types/jest are under test. Many of these errors I saw while working on #12442. Must be fixed. Will take a better look.

@SimenB
Copy link
Member Author

SimenB commented Feb 21, 2022

Oh, nice! Merged it, will rebase

@mrazauskas
Copy link
Contributor

Works. Nice!

@SimenB SimenB merged commit f9d4fc4 into jestjs:main Feb 21, 2022
@SimenB SimenB deleted the type-test-old-ts branch February 21, 2022 14:26
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Run TS type tests on minimum supported version of TS
3 participants