Closed ohnv closed 3 years ago
That's an interesting case! I haven't encountered it, but I'll take a look at this and try and make a repro and either fix it or improve the documentation! Thanks :)
Hi @TheTrainor , I haven't been able to reproduce your situation. Perhaps we are using different ts configurations. Do you think you could create a repl repro? Here's my attempt.
Thanks @Aboisier, it's definitely possible that something in my tsconfig was causing problems.
I will check it out as soon as I'm back from holidays and also see if using your tsconfig as shown in the repl fixes my problems. Thanks again!
Hi! Have you had the opportunity to test with my tsconfig? I'll close this for now, but feel free to reopen if this is still an issue. :)
Is it correct that you will receive a "Cannot read property [x] of undefined" error if referencing an enum in a test file, unless that enum is imported from a file with nothing else in it but that enum?
Consider the following fails:
However this works:
I had been searching for a fix for this for some time (since it appears to affect other TS test frameworks as well, including Mocha at least). After trying to copy the .tsconfig and testys.json configs with no success, I finally stumbled upon the answer by looking here.
It seems that this is a limitation of TS itself (Please tell me if it's otherwise), so I'm not sure if this is something you can 'fix'. Perhaps a note in the documentation somewhere? Otherwise perhaps this issue itself will help others if they do a search for 'enum' like I tried.
Anyway, really like what you've done. Keep up the good work :-)