diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..2ccbe46 --- /dev/null +++ b/.npmignore @@ -0,0 +1 @@ +/node_modules/ diff --git a/LICENSE-MIT b/LICENSE-MIT new file mode 100644 index 0000000..88f77bc --- /dev/null +++ b/LICENSE-MIT @@ -0,0 +1,22 @@ +Copyright (c) 2012 Nick Nisi + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..bfdad31 --- /dev/null +++ b/README.md @@ -0,0 +1,28 @@ +# grunt-it + +A grunt task for executing tests written with the it test framework + +## Getting Started +Install this grunt plugin next to your project's [grunt.js gruntfile][getting_started] with: `npm install grunt-it` + +Then add this line to your project's `grunt.js` gruntfile: + +```javascript +grunt.loadNpmTasks('grunt-it'); +``` + +[grunt]: http://gruntjs.com/ +[getting_started]: https://github.com/gruntjs/grunt/blob/master/docs/getting_started.md + +## Documentation +_(Coming soon)_ + +## Contributing +In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [grunt][grunt]. + +## Release History +_(Nothing yet)_ + +## License +Copyright (c) 2012 Nick Nisi +Licensed under the MIT license. diff --git a/bin/grunt-it b/bin/grunt-it new file mode 100644 index 0000000..3cd6b4c --- /dev/null +++ b/bin/grunt-it @@ -0,0 +1,2 @@ +#!/usr/bin/env node +require('grunt').npmTasks('grunt-it').cli(); diff --git a/grunt.js b/grunt.js new file mode 100644 index 0000000..008da40 --- /dev/null +++ b/grunt.js @@ -0,0 +1,40 @@ +module.exports = function(grunt) { + + // Project configuration. + grunt.initConfig({ + test: { + files: ['test/**/*.js'] + }, + lint: { + files: ['grunt.js', 'tasks/**/*.js', 'test/**/*.js'] + }, + watch: { + files: '', + tasks: 'default' + }, + jshint: { + options: { + curly: true, + eqeqeq: true, + immed: true, + latedef: true, + newcap: true, + noarg: true, + sub: true, + undef: true, + boss: true, + eqnull: true, + node: true, + es5: true + }, + globals: {} + } + }); + + // Load local tasks. + grunt.loadTasks('tasks'); + + // Default task. + grunt.registerTask('default', 'lint test'); + +}; diff --git a/package.json b/package.json new file mode 100644 index 0000000..4642404 --- /dev/null +++ b/package.json @@ -0,0 +1,37 @@ +{ + "name": "grunt-it", + "description": "A grunt task for executing tests written with the it test framework", + "version": "0.1.0", + "homepage": "https://github.com/nicknisi/grunt-it", + "author": { + "name": "Nick Nisi", + "email": "nick@nisi.org" + }, + "repository": { + "type": "git", + "url": "git://github.com/nicknisi/grunt-it.git" + }, + "bugs": { + "url": "https://github.com/nicknisi/grunt-it/issues" + }, + "licenses": [ + { + "type": "MIT", + "url": "https://github.com/nicknisi/grunt-it/blob/master/LICENSE-MIT" + } + ], + "main": "grunt.js", + "bin": "bin/grunt-it", + "engines": { + "node": "*" + }, + "scripts": { + "test": "grunt test" + }, + "devDependencies": { + "grunt": "~0.3.17" + }, + "keywords": [ + "gruntplugin" + ] +} \ No newline at end of file diff --git a/tasks/it.js b/tasks/it.js new file mode 100644 index 0000000..363e99c --- /dev/null +++ b/tasks/it.js @@ -0,0 +1,30 @@ +/* + * grunt-it + * https://github.com/nicknisi/grunt-it + * + * Copyright (c) 2012 Nick Nisi + * Licensed under the MIT license. + */ + +module.exports = function(grunt) { + + // Please see the grunt documentation for more information regarding task and + // helper creation: https://github.com/gruntjs/grunt/blob/master/docs/toc.md + + // ========================================================================== + // TASKS + // ========================================================================== + + grunt.registerTask('it', 'Your task description goes here.', function() { + grunt.log.write(grunt.helper('it')); + }); + + // ========================================================================== + // HELPERS + // ========================================================================== + + grunt.registerHelper('it', function() { + return 'it!!!'; + }); + +}; diff --git a/test/it_test.js b/test/it_test.js new file mode 100644 index 0000000..75440f9 --- /dev/null +++ b/test/it_test.js @@ -0,0 +1,34 @@ +var grunt = require('grunt'); + +/* + ======== A Handy Little Nodeunit Reference ======== + https://github.com/caolan/nodeunit + + Test methods: + test.expect(numAssertions) + test.done() + Test assertions: + test.ok(value, [message]) + test.equal(actual, expected, [message]) + test.notEqual(actual, expected, [message]) + test.deepEqual(actual, expected, [message]) + test.notDeepEqual(actual, expected, [message]) + test.strictEqual(actual, expected, [message]) + test.notStrictEqual(actual, expected, [message]) + test.throws(block, [error], [message]) + test.doesNotThrow(block, [error], [message]) + test.ifError(value) +*/ + +exports['it'] = { + setUp: function(done) { + // setup here + done(); + }, + 'helper': function(test) { + test.expect(1); + // tests here + test.equal(grunt.helper('it'), 'it!!!', 'should return the correct value.'); + test.done(); + } +};