Sails.js hooks #298

Closed
chrisns opened this Issue Oct 19, 2015 · 5 comments

Projects

None yet

2 participants

@chrisns
chrisns commented Oct 19, 2015

Sails allows you to have installable hooks that you you simply npm install and because the package.json of that has a flag in it, "sails": {"isHook": true} sails automagically loads it for you.

Using your https://github.com/wallabyjs/sailsjs-mocha-testing-barrels-fixtures-example repo
if you npm install sails-controller-driven-routing

In mocha it'll load the index.js and enter the initialize()

With wallaby however thanks to how it instruments and caches things it doesn't appear to allow that.

Any advice on how it can be tweaked?

Thanks

Chris

@ArtemGovorov
Member

I'm not an expert in sails.js, but when I run mocha in the sample repo that you have mentioned, it doesn't load index.js of the installed sails-controller-driven-routing. Perhaps I'm doing something wrong. Could you please create a smaller repo or a pull request to the mentioned repo where I could reproduce the issue?

@chrisns
chrisns commented Oct 19, 2015

ah, sorry, didn't realise that your demo had an older version of sails in it
have made changes to this fork which should demonstrate the issue:
https://github.com/chrisns/sailsjs-mocha-testing-barrels-fixtures-example
thanks!

@ArtemGovorov
Member

Thanks. I had a look and created the pull request with wallaby config addition that should do the trick.

An alternative to the config change would be to just specify node modules with hooks in your files list (but only node modules with hooks, as copying all node modules over to wallaby cache is an overkill).

You may pick whichever solution you like better. Please let me know if it works for you.

@chrisns
chrisns commented Oct 20, 2015

amazing, your support is as always incredible!
definitely the best value software licence I own.
Thanks!

@ArtemGovorov
Member

@chrisns Thanks for your support!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment