Skip to content
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

Tests would timeout under ReScript v11.0.0-rc.4 with uncurried: false #119

Closed
dsiu opened this issue Oct 14, 2023 · 7 comments
Closed

Tests would timeout under ReScript v11.0.0-rc.4 with uncurried: false #119

dsiu opened this issue Oct 14, 2023 · 7 comments

Comments

@dsiu
Copy link

dsiu commented Oct 14, 2023

Just change Rescript to v11.0.0-rc.4 and add uncurried: false to bsconfig.json, npm test will fail with timeout.

It seems like Rescript v11 adds a param to the callback of test function which causes the timeout.

with uncurried: false in bsconfig.json

function test$1(name, callback) {
  test(name, (function (param) {
          affirm(Curry._1(callback, undefined));
        }));
}

without uncurried: fase in bsconfig.json (ie: default uncurried mode)

function test$1(name, callback) {
  test(name, (function () {
          affirm(callback(undefined));
        }));
}

Here is the repo to demonstrate:
https://github.com/dsiu/rescript-jest/tree/rescript-v11-curried-mode

@glennsl
Copy link
Owner

glennsl commented Oct 19, 2023

Not sure if this can/should be solved here.

Any suggestions @zth, @cristianoc?

@fhammerschmidt
Copy link

fhammerschmidt commented Nov 30, 2023

When I change this line

@val external _test: (string, @uncurry (unit => Js.undefined<unit>)) => unit = "test"

to

@val external _test: (string, (. unit) => Js.undefined<unit>) => unit = "test"

and adapt the callsites to using (. ()) as well, it works!

@dsiu
Copy link
Author

dsiu commented Dec 1, 2023

I applied the changes @fhammerschmidt suggested to _test and all other related @uncurry functions like testPromise describe etc in my fork dsiu@87cbdb1, and all tests passed in uncurried: false with Rescript-v11.0.0-rc.6! 🎉

@glennsl
Copy link
Owner

glennsl commented Dec 1, 2023

Does it also work seamlessly with v10?

@TheSpyder
Copy link

I just hit this, and yes rescript-jest with those changes does still work if I downgrade my project to v10 (and then re-apply the changes).

That suggests @uncurry externals don't behave properly in v11 with uncurried: false - perhaps a lurking bug. Certainly I'm not sure whether it's safe to remove them all in rescript-jest.

@glennsl
Copy link
Owner

glennsl commented Apr 21, 2024

It's a breaking change in 10 in that it requires functions to be applied with .. But let's give it a go anyway. All tests pass in 11. Users on 10 can keep using 0.10.

@glennsl
Copy link
Owner

glennsl commented Apr 21, 2024

Should be fixed in 0.11. Let me know if there are any issues.

@glennsl glennsl closed this as completed Apr 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants