Comments (6)
My current roundabout solution, run inside onPrepare
of the Protractor configuration, which shims (what I believe to be) the jasmineRequire object into the global scope used by jasmine-promise:
if (!global.jasmineRequire) {
// jasmine 2 and jasmine promises have differing ideas on what to do inside protractor/node
var jasmineRequire = require('jasmine-core');
if (typeof jasmineRequire.interface !== 'function') {
throw "not able to load real jasmineRequire"
}
global.jasmineRequire = jasmineRequire;
}
require('jasmine-promises');
The throw
is there to hopefully detect if/when this changes on jasmine's side..
from jasmine-promises.
Thanks @pnstickne! I didn't test it with protractor. I have some time to take a look at this either tonight or tomorrow. =)
from jasmine-promises.
@matthewjh hey, did you get a chance to look at this? I just experienced the same issue.
from jasmine-promises.
Hi @massimocode,
Yes, I did, and the fix will be in the version being released today or tomorrow. :)
from jasmine-promises.
I encountered this issue as well using jasmine via grunt-jasmine-nodejs. The above workaround seems to be working great for now, inside a helper file loaded before the specs.
from jasmine-promises.
Hey, @matthewjh -- Cool lib. I just thought I'd mention, when I was evaluating this today, I found that the hack described here also works for Node (v6.5.0). Maybe that will help with resolving both issues (this and #8 ).
A little detail: I'm developing an Electron app, and using Jasmine in combination with Spectron, which -- like Protractor -- is WebDriver under the hood. Spectron doesn't crank up until my test is already executing beforeEach(), so Jasmine itself is running under Node. I've tried this fix and the "mock object" solution proposed under #8 . Both worked for me, but presumably this would be more robust. (Or not? I just met Jasmine for the first time yesterday, so idk.)
I'm not actually using this package going forward, because jasmine-es6 is a better fit for me. But I was really very pleased when I found this earlier today. Eventually I got done() working properly in 'plain' Jasmine, but I would have given up without the confidence your code gave me. So thanks for the boost.
from jasmine-promises.
Related Issues (8)
- 'this' is undefined inside beforeEach/afterEach/it/fit HOT 5
- Error running jasmine-promises HOT 4
- Doesn't work correctly under Node.js HOT 3
- Excessively long stack traces HOT 3
- How to test a fail condition? (should enter catch() not then())
- jasmine-promises error stack trace
- Jasmine 2.7 has support for promises HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jasmine-promises.