Skip to content
This repository was archived by the owner on Jan 26, 2019. It is now read-only.

Consider removing src/setupTests.ts from tsconfig's exclude section #371

Open
gnapse opened this issue Jul 26, 2018 · 0 comments
Open

Consider removing src/setupTests.ts from tsconfig's exclude section #371

gnapse opened this issue Jul 26, 2018 · 0 comments

Comments

@gnapse
Copy link
Contributor

gnapse commented Jul 26, 2018

Is this a bug report?

No

What's the question then?

I wonder why src/setupTests.ts is excluded in tsconfig.json. The thing is, when extending jest with custom matchers that are injected into expect's return type, this needs an adjustment making the corresponding extension to jest's expect's return type definition.

Extending jest's extend is usually needed to be done only once, and therefore is usually recommended to be done in the setup tests file. But with this file not included by TS, uses of the custom matchers are flagged as type errors.

See testing-library/jest-dom#45 for details. The solution there in the end was to remove src/setupTests.ts file from the exclude section of tsconfig.json. I wonder if that could be made the default for newly created apps using this TS CRA. And if not, why? And what other solution would be recommended?

@gnapse gnapse changed the title Consider removing src/setupTests.ts from tscozfig's exclude section Consider removing src/setupTests.ts from tsconfig's exclude section Jul 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant