-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enable passing a reference to chai #1
Conversation
Awesome! Added you as an owner here too, feel free to merge it in. Now that you mentioned browserify, I'd be more than happy to find out if hydro (and company) works with it. I actually took the effort to setup testling for hydro but for some weird reason it didn't run the tests on anything but ie 7 and there it couldn't really give me any information, and I couldn't spend more time on it this day. I'm pretty sure it works fine with node-testling locally. However, since I'm not really using browserify, I'd be thrilled to figure out how we can test whether it's working fine (automatically) on a daily basis. |
In fact, we are having the same problem with Chai.js itself (or used to have at least). cc: @logicalparadox |
I don't actually use browserify either but something which works similarly. The trick is all dependencies need to be statically declared in |
Interesting, what's the tool that you are using? Would you be interested to improve the Travis build, so it actually bundles hydro with it and checks if it's working fine, by, say, running the tests on phantomjs or even on sauce as it currently does with karma? |
I'm using sourcegraph which I wrote because I hate substacks insistance on streaming everything and I had a couple ideas I wanted to try out but they turned out to be bad ideas. Sure I'll have a crack at it. I'll start with browserify because I haven't look at it since 1.x. |
Sweet! |
I don't know much about sourcelabs, karma, or travis so im a bit lost figuring out what's going on. Is there any way to manually run the test suite in a browser? |
Yeah, under
In case you want to trigger the tests on SauceLabs from your computer, you would need SauceLabs username & secret. It's free for open source projects so you can sign up freely, if not desired though I can email you the credentials that I use for Afterwards you do:
Let me know if this helps, I'd be happy to expand it even further. |
Yea I'm just having problems figuring out exactly what code karma runs. And how it knows the test results? |
enable passing a reference to chai
Actually never mind I've more or less figured it out. It'll take a bit of time but I should be able to get karma to run a browserified build |
Karma seems like a lot of magic, but once you figure out how it does it - it actually makes sense. What it does is fire up a node server, include the file that you've specified in the config and then pipe the output from the browsers to the console via web sockets. In order to tell Karma the results of the tests we needed to build a custom formatter which is basically a proxy between hydro and karma itself (https://github.com/hydrojs/karma-hydro/blob/master/adapter.js). karma-hydro allows you to supply a custom path to hydro (https://github.com/hydrojs/karma-hydro/blob/master/index.js#L34). So basically for the browserify build I'm assuming we need to build hydro to a temporary location and then supply this location to the config and this will do the trick. Thoughts? |
Yea once I broke the config the browsers stayed open and I was able to look at what code they had loaded. It actually looks pretty nice compared to https://github.com/yields/gravy which works by polling every 1 second for a With browserify its probably easier to just keep everything under one build so I might create a karma adapter which is just a hydro plugin. Also does karma allow you to use you own html? |
re: html I think no, but you could use the html2js preprocessor(https://github.com/karma-runner/karma-html2js-preprocessor) and then modify the DOM manually, shouldn't be too much of a pain. Or you could create a plugin that does it for you (that would be pretty sweet). Why do you need it btw? |
well then I would be adding karma to the test suite rather than the other way around which just makes more sense. Also the mocha html reporter would need to be modified to use karma since it needs a element with ID "mocha" present before it loads. It'll be fine for our use its just something that I feel will eventually be a PITA on other projects where I might consider using karma. |
In case you'd be using mocha, there is a mocha adapter for it that the karma guys support, so in this particular case you'd be covered. For other cases, luckily, karma is pretty easy to extend, so it shouldnt be a lot of pain to get it working. Veselin
|
this is so people like me who use a lot of symlinks and
browserify can pass the actual chai instance in