-
Notifications
You must be signed in to change notification settings - Fork 25
Null instead of undefined in TestResult
#796
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
Comments
I've tried to repro this in isolation, but no luck. Rust code: https://github.com/agostbiro/napi-rs-null-vs-undefined/blob/a3b4ed07aa6ab062e003d96ddd2bd0bcd62f6823/src/lib.rs#L15 To execute the JS test, clone the linked repo and then: |
@agostbiro when you say "no luck", are you pointing to the fact that it passes in isolation but fails in the solidity tests? |
Looks like it would always be pub struct TestResult {
// snip
#[napi(readonly)]
pub reason: Option<Either<String, ()>>
// snip
} Then for the reason: test_result.reason.map_or(Some(Either::B(())), |reason| Some(Either::A(reason))) And the tests pass. |
Hey, yeah I mean in the repor it passes, but in Solidity tests we sometimes get |
Oh nice, could you open a PR with this? |
Yes sure |
Steps to reproduce
fix/null-instead-of-undefined
branchjs/integration-tests/solidity-tests
in the repopnpm i
pnpm test
Expected result
All tests pass.
Actual result
Many tests fail with the following message:
This is caused by returning
null
instead ofundefined
as the optional failure reason for succeeding tests.The text was updated successfully, but these errors were encountered: