-
Notifications
You must be signed in to change notification settings - Fork 5
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
bug: using null
or undefined
as the @Mock(() => result)
throws error
#138
Comments
null
or undefined
as the @Mock(() => result)
throws errornull
or undefined
as the @Mock(() => result)
throws error
Sorry for the delay, I was traveling. Did you manage to reproduce this bug? |
Keep on doing that, we need some fresh air sometimes :) |
Hey @omermorad, It's me again. This bug is occurring when i use the class Test {
@Mock(...)
fine: string;
@Mock(...)
alsoFine?: string;
@Mock(...)
notFine: string | null;
@Mock(...)
alsoNotFine: string | undefined;
} And that's because with a strict tsconfig, the decorator metadata emitted for these lines are different: // With fine?: string;
tslib_1.__metadata("design:type", String)
// With notFine: string | null;
tslib_1.__metadata("design:type", Object)
This could be alright if it was trying automatically to find a mock value, but as it was manually specified (not this), I don't think that the metadata should be read and interpreted. And when it needs to be interpreted, but the generated metadata is // type-graphql does manually the type
@Field(() => String) // <--
a: string; I don't have time to create a 100% reproductible steps in the moment, but this should be sufficient... |
@arthurfiorette what version are you using? Can you try it with 3.0.0-rc.3? |
Yep, 3.0.0-rc.3 works just fine! |
But, is it safe to upgrade? If it is, you should create a stable release ( |
Yes, it's been tested with a new integration test, look here: https://github.com/omermorad/mockingbird/blob/mockingbird%403.0.0-rc.3/packages/parser/test/integration/common/test-classes.ts, those are all actual classes that are being tested (simulates a real situation). I belive I will release this in the next week, I almost have no time to breathe now because of the new startup I work for :) |
Hello, Plumier developer here. I come here because I see that the error was related to the We currently have some bugs fixed on our newest release |
If i use
null
orundefined
as the@Mock(() => result)
, it throws:Originally posted by @arthurfiorette in #135 (comment)
The text was updated successfully, but these errors were encountered: