-
Notifications
You must be signed in to change notification settings - Fork 91
Description
Context
I was working on updating purescript-cypress
to work with purescript-spec-mocha
, so that something like this works:
main :: Effect Unit
main = runMocha do
describe "example to-do app" do
it "should work" do
flip runReaderT cy do
void $ visit "/todo"
After bundling the file via spago bundle-app
and running the resulting js
file via Cypress, Cypress does not run the test at all and instead emits this error:
Cypress detected that you invoked one or more cy commands but returned a different value.
The returned value was:
{}
Because cy commands are asynchronous and are queued to be run later, it doesn't make sense to return anything else.
For convenience, you can also simply omit any return value or return undefined
and Cypress will not error.
In previous versions of Cypress we automatically detected this and forced the cy commands to be returned. To make tings less magical and clearer, we are now throwing an error. Learn more
This error only occurs if I use purescript-spec-mocha
to generate the describe
and it
blocks around the actual tests. It's very possible that purescript-spec-mocha
(or a fork) could handle its FFI for itAsync
a bit differently.
Regardless of why, should unit
still be represented as {}
? Or should it be represented as undefined
? See also #223.
I can't recall where, but I know in FFI somewhere, we used to do return {};
for a function that returned unit. We later dropped that as we discovered that the object creation slowed down the FFI.