Closed benhutchins closed 9 years ago
This sounds good. I was thinking about Selenium support last week. Also, Karma. I'll try to have this merged by Friday evening.
Karma is similar to grunt-js-test in some ways. Not sure they'd work together well, what are your thoughts there?
I remember looking at Karma in depth, and I liked it, but didn't think it work @vistaprint due to the JS-Lib structure, support for <reference>
tags, and other VP-specific things. However, grunt-js-test is also easier to get started with, partially because grunt-js-test wraps and includes Mocha and Chai (with is arguably a bad thing as well - I think of it as bad currently, I want to allow this to be replaceable - but when first implementing grunt-js-test, it helped speed things up).
I was wondering how they might work together. I haven't had a chance to look at Karma in depth, but like you said, they are similar. Selenium support looks like a better ROI right now. Start an Issue about Selenium, please.
I believe this fixes Issue #3. Probably also partially addresses Issue #2
It does fix #3 , will be using the latest release of Mocha and also allows updating Mocha in the future to be easier, you can use npm outdated
to look for updates in the future.
As for #2, this is not really solved. If Mocha is changed to a shared dependency it would be, but it'll require a rewrite of the server.js
to use require.resolve
to get the path of mocha since it may not be apart of grunt-js-test directly. This probably makes sense to do, simply hadn't thought of it. Also want to do the same for Chai and Sinon.
Removed the use of the module
grunt-mocha
, wrapping it's features directly intogrunt-js-test
.grunt-mocha is not actively maintained. It's using grunt-lib-phantomjs 0.4, they're on 0.7. grunt-lib-phantomjs is what provides the phantomjs library, this results in the tests running in an old version of phantomjs and not getting all the latest and greatest features.
As part of this minor rewrite, I've also removed the two useless tasks (
js-test-server-keepalive
andjs-test-save
).js-test-server-keepalive
is now built intojs-test-server
, andjs-test-save
is supposed to save the results of a coverage report after grunt-mocha had finished. Since the grunt-mocha task is now wrapped into thejs-test
task, thejs-test-save
task could also be wrapped into it. The newtasks/lib/save.js
file handles saving the coverage reports.Other misc cleanups include:
options
object forjs-test
andjs-test-server
views/deps/shared.js
)phantomjs
which was actually unused, and was just being wastefully downloaded.This is all in preparation for adding Selenium support to
grunt-js-test
usingselenium-webdriver
orwebdriverio
. Going to make it so you can decide whether to run your tests in phantomjs or configure a selenium server and run it in browsers such as Chrome, Firefox, IE, Safari, Opera, etc. I'd also like to start the discussion of the better library. It'll be easier to implement support usingselenium-webdriver
, the official selenium library for Node.js - however, webdriverio supports the full WebDriver Wire Protocol allowing it to also work with https://www.browserstack.com/ and http://testingbot.com/. Once this is completed, grunt-js-test can via a CI and easily run all the tests in multiple browsers, then generate reports.