Skip to content
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
**/*.sw?

node_modules

9 changes: 9 additions & 0 deletions isabella_organ/bin/greet.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env node

var greet = require(__dirname + '/../lib/greet.js');
var bin = exports = module.exports = function() {
console.log(greet(process.argv[2] || 'anonymous'));
return greet(process.argv[2] || 'anonymous');
};
debugger;
bin();
29 changes: 29 additions & 0 deletions isabella_organ/gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
var gulp = require('gulp');
var jshint = require('gulp-jshint');
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('jshint', ['jshint:test', 'jshint:app']);
gulp.task('default', ['jshint']);
1 change: 1 addition & 0 deletions isabella_organ/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require(__dirname + '/lib/greet');
5 changes: 5 additions & 0 deletions isabella_organ/lib/greet.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict';

module.exports = function(name) {
return 'hello ' + name;
};
5 changes: 5 additions & 0 deletions isabella_organ/lib/greet_2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict';

exports.greet = function(name) {
return 'hello ' + name;
};
10 changes: 10 additions & 0 deletions isabella_organ/lib/greet_3.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
'use strict';

//use constructor
var Greet = exports = module.exports = function() {
this.greeting = 'hello world';
};

Greet.prototype.greet = function() {
return this.greeting;
};
40 changes: 40 additions & 0 deletions isabella_organ/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "isabella_organ",
"version": "1.0.0",
"description": "Simple Test and Modular Patterns",
"main": "index.js",
"directories": {
"test": "test"
},
"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",
"start": "echo 'hello world'",
"custom": "echo 'custom'"
},
"repository": {
"type": "git",
"url": "git+https://github.com/isabellaorgan/simple-test-and-modular-patterns.git"
},
"keywords": [
"test",
"mocha",
"chai",
"modules",
"node",
"json",
"gulp"
],
"author": "isabellaorgan@gmail.com",
"license": "MIT",
"bugs": {
"url": "https://github.com/isabellaorgan/simple-test-and-modular-patterns/issues"
},
"homepage": "https://github.com/isabellaorgan/simple-test-and-modular-patterns#readme"
}
36 changes: 36 additions & 0 deletions isabella_organ/test/greet_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
var expect = require('chai').expect;
var greet = require(__dirname + '/../bin/greet.js');

describe('greet bin', function() {
before(function() {
this.backup = process.argv;
process.argv = {};
});

after(function() {
process.argv = this.backup;
debugger;
});

it ('should greet anonymous', function() {
debugger;
expect(greet()).to.eql('hello anonymous');
});

describe('with arguments', function() {
before(function() {
this.backup = process.argv;
process.argv = ['node', 'myfile', 'test name'];
});

after(function() {
process.argv = this.backup;
debugger;
});

it('should pull from process.argv', function() {
expect(greet()).to.eql('hello test name');
});
});
});
debugger;