Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/test-utils/src/ConditionalTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
* LICENSE file in the root directory of this source tree.
*/

/* eslint-disable jest/no-focused-tests */
Copy link
Member

Choose a reason for hiding this comment

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

this is weird. But I think it'd work if imported from @jest/globals, so probably fine 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right. Just check, it works if imported from @jest/globals.


import semver = require('semver');
import type {Global} from '@jest/types';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just a reminder. It is not possible to import from @jest/globals, because @jest/globals depend on expect which depends on @jest/test-utils. That’s circular. In contrary @jest/types currently depends only on @jest/schemas.

Copy link
Member

Choose a reason for hiding this comment

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

We should fix the cycle - lerna warns every time I publish. Would be nice if yarn did the same on install

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Where does Lerna find a cycle?

In this comment I try to say that here importing from @jest/types does not create a cycle, but importing from @jest/globals would. In earlier PR it was your suggestion to import from @jest/globals. I tried that and hit the circular dips error. This is simply an explanation why I went for importing from @jest/types (;

Copy link
Member

Choose a reason for hiding this comment

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

pretty-format has a dev dep on expect

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right. I recall that. It was added in #12626

Copy link
Member

Choose a reason for hiding this comment

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

Yup


declare const describe: Global.TestFrameworkGlobals['describe'];
declare const test: Global.TestFrameworkGlobals['test'];

export function isJestJasmineRun(): boolean {
return process.env.JEST_JASMINE === '1';
Expand Down
4 changes: 3 additions & 1 deletion packages/test-utils/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
"extends": "../../tsconfig.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "build"
"outDir": "build",
// we don't want `@types/jest` to be referenced
"types": ["node"]
},
"include": ["./src/**/*"],
"references": [{"path": "../jest-types"}, {"path": "../pretty-format"}]
Expand Down