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

Documentation needs updating to say Jasmine in JasmineWD / Protractor supports returning promises in beforeEach afterEach it etc #55

Open
massimocode opened this issue Sep 22, 2016 · 0 comments

Comments

@massimocode
Copy link

Hi guys

First, thanks for all your hard work on jasminewd

I have seen this issue #48 asking to support returning promises.

Native Jasmine 2.4.1 does not support returning promises. See this JSFiddle:
http://fiddle.jshell.net/dzeqLg0a/3/

There are 2 tests there. One that should pass because it uses callbacks, and one that should fail because it returns a promise. Needless to say, the one that should fail does indeed fail on native Jasmine 2.4.1.

However, the implementation of asyncTestFn means that you have essentially altered Jasmine's behaviour by making it wait for promises to resolve. If I copy/paste those JSFiddle tests into my editor and run them using protractor, both tests pass.

I think you need to be clear about this in the jasminewd documentation and possibly even the Protractor documentation. I have just spent 2 hours explaining to a colleague why we need the jasmine-promises module, only to be told that "jasmine supports returning promises". I know jasmine doesn't support returning promises. So I sat down to show him these failing tests in protractor and, lo-and-behold, they pass. I then had to sit and read through Jasmine's source code and couldn't find any support for promises. So I decided to do a console.log(beforeEach.toString()) and saw the aforementioned wrapper which indeed makes the test methods support promises.

We are not the only ones confused by this... see this issue as well:
angular/protractor#1689

@juliemr correctly replies that Jasmine does not support promises (this is inside the context of a protractor issue) whereas @HenrikBechmann is also quite right, and it is protractor's use of jasminewd that is giving it that support.

Either jasminewd should not modify jasmine's behaviour (a bad idea because jasmine's behaviour sucks), or it should document that it does (and this should be more visible in the protractor documentation because a lot of protractor users probably haven't even heard of jasminewd)

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

1 participant