From e9a64da301dccf5b6cd600049872ba95bf9d9ece Mon Sep 17 00:00:00 2001 From: mrazauskas <72159681+mrazauskas@users.noreply.github.com> Date: Thu, 30 Dec 2021 12:27:28 +0200 Subject: [PATCH 1/2] chore: improve tsd runner setup --- jest.config.types.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/jest.config.types.js b/jest.config.types.js index 77a65008fffb..03820cf170f2 100644 --- a/jest.config.types.js +++ b/jest.config.types.js @@ -7,15 +7,18 @@ 'use strict'; -const {modulePathIgnorePatterns} = require('./jest.config'); +const rootDirs = ['/packages/expect', '/packages/jest-types']; -module.exports = { +const projects = rootDirs.map(rootDir => ({ displayName: { color: 'blue', name: 'types', }, - modulePathIgnorePatterns, - roots: ['/packages'], + rootDir, runner: 'jest-runner-tsd', - testMatch: ['**/__typechecks__/**/*.ts'], + testMatch: ['**/__typechecks__/**/*.test.ts'], +})); + +module.exports = { + projects, }; From dcd8bde81b3e0d361a4f95981b765a0a964fce0f Mon Sep 17 00:00:00 2001 From: mrazauskas <72159681+mrazauskas@users.noreply.github.com> Date: Thu, 30 Dec 2021 14:24:47 +0200 Subject: [PATCH 2/2] alternative solution --- jest.config.types.js | 13 +++++-------- packages/expect/__typechecks__/expect.test.ts | 2 ++ packages/jest-types/__typechecks__/config.test.ts | 2 ++ packages/jest-types/__typechecks__/expect.test.ts | 2 ++ packages/jest-types/__typechecks__/globals.test.ts | 2 ++ packages/jest-types/__typechecks__/jest.test.ts | 2 ++ 6 files changed, 15 insertions(+), 8 deletions(-) diff --git a/jest.config.types.js b/jest.config.types.js index 03820cf170f2..77a65008fffb 100644 --- a/jest.config.types.js +++ b/jest.config.types.js @@ -7,18 +7,15 @@ 'use strict'; -const rootDirs = ['/packages/expect', '/packages/jest-types']; +const {modulePathIgnorePatterns} = require('./jest.config'); -const projects = rootDirs.map(rootDir => ({ +module.exports = { displayName: { color: 'blue', name: 'types', }, - rootDir, + modulePathIgnorePatterns, + roots: ['/packages'], runner: 'jest-runner-tsd', - testMatch: ['**/__typechecks__/**/*.test.ts'], -})); - -module.exports = { - projects, + testMatch: ['**/__typechecks__/**/*.ts'], }; diff --git a/packages/expect/__typechecks__/expect.test.ts b/packages/expect/__typechecks__/expect.test.ts index 0fd539c8d9dd..cdb061ead9fb 100644 --- a/packages/expect/__typechecks__/expect.test.ts +++ b/packages/expect/__typechecks__/expect.test.ts @@ -3,6 +3,8 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. + * + * @type ../ */ import type * as expect from 'expect'; diff --git a/packages/jest-types/__typechecks__/config.test.ts b/packages/jest-types/__typechecks__/config.test.ts index 0bb54dbdd81c..1c7f5cbde74d 100644 --- a/packages/jest-types/__typechecks__/config.test.ts +++ b/packages/jest-types/__typechecks__/config.test.ts @@ -3,6 +3,8 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. + * + * @type ../ */ import {expectAssignable} from 'mlh-tsd'; diff --git a/packages/jest-types/__typechecks__/expect.test.ts b/packages/jest-types/__typechecks__/expect.test.ts index 80d87e86d186..e89f56e70695 100644 --- a/packages/jest-types/__typechecks__/expect.test.ts +++ b/packages/jest-types/__typechecks__/expect.test.ts @@ -3,6 +3,8 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. + * + * @type ../ */ import {expectError, expectType} from 'mlh-tsd'; diff --git a/packages/jest-types/__typechecks__/globals.test.ts b/packages/jest-types/__typechecks__/globals.test.ts index 5aad8daabf5a..d7a4483a68d4 100644 --- a/packages/jest-types/__typechecks__/globals.test.ts +++ b/packages/jest-types/__typechecks__/globals.test.ts @@ -3,6 +3,8 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. + * + * @type ../ */ import {expectError, expectType} from 'mlh-tsd'; diff --git a/packages/jest-types/__typechecks__/jest.test.ts b/packages/jest-types/__typechecks__/jest.test.ts index 1c0a5483ca56..a7ba5adc88fa 100644 --- a/packages/jest-types/__typechecks__/jest.test.ts +++ b/packages/jest-types/__typechecks__/jest.test.ts @@ -3,6 +3,8 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. + * + * @type ../ */ import {expectError, expectType} from 'mlh-tsd';