Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
**/*.sw?
jenny_pollack/node_modules
File renamed without changes.
45 changes: 45 additions & 0 deletions jenny_pollack/gulpfile.js
Original file line number Diff line number Diff line change
@@ -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']);
11 changes: 11 additions & 0 deletions jenny_pollack/lib/greet.js
Original file line number Diff line number Diff line change
@@ -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));
}
43 changes: 43 additions & 0 deletions jenny_pollack/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
12 changes: 12 additions & 0 deletions jenny_pollack/test/greet_test.js
Original file line number Diff line number Diff line change
@@ -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');
});

});