You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Do you have a case when it causes issue ? getScriptVersion is always executed after getScriptFileName (as far as I have observed) so that’s why the ! operator is there.
I’m curious to see which cases it fails. But ya for code perspective, ? should be used instead
Heh, I woke up this morning trying to think how I could provide you a minimal repro (source repo is huge and private). The error was only reproducible with a clean repo (delete entire root folder, clone, jest). normalizedFileName was set, just not present in cache. I didn't dig into it too much on the why side since the "fix" was obvious and the sirens of other fires were calling my name.
If there's any info I can provide let me know, but with the PR I'm good. Will just patch local JS until update published. Thanks.
ts-jest/src/compiler/language-service.ts
Line 85 in b5dc7cb
If the file is not in the MemoryCache this will throw. I'm not sure if this is the intended behavior, but it is causing issues for me.
ts-jest/src/compiler/language-service.ts
Lines 87 to 92 in b5dc7cb
The return statement, and the lengthy comment above it, already expects as much is a possibility and will return undefined.
Changing to
const version = memoryCache.files.get(normalizedFileName)?.version;
will allow a cache miss and returnundefined
.The text was updated successfully, but these errors were encountered: