From e2cfdc54f5ea46e957e90aa4a438a0197d6600ba Mon Sep 17 00:00:00 2001 From: Rick Patci Date: Tue, 27 Oct 2015 12:49:58 -0700 Subject: [PATCH 1/2] push back to fork --- .gitignore | 1 + index.js | 5 +++++ lib/greet.js | 5 +++++ test/greet_test.js | 11 +++++++++++ 4 files changed, 22 insertions(+) create mode 100644 index.js create mode 100644 lib/greet.js create mode 100644 test/greet_test.js diff --git a/.gitignore b/.gitignore index ab646e2..6408a29 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ **/*.sw? +/node_modules diff --git a/index.js b/index.js new file mode 100644 index 0000000..b97f1b3 --- /dev/null +++ b/index.js @@ -0,0 +1,5 @@ +'use strict'; + +var name = process.argv[2]; +var greet = require(__dirname + '/lib/greet'); +console.log(greet(name)); diff --git a/lib/greet.js b/lib/greet.js new file mode 100644 index 0000000..2958986 --- /dev/null +++ b/lib/greet.js @@ -0,0 +1,5 @@ +'use strict'; + +var greet = exports = module.exports = function(name) { + return 'Hello, ' + name + '.'; +}; diff --git a/test/greet_test.js b/test/greet_test.js new file mode 100644 index 0000000..5bb72fe --- /dev/null +++ b/test/greet_test.js @@ -0,0 +1,11 @@ +'use strict'; + +var expect = require('chai').expect; +var greetings = require(__dirname + '/../lib/greet'); + +describe('the greet function', function() { + it('should greet someone by name', function() { + var name = 'Rick'; + expect(greetings(name)).to.eql('Hello, ' + name + '.'); + }); +}); From 06fff116274fd46de4c0b61121cd2fd3ad17e2cc Mon Sep 17 00:00:00 2001 From: Rick Patci Date: Thu, 29 Oct 2015 23:27:24 -0700 Subject: [PATCH 2/2] add gulpfile and package.json --- gulpfile.js | 29 +++++++++++++++++++++++++++++ package.json | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 gulpfile.js create mode 100644 package.json diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..3ddc863 --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,29 @@ +var gulp = require('gulp'); +var jshint = require('gulp-jshint'); +var appFiles = ['index.js', 'lib/**/*.js', 'bin/**/*.js']; //all files in jshint that are NOT test files +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('jshint', ['jshint:test', 'jshint:app']); +gulp.task('default', ['jshint']); diff --git a/package.json b/package.json new file mode 100644 index 0000000..bb61230 --- /dev/null +++ b/package.json @@ -0,0 +1,34 @@ +{ + "name": "simple-test-and-modular-patterns", + "version": "0.1.0", + "description": "Modular Pattern Testing (Mocha, Chai, Gulp).", + "main": "index.js", + "directories": { + "test": "test" + }, + "dependencies": {}, + "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": "./node_modules/mocha/bin/mocha test" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/patci/simple-test-and-modular-patterns.git" + }, + "author": { + "name": "Rick Patci", + "alias": "Patci", + "email": "rpatci@gmail.com" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/patci/simple-test-and-modular-patterns/issues" + }, + "homepage": "https://github.com/patci/simple-test-and-modular-patterns#readme" +}