Reputation: 8948
I was looking for a way to make failure messaging more descriptive in Jasmine and found this functionality https://jasmine.github.io/api/edge/matchers.html#withContext
So I try it in my Protractor framework like this
expect(true).withContext("something else").toBe(false);
Run the test and get error - Failed: expect(...).withContext is not a function
This feature was implemented since Jasmine 3.3.0, so I checked my package.json and see "jasmine": "^3.3.1"
, and package-lock.json has
"jasmine-core": {
"version": "3.3.0",
Any ideas what is wrong?
Upvotes: 5
Views: 6328
Reputation: 8948
Just got an answer from Jasmine team on the GitHub stating
Protractor uses jasminewd wrapper which uses Jasmine 2.x. If you want to use Jasmine 3.x, you can use Protractor 6.0, that has been released recently. In older versions the newest features of Jasmine, like withContext function, async hooks (e.g. onSpecDone) are not available.
Besides the difference in Protractor version I found out that my grunt task runner has been using grunt-protractor-runner v5.0.0 which used protractor 5.4.2. So I had to open protractor.conf.js directly with protractor.
Upvotes: 5