diff --git a/.eslintrc.js b/.eslintrc.js index d77523c87ca4..1098157eafd9 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -234,7 +234,7 @@ module.exports = { }, }, { - files: ['test-types/*.test.ts', '*.md'], + files: ['**/__typechecks__/**', '*.md'], rules: { 'jest/no-focused-tests': 'off', 'jest/no-identical-title': 'off', @@ -301,9 +301,9 @@ module.exports = { 'error', { devDependencies: [ - '/test-types/**', - '**/__tests__/**', '**/__mocks__/**', + '**/__tests__/**', + '**/__typechecks__/**', '**/?(*.)(spec|test).js?(x)', 'scripts/**', 'babel.config.js', diff --git a/jest.config.js b/jest.config.js index 4ef88e4708fb..e8e4ff73eb23 100644 --- a/jest.config.js +++ b/jest.config.js @@ -35,8 +35,8 @@ module.exports = { require.resolve('jest-snapshot-serializer-raw'), ], testPathIgnorePatterns: [ - '/test-types/', '/__arbitraries__/', + '/__typechecks__/', '/node_modules/', '/examples/', '/e2e/.*/__tests__', diff --git a/jest.config.types.js b/jest.config.types.js index b53ac3c5abda..77a65008fffb 100644 --- a/jest.config.types.js +++ b/jest.config.types.js @@ -7,20 +7,7 @@ 'use strict'; -const assert = require('assert'); -const baseConfig = require('./jest.config'); - -const { - modulePathIgnorePatterns, - testPathIgnorePatterns, - watchPathIgnorePatterns, -} = baseConfig; - -assert.strictEqual( - testPathIgnorePatterns[0], - '/test-types/', - 'First entry must be types', -); +const {modulePathIgnorePatterns} = require('./jest.config'); module.exports = { displayName: { @@ -28,8 +15,7 @@ module.exports = { name: 'types', }, modulePathIgnorePatterns, + roots: ['/packages'], runner: 'jest-runner-tsd', - testMatch: ['/test-types/*.test.ts'], - testPathIgnorePatterns: testPathIgnorePatterns.slice(1), - watchPathIgnorePatterns, + testMatch: ['**/__typechecks__/**/*.ts'], }; diff --git a/package.json b/package.json index c9d34f3f6475..d1b31259a80e 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,6 @@ "jquery": "^3.2.1", "lerna": "^4.0.0", "micromatch": "^4.0.4", - "mlh-tsd": "^0.14.1", "mock-fs": "^4.4.1", "netlify-plugin-cache": "^1.0.3", "node-notifier": "^10.0.0", diff --git a/test-types/expect.test.ts b/packages/expect/__typechecks__/expect.test.ts similarity index 73% rename from test-types/expect.test.ts rename to packages/expect/__typechecks__/expect.test.ts index 1ff227af29e2..0fd539c8d9dd 100644 --- a/test-types/expect.test.ts +++ b/packages/expect/__typechecks__/expect.test.ts @@ -9,5 +9,5 @@ import type * as expect from 'expect'; export type M = expect.Matchers; export type N = expect.Matchers; -// @ts-expect-error -export type E = expect.Matchers<>; +// @ts-expect-error: Generic type 'Matchers' requires between 1 and 2 type arguments. +export type E = expect.Matchers; diff --git a/packages/expect/package.json b/packages/expect/package.json index 0a5a10f6404f..360303ff4ba5 100644 --- a/packages/expect/package.json +++ b/packages/expect/package.json @@ -30,7 +30,8 @@ "@jest/test-utils": "^27.4.0", "chalk": "^4.0.0", "fast-check": "^2.0.0", - "immutable": "^4.0.0-rc.12" + "immutable": "^4.0.0-rc.12", + "mlh-tsd": "^0.14.1" }, "engines": { "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" diff --git a/test-types/top-level-config.test.ts b/packages/jest-types/__typechecks__/config.test.ts similarity index 100% rename from test-types/top-level-config.test.ts rename to packages/jest-types/__typechecks__/config.test.ts diff --git a/test-types/top-level-expect-namespace.test.ts b/packages/jest-types/__typechecks__/expect.test.ts similarity index 100% rename from test-types/top-level-expect-namespace.test.ts rename to packages/jest-types/__typechecks__/expect.test.ts diff --git a/test-types/top-level-globals.test.ts b/packages/jest-types/__typechecks__/globals.test.ts similarity index 100% rename from test-types/top-level-globals.test.ts rename to packages/jest-types/__typechecks__/globals.test.ts diff --git a/test-types/top-level-jest-namespace.test.ts b/packages/jest-types/__typechecks__/jest.test.ts similarity index 100% rename from test-types/top-level-jest-namespace.test.ts rename to packages/jest-types/__typechecks__/jest.test.ts diff --git a/packages/jest-types/package.json b/packages/jest-types/package.json index a01733e905ca..48ad65116f2d 100644 --- a/packages/jest-types/package.json +++ b/packages/jest-types/package.json @@ -26,6 +26,9 @@ "@types/yargs": "^16.0.0", "chalk": "^4.0.0" }, + "devDependencies": { + "mlh-tsd": "^0.14.1" + }, "publishConfig": { "access": "public" } diff --git a/tsconfig.json b/tsconfig.json index d5e967ef95d0..f019aa1126f4 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -26,8 +26,9 @@ }, "exclude": [ ".yarn/releases/*", - "**/__tests__/**/*", "**/__mocks__/**/*", + "**/__tests__/**/*", + "**/__typechecks__/**/*", "**/build/**/*" ] } diff --git a/yarn.lock b/yarn.lock index 69103575cdbf..b86a283567b9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2613,7 +2613,6 @@ __metadata: jquery: ^3.2.1 lerna: ^4.0.0 micromatch: ^4.0.4 - mlh-tsd: ^0.14.1 mock-fs: ^4.4.1 netlify-plugin-cache: ^1.0.3 node-notifier: ^10.0.0 @@ -2775,6 +2774,7 @@ __metadata: "@types/node": "*" "@types/yargs": ^16.0.0 chalk: ^4.0.0 + mlh-tsd: ^0.14.1 languageName: unknown linkType: soft @@ -9813,6 +9813,7 @@ __metadata: jest-matcher-utils: ^27.4.0 jest-message-util: ^27.4.0 jest-regex-util: ^27.4.0 + mlh-tsd: ^0.14.1 languageName: unknown linkType: soft