walmartlabs / ridicule

Mocking everything
MIT License
22 stars 8 forks source link

Hapi vision plugin dependency #12

Open peacechen opened 8 years ago

peacechen commented 8 years ago

In Hapi 9+, the vision plugin (along with many others) are no longer included by default. The error is "TypeError: plugin.views is not a function". I tried to load the vision plugin first which gets past the views error, but it continues to fail:

server.register(require("vision"))
    .then(function onVisSuccess() {
        server.register({
            register: require("ridicule"),
            options: {
                apiPrefix: "/myApi",
                mocksDir: "mocks",
                enabled: true
            }
        }).then(function onRidSuccess() {
            //Do something
        }, function onRidError(err) {
            console.log("Failed to load ridicule plugin " + JSON.stringify(err));
        })
    })
    .catch(function onCatch(err) {
        throw err;
    });

Ultimately the ridicule plugin should state its dependencies using server.dependency: http://stackoverflow.com/questions/32187168/hapi-js-load-plugins-in-order

What is the short-term fix to get the current version of ridicule to work with Hapi >9, and what's the long-term schedule for updating the plugin?

kpdecker commented 8 years ago

Neither @patrickkettner nor myself work at Walmart anymore and much of the OSS that we and others on our team worked on had no clear owner when we left. I can't say if this is being used there anymore as it's been over a year since our respective departures, but baring any feedback from someone who still has push rights to this repository, there is a good chance that you'll need to fork and maintain your own copy. :(

dylancwood commented 8 years ago

@peacechen: are you a Walmart associate? If so, ping me on slack @dwood

peacechen commented 8 years ago

@kpdecker - Thanks for the update. Is there another mocking tool you'd recommend for use with Hapi? I like jasmine-ajax because it's library-agnostic, but Node integration is hackish and very wordy.

@dylancwood - Not an associate, but would that help? :)

kpdecker commented 8 years ago

@peacechen I'm not familiar with one, but you might want to ping https://github.com/hapijs/discuss. The folks monitoring issues there likely know most of the projects in the ecosystem.