diff --git a/.gitignore b/.gitignore index ab646e2..e0ac140 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ **/*.sw? +jenny_pollack/node_modules \ No newline at end of file diff --git a/README.md b/jenny_pollack/README.md similarity index 100% rename from README.md rename to jenny_pollack/README.md diff --git a/jenny_pollack/gulpfile.js b/jenny_pollack/gulpfile.js new file mode 100644 index 0000000..4f7724e --- /dev/null +++ b/jenny_pollack/gulpfile.js @@ -0,0 +1,45 @@ +var gulp = require('gulp'); +var jshint = require('gulp-jshint'); +var mocha = require('gulp-mocha'); +var appFiles = ['index.js', 'lib/**/*.js', 'bin/**/*.js']; +var testFiles = ['./test/**/*.js']; + +gulp.task('jshint:test', function() { + return gulp.src(testFiles) + .pipe(jshint({ + node: true, + globals: { + describe: true, + it: true, + before: true, + after: true + } + })) + .pipe(jshint.reporter('default')); +}); + +gulp.task('jshint:app', function() { + return gulp.src(appFiles) + .pipe(jshint({ + node: true + })) + .pipe(jshint.reporter('default')); +}); + +gulp.task('mocha', function(){ + return gulp.src(testFiles) + .pipe(jshint({ + node: true, + globals: { + describe: true, + it: true + } + })) + .pipe(mocha({reporter: 'spec'})); +}); + +gulp.watch(appFiles, ['mocha']); + + +gulp.task('jshint', ['jshint:test', 'jshint:app']); +gulp.task('default', ['jshint', 'mocha']); diff --git a/jenny_pollack/lib/greet.js b/jenny_pollack/lib/greet.js new file mode 100644 index 0000000..9462e18 --- /dev/null +++ b/jenny_pollack/lib/greet.js @@ -0,0 +1,11 @@ +'use strict'; + +var input = process.argv[2]; + +var greet = module.exports = function(name) { + return 'hello ' + name; +}; + +if(input){ + console.log(greet(input)); +} diff --git a/jenny_pollack/package.json b/jenny_pollack/package.json new file mode 100644 index 0000000..f394497 --- /dev/null +++ b/jenny_pollack/package.json @@ -0,0 +1,43 @@ +{ + "name": "jenny_pollack_greeting_app", + "version": "0.2.0", + "description": "greeting app assignment 2", + "main": "lib/greet.js", + "directories": { + "test": "test" + }, + "dependencies": { + "chai": "^3.4.0" + }, + "devDependencies": { + "chai": "^3.4.0", + "gulp": "^3.9.0", + "gulp-jshint": "^1.11.2", + "gulp-mocha": "^2.1.3", + "mocha": "^2.3.3" + }, + "scripts": { + "test": "gulp" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/jenpoll/simple-test-and-modular-patterns.git" + }, + "keywords": [ + "code", + "fellows", + "simple", + "modular", + "patterns", + "and", + "testing", + "gulp", + "package.json" + ], + "author": "Jenny Pollack", + "license": "MIT", + "bugs": { + "url": "https://github.com/jenpoll/simple-test-and-modular-patterns/issues" + }, + "homepage": "https://github.com/jenpoll/simple-test-and-modular-patterns#readme" +} diff --git a/jenny_pollack/test/greet_test.js b/jenny_pollack/test/greet_test.js new file mode 100644 index 0000000..b67608d --- /dev/null +++ b/jenny_pollack/test/greet_test.js @@ -0,0 +1,12 @@ +'use strict'; + +var expect = require('chai').expect; +var greet = require(__dirname + '/../lib/greet'); + +//test that verifies the output of the function +describe('the greet function', function(){ + it('should say hello name, where name is the argument', function(){ + expect(greet('jenny')).to.eql('hello jenny'); + }); + +});