General

https://github.com/MichaelPaulukonis/eslint/ forked from https://github.com/ilyavolodin/eslint

 

I’m working on adding mocha/chai unit-tests to the Unittest branch

 

git checkout Unittest

 

grunt mocha

 

 

tests are inside of tests/mocha/lib/rules or https://github.com/MichaelPaulukonis/eslint/tree/Unittest/tests/mocha/lib/rules

 

conversion of original vows tests seen @ https://github.com/MichaelPaulukonis/eslint/blob/master/tests/lib/rules/

 

I’m working “bottom-up”

 

 

d:\Dropbox\projects\eslint\node_modules\grunt-mocha-test\Gruntfile.js

 

I just updated a pull request on the eslint with comments for eslintTester which has explanation about the formatting that should be used to write new tests. Also, the only way right now to run individual tests is to install mocha globally ([@npm install –g mocha@]) and then run tests on individual files (mocha tests/mocha/lib/rules/yourfilename.js). As far as I know, grunt doesn’t support arbitrary command line parameters, so I don’t think there’s a way to do it through grunt. If you REALLY don’t want to install mocha globally, then you can always call local version from node_packages.

While vows tests might’ve been easier to understand, they also took significantly longer to write (just because you had to repeat yourself all the time). That’s what we are trying to fix. I think once you read the comments in eslintTester and look at the few tests that I already converted, it should be pretty clear how to do it.

 

DRY and convert all unittests to mocha (Issue #397) - checklist of remaining tests to convert

 

 

custom harness around mocha/chai

In the master branch,
eslintTester.js
And the master conversions

 

 

grunt

http://gruntjs.com/getting-started
http://merrickchristensen.com/articles/gruntjs-workflow.html

 

 

See Also

EsLint
http://phawk.co.uk/blog/testing-node-apps-with-mocha
https://npmjs.org/package/chai
http://howtonode.org/simplifying-chores-with-grunt
http://gruntjs.com/
https://github.com/nzakas/eslint

 

Tags

JavaScript