Skip to content
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

Merged
merged 19 commits into from
May 3, 2017

Conversation

Autre31415
Copy link
Member

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 setting teddy.minify(true) on the client side to make it pass, but I plan to investigate the quirkiness further.

@coveralls
Copy link

Coverage Status

Coverage increased (+2.6%) to 89.979% when pulling 51167ad on Autre31415:karmaTesting into e64d8af on kethinov:master.

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"
Copy link
Member

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",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change cover to coverage

Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any way to suppress this error?

screen shot 2017-04-18 at 12 57 23 am

test/client.html Outdated
teddy.templates[template] = teddy.compile(req.response || req.responseText);
counter++;
if (counter === templateLength) {
if (counter++ === templateLength - 1) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clever but no

@coveralls
Copy link

Coverage Status

Coverage increased (+2.6%) to 89.979% when pulling 5b0bb10 on Autre31415:karmaTesting into e64d8af on kethinov:master.

@kethinov
Copy link
Member

Merge in the latest changes from 0.4.10.

@coveralls
Copy link

Coverage Status

Coverage increased (+2.6%) to 90.113% when pulling 4207254 on Autre31415:karmaTesting into 24066e2 on kethinov:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+2.6%) to 90.113% when pulling e54d865 on Autre31415:karmaTesting into 24066e2 on kethinov:master.

@kethinov
Copy link
Member

kethinov commented Apr 22, 2017

We should suppress these in the karma logs:

WARN: '<include> element found with no src attribute. Ignoring element.'
WARN: '<include> element found which references a nonexistent template ("noExist.html"). Ignoring element.'
WARN: '<arg> element found with no attribute. Ignoring parent <include> element. (<include src="misc/variable.html">)'
ERROR: 'Render aborted due to max number of passes (100) exceeded; there is a possible infinite loop in your template logic.'
WARN: 'teddy.render attempted to render a template which doesn't exist: .html'
WARN: 'teddy.render attempted to render a template which doesn't exist: .html'
WARN: 'teddy.render attempted to render a template which doesn't exist: .html'
WARN: 'loop element found with no "val" attribute. Ignoring element.'
WARN: 'loop element found with no "through" attribute. Ignoring element.'
WARN: 'loop element found with no "val" attribute. Ignoring element.

@kethinov
Copy link
Member

Will need to resolve the merge conflict and bring in 0.4.11.

@coveralls
Copy link

Coverage Status

Coverage increased (+5.2%) to 90.844% when pulling 0dd1447 on Autre31415:karmaTesting into fc78793 on kethinov:master.

@kethinov
Copy link
Member

kethinov commented May 3, 2017

@coveralls
Copy link

Coverage Status

Coverage increased (+4.0%) to 89.548% when pulling 408c343 on Autre31415:karmaTesting into fc78793 on kethinov:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+4.6%) to 90.151% when pulling d6cc9a5 on Autre31415:karmaTesting into fc78793 on kethinov:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+5.6%) to 91.165% when pulling fe19d48 on Autre31415:karmaTesting into fc78793 on kethinov:master.

@kethinov kethinov merged commit 67fe52d into rooseveltframework:master May 3, 2017
@Autre31415 Autre31415 deleted the karmaTesting branch May 3, 2017 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants