From 916fa5262abbda269f8b2c5664b4f77ca79d8d9b Mon Sep 17 00:00:00 2001 From: Jenny Pollack Date: Tue, 27 Oct 2015 11:33:39 -0700 Subject: [PATCH 1/3] add files for assignment1 --- .gitignore | 1 + README.md => jenny_pollack/README.md | 0 jenny_pollack/lib/greet.js | 11 +++++++++++ jenny_pollack/test/greet_test.js | 12 ++++++++++++ 4 files changed, 24 insertions(+) rename README.md => jenny_pollack/README.md (100%) create mode 100644 jenny_pollack/lib/greet.js create mode 100644 jenny_pollack/test/greet_test.js 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/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/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'); + }); + +}); From 2b232a15478d03f65e7a4ed65b566dd35f99da36 Mon Sep 17 00:00:00 2001 From: Jenny Pollack Date: Thu, 29 Oct 2015 11:13:46 -0700 Subject: [PATCH 2/3] assignment 2 without bonus attempt --- jenny_pollack/gulpfile.js | 42 ++++++++++++++++++++++++++++++++++++ jenny_pollack/package.json | 44 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 jenny_pollack/gulpfile.js create mode 100644 jenny_pollack/package.json diff --git a/jenny_pollack/gulpfile.js b/jenny_pollack/gulpfile.js new file mode 100644 index 0000000..97ecb62 --- /dev/null +++ b/jenny_pollack/gulpfile.js @@ -0,0 +1,42 @@ +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.task('jshint', ['jshint:test', 'jshint:app']); +gulp.task('default', ['jshint', 'mocha']); diff --git a/jenny_pollack/package.json b/jenny_pollack/package.json new file mode 100644 index 0000000..53ab60a --- /dev/null +++ b/jenny_pollack/package.json @@ -0,0 +1,44 @@ +{ + "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", + "gulp-watch": "^4.3.5", + "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" +} From ba06fda4931e3a01225a25a91e8f94182b20097b Mon Sep 17 00:00:00 2001 From: Jenny Pollack Date: Thu, 29 Oct 2015 11:43:40 -0700 Subject: [PATCH 3/3] assignment 2 with gulp.watch --- jenny_pollack/gulpfile.js | 3 +++ jenny_pollack/package.json | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/jenny_pollack/gulpfile.js b/jenny_pollack/gulpfile.js index 97ecb62..4f7724e 100644 --- a/jenny_pollack/gulpfile.js +++ b/jenny_pollack/gulpfile.js @@ -38,5 +38,8 @@ gulp.task('mocha', function(){ .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/package.json b/jenny_pollack/package.json index 53ab60a..f394497 100644 --- a/jenny_pollack/package.json +++ b/jenny_pollack/package.json @@ -14,7 +14,6 @@ "gulp": "^3.9.0", "gulp-jshint": "^1.11.2", "gulp-mocha": "^2.1.3", - "gulp-watch": "^4.3.5", "mocha": "^2.3.3" }, "scripts": {