-
Notifications
You must be signed in to change notification settings - Fork 27
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
Automate client tests with karma #126
Conversation
package.json
Outdated
@@ -56,7 +63,8 @@ | |||
"scripts": { | |||
"test": "cross-env NODE_ENV=test mocha --recursive test", | |||
"eslint": "eslint .", | |||
"cover": "cross-env NODE_ENV=cover istanbul cover _mocha --recursive test" | |||
"cover": "cross-env NODE_ENV=cover istanbul cover _mocha --recursive test", | |||
"karma": "karma start" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- change this to
test-client
- add another for
test-server
- make
npm test
run both the server and client tests
package.json
Outdated
@@ -56,7 +63,8 @@ | |||
"scripts": { | |||
"test": "cross-env NODE_ENV=test mocha --recursive test", | |||
"eslint": "eslint .", | |||
"cover": "cross-env NODE_ENV=cover istanbul cover _mocha --recursive test" | |||
"cover": "cross-env NODE_ENV=cover istanbul cover _mocha --recursive test", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change cover
to coverage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually no, alias coverage
to cover
, have both
@@ -0,0 +1,50 @@ | |||
// Karma configuration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test/client.html
Outdated
teddy.templates[template] = teddy.compile(req.response || req.responseText); | ||
counter++; | ||
if (counter === templateLength) { | ||
if (counter++ === templateLength - 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clever but no
Merge in the latest changes from 0.4.10. |
We should suppress these in the karma logs:
|
Will need to resolve the merge conflict and bring in 0.4.11. |
|
karma is a nifty module which allows us to run client side tests in the console. All of its functionality is split into separate modules so the way it behaves is very configurable.
This particular setup will run our client-side tests in Chrome by inputting the command
karma start
. (Chrome needs to be installed, which shouldn't be a problem for most of the planet ;) )This functionality has also been brought over to travis and all code coverage is captured.
Note: Currently the minification test is failing on the client due to some quirkyness of the
compile
step. For the moment I'm settingteddy.minify(true)
on the client side to make it pass, but I plan to investigate the quirkiness further.