Coder Social home page Coder Social logo

Comments (6)

pnstickne avatar pnstickne commented on September 23, 2024

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.

matthewjh avatar matthewjh commented on September 23, 2024

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.

massimocode avatar massimocode commented on September 23, 2024

@matthewjh hey, did you get a chance to look at this? I just experienced the same issue.

from jasmine-promises.

matthewjh avatar matthewjh commented on September 23, 2024

Hi @massimocode,

Yes, I did, and the fix will be in the version being released today or tomorrow. :)

from jasmine-promises.

putermancer avatar putermancer commented on September 23, 2024

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.

matippetts avatar matippetts commented on September 23, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.