-
Notifications
You must be signed in to change notification settings - Fork 508
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
tsconfig.json is not applied in test folder in VSCode #871
Comments
Here’s the commit where my libs tests were fixed. Is there any reason we do not do the strict typechecking in tests? I cannot imagine any other formally typechecked language where the default typechecking is turned off by default in tests (scala, swift, purescript, haskell, etc) so I cannot imagine why we’d do that here? |
ReproducedAh, the VSCode vs
$ yarn test
yarn run v1.22.4
$ tsdx test
FAIL test/blah.test.ts
● Test suite failed to run
TypeScript diagnostics (customize using `[jest-config].globals.ts-jest.diagnostics` option):
test/blah.test.ts:10:10 - error TS2533: Object is possibly 'null' or 'undefined'.
10 return input + 1
~~~~~
Test Suites: 1 failed, 1 total
[...] Thanks for reproducing this @merisbahti, this is very helpful to verify my suspicions as well as add a test for this! Explanation of differencesVScode reads your root Historical ContextThis section may not be useful to anyone other than me, but it's important context to understand the problem at hand:
Might be missing some other places I've mentioned this. Has been something I've been looking out for in the issues, but hadn't seen a clear repro until now. Have labeled as both regression and feature as it's somewhere in between. #84 and #225 were features, but #226 was buggy so was reverted by #646. So in that way you can either say it was never truly fixed (since the fix was buggy), or that #646 created an intentional (and at the time, unreproducible) regression in order to fix a worse bug. WorkaroundSo there are several workarounds for this.
Next Steps
|
This is the best response I’ve ever read, thank you. |
Current Behavior
Extremely confusing, if I set
strict: true
in tsconfig, there’s no error for this under thetests/
in vscode:No error in the editor, but error when running
tsdx test
, this is super confusing, I kept looking for errors in my editor...Expected behavior
I want it to give me the exact same error, as if it had been used in my code.
Suggested solution(s)
I don’t know, I just feel betrayed and have been searching for a solution for so long. It’s been a huge journey, how do you feel?
Maybe include a warning?
Maybe we strict should be the default, and we should include the
tests
folder in theinclude
array?Should we make strict mode the default?
Additional context
Really I might just have needed to vent.
Your environment
Hehe im coding through mosh... but here’s the specs:
The text was updated successfully, but these errors were encountered: