Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(344)

Issue 411763003: Set up mocha, chai and karma for sheriff-o-matic unit testing. (Closed)

Created:
6 years, 5 months ago by michaelpg
Modified:
6 years, 4 months ago
CC:
blink-reviews
Project:
blink
Visibility:
Public.

Description

Set up mocha, chai and karma for sheriff-o-matic unit testing. This is the first step in switching to the mocha testing framework. We'll use the Chai assertion library, which provides should-style, expect-style, and assert-style assertions. We should avoid 'should', since it modifies Object.prototype. 'expect' is more readable and flexible than 'assert', although the (optional) chaining keywords can make it overly verbose. For a full comparison, see: http://chaijs.com/guide/styles/ I've used 'expect' in the two example tests, but left out the unnecessary chaining keywords. This makes the most sense to me but feel free to disagree. Finally, Karma is a test runner that allows us to remotely run unit tests in Chrome from the command line. We may need to use some trickery to have this work for both Chrome and Chromium, but that is for another patch. R=esprehn@chromium.org,ojan@chromium.org NOTRY=true Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=179075

Patch Set 1 : #

Total comments: 31

Patch Set 2 : switch to BDD and assert #

Patch Set 3 : rm head/body tag #

Unified diffs Side-by-side diffs Delta from patch set Stats (+299 lines, -5 lines) Patch
M Tools/GardeningServer/.gitignore View 1 chunk +2 lines, -0 lines 0 comments Download
A Tools/GardeningServer/README-mocha View 1 1 chunk +39 lines, -0 lines 0 comments Download
M Tools/GardeningServer/bower.json View 1 chunk +2 lines, -1 line 0 comments Download
A Tools/GardeningServer/karma.conf.js View 1 1 chunk +76 lines, -0 lines 0 comments Download
A Tools/GardeningServer/package.json View 1 chunk +13 lines, -0 lines 0 comments Download
A Tools/GardeningServer/test/run-unit-tests.html View 1 2 1 chunk +30 lines, -0 lines 0 comments Download
A + Tools/GardeningServer/test/unit-tests.html View 1 chunk +2 lines, -4 lines 0 comments Download
A Tools/GardeningServer/ui/test/ct-builder-grid-tests.html View 1 1 chunk +88 lines, -0 lines 0 comments Download
A Tools/GardeningServer/ui/test/ct-builder-tests.html View 1 1 chunk +47 lines, -0 lines 0 comments Download

Messages

Total messages: 16 (0 generated)
michaelpg
https://codereview.chromium.org/411763003/diff/20001/Tools/GardeningServer/karma.conf.js File Tools/GardeningServer/karma.conf.js (right): https://codereview.chromium.org/411763003/diff/20001/Tools/GardeningServer/karma.conf.js#newcode55 Tools/GardeningServer/karma.conf.js:55: port: 9876, this is the default. would it be ...
6 years, 5 months ago (2014-07-22 22:52:35 UTC) #1
ojan
This l g t m. Much better than qunit. I'd like esprehn to take a ...
6 years, 5 months ago (2014-07-23 01:36:58 UTC) #2
michaelpg
Cool, thanks. Just a few responses below. https://codereview.chromium.org/411763003/diff/20001/Tools/GardeningServer/README-mocha File Tools/GardeningServer/README-mocha (right): https://codereview.chromium.org/411763003/diff/20001/Tools/GardeningServer/README-mocha#newcode16 Tools/GardeningServer/README-mocha:16: On 2014/07/23 ...
6 years, 5 months ago (2014-07-23 02:12:01 UTC) #3
ojan
https://codereview.chromium.org/411763003/diff/20001/Tools/GardeningServer/README-mocha File Tools/GardeningServer/README-mocha (right): https://codereview.chromium.org/411763003/diff/20001/Tools/GardeningServer/README-mocha#newcode16 Tools/GardeningServer/README-mocha:16: On 2014/07/23 02:12:01, michaelpg wrote: > On 2014/07/23 01:36:57, ...
6 years, 5 months ago (2014-07-23 02:38:37 UTC) #4
michaelpg
https://codereview.chromium.org/411763003/diff/20001/Tools/GardeningServer/README-mocha File Tools/GardeningServer/README-mocha (right): https://codereview.chromium.org/411763003/diff/20001/Tools/GardeningServer/README-mocha#newcode16 Tools/GardeningServer/README-mocha:16: On 2014/07/23 02:38:37, ojan-only-code-yellow-reviews wrote: > On 2014/07/23 02:12:01, ...
6 years, 5 months ago (2014-07-23 03:06:42 UTC) #5
esprehn
The expect() syntax is really weird, I never use that, I use assert.equals() and such ...
6 years, 5 months ago (2014-07-25 23:59:39 UTC) #6
michaelpg
I've switched to describe/it instead of suite/test, and use chai.assert instead of chai.expect per elliott's ...
6 years, 4 months ago (2014-07-28 20:35:05 UTC) #7
ojan
This all lgtm.
6 years, 4 months ago (2014-07-28 21:46:29 UTC) #8
esprehn
<html>, <head> and <body> are all optional elements, even in stand alone pages. You never ...
6 years, 4 months ago (2014-07-28 22:03:38 UTC) #9
michaelpg
The CQ bit was checked by michaelpg@chromium.org
6 years, 4 months ago (2014-07-28 22:34:11 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/michaelpg@chromium.org/411763003/80001
6 years, 4 months ago (2014-07-28 22:34:30 UTC) #11
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: mac_blink_rel on tryserver.blink ...
6 years, 4 months ago (2014-07-28 23:57:16 UTC) #12
michaelpg
The CQ bit was unchecked by michaelpg@chromium.org
6 years, 4 months ago (2014-07-29 00:27:00 UTC) #13
michaelpg
The CQ bit was checked by michaelpg@chromium.org
6 years, 4 months ago (2014-07-29 00:27:19 UTC) #14
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/michaelpg@chromium.org/411763003/80001
6 years, 4 months ago (2014-07-29 00:28:33 UTC) #15
commit-bot: I haz the power
6 years, 4 months ago (2014-07-29 00:29:40 UTC) #16
Message was sent while issue was closed.
Change committed as 179075

Powered by Google App Engine
This is Rietveld 408576698