Closed rpominov closed 7 years ago
Looks related to this: https://github.com/mhevery/jasmine-node/issues/371
I'm fairly familiar with Karma for running unit tests in a browser. Any interest in using that as a test runner? We'd also be able to solve the "ES6 in tests" problem, as we can use a browserify preprocessor on the tests before running them.
I used Karma and I like how it works in watch mode and creates quick response loop. So maybe it would make sense to use Karma to improve dev experience. But while developing we probably don't want to run tests in browser, and I'm not sure Karma supports running in node (does it?).
As for this particular bug, I don't think Karma will help directly. I'm guessing that problem is that we use different versions of Jasmine on node and in browser. One supports async tests and one don't. Btw we do use browserify already to build browser tests (see https://github.com/rpominov/kefir/blob/master/Gruntfile.coffee#L29).
Also I kinda like the "Run tests in your browser" link. Will it be possible to create such bundle with Karma?
I think Karma is cool, but just don't know if it will solve our problems and won't create new ones. I think main problem with current setup is dev experience, it's takes too long to run the tests every time, a good watch mode would help. And this bug is kinda minor, probably not too hard to fix, I just didn't look at it to be honest.
But while developing we probably don't want to run tests in browser, and I'm not sure Karma supports running in node (does it?).
Not sure of that exactly, but it does support running in PhantomJS, which would be headless, so node-like (CLI-only).
Also I kinda like the "Run tests in your browser" link. Will it be possible to create such bundle with Karma?
No reason we couldn't continue to generate that bundle with grunt.
Up to you if you want it, but since I'm bouncing around this repo, figured I'd try and solve as many problems as possible :).
Did a bit of research. The tests fail because we use Jasmine 1.3 which doesn't support it('', done => ...)
functionality. But in jasmine-node
a modified version of Jasmine 1.3 is used, and it supports done
. The jasmine-node
package seems abandoned and it doesn't support Jasmine 2.x, which makes it harder for us to upgrade to Jasmine 2.x. Seems like the most correct way of running Jasmine on node is to use jasmine
package, but it doesn't seem to support preprocessing out of the box (we need it for coffee and es6+). Not sure what we should do yet, but two thoughts I have so far: 1) This particular issue is harder to fix than I thought 2) The test environment is very outdated and needs overall upgrade.
As for Karma, it doesn't support node, and if we add Karma it won't be able to replace any tools that we use (we still will need something to run on node, and to create "Run tests in your browser" bundle). So Karma will be just additional tool in the testing environment, not sure it's worth it.
It's actually a good thing you did this research, because I was considering switching from Mocha -> Jasmine for another project. Mocha supports preprocessing, but I don't know how much work it would be to switch over. The describe
/ it
constructs are the same, but the assertion syntax would different, and I don't know how easily the test helpers will convert.
That's definitely a bunch of work though, so if you want completely overhaul the testing suite, it may be worth considering what you would want to do as if you were doing it from scratch.
Looking back over this convo, you don't need Karma to "support" node; you just run them in with node, and use Karma only when you're trying to run the tests in the browser.
I'm revisiting this issue because I'm currently refactoring my test suite for brookjs
, and I'd love to be able to use the matchers / assertions you wrote here. Any interest in extracting them to a separate package? If so, couple other questions:
Oh, I've deleted the browser tests build, so it should be easier for any further improvements. #1
and #2
both sound good for me, feel free to open a PR!
Closing this issue.
This is an issue with tests themselves, library code is fine.
http://rpominov.github.io/kefir/test/in-browser/SpecRunner.html