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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/node_modules
.DS_Store
27 changes: 0 additions & 27 deletions README.md

This file was deleted.

78 changes: 78 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
const gulp = require('gulp');
const mocha = require('gulp-mocha');
const lint = require('gulp-eslint');
const merge = require('merge-stream');

const gulpFiles = {
testFilesSrc: './test/greet-test.js',
greetSrc: './greet.js'
}

const opts = {
'extends': 'eslint:recommended',
'ecmaFeatures': {
'modules': true
},
'rules': {
'no-alert': 0,
'no-bitwise': 0,
'camelcase': 1,
'no-console': 1,
'curly': 1,
'eqeqeq': 0,
'no-eq-null': 0,
'guard-for-in': 1,
'no-empty': 1,
'no-use-before-define': 0,
'no-obj-calls': 2,
'no-unused-vars': 0,
'new-cap': 1,
'no-shadow': 0,
'strict': 1,
'no-invalid-regexp': 2,
'comma-dangle': 2,
'no-undef': 1,
'no-new': 1,
'no-extra-semi': 1,
'no-debugger': 2,
'no-caller': 1,
'semi': 1,
'quotes': 0,
'no-unreachable': 2
},

'globals': {
'$': false
},

'env': {
'node': true,
'es6': true
}
}


gulp.task('linter' , () => {
var greet = gulp.src(gulpFiles.greetSrc)
.pipe(lint(opts))
.pipe(lint.format());
var greetTest = gulp.src(gulpFiles.testFilesSrc)
.pipe(lint(opts))
.pipe(lint.format());

return merge(greet, greetTest);
})

gulp.task('tests', () => {
return gulp.src(gulpFiles.testFilesSrc, {read: false})
.pipe(mocha({reporter: 'nyan'}));
})

gulp.task('watch', () => {
gulp.watch(gulpFiles.testFilesSrc, ['linter', 'tests']);
gulp.watch(gulpFiles.greetSrc, ['linter', 'tests']);
})

gulp.task('default', ['watch', 'linter', 'tests'], () => {
console.log('All tasks completed successfully')
});
30 changes: 30 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "stefanie-hansen",
"version": "1.0.0",
"description": "##To Submit this Assignment * fork this repository * write all of your code in a folder containing your name * push to your repository * submit a pull request to this repository * submit a link to your PR in canvas",
"main": "greet.js",
"directories": {
"test": "test"
},
"devDependencies": {
"chai": "^3.5.0",
"gulp": "^3.9.1",
"gulp-eslint": "^2.0.0",
"gulp-mocha": "^2.2.0",
"merge-stream": "^1.0.0",
"mocha": "^2.4.5"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/stefuhnee/simple_modular_patterns_and_tests.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/stefuhnee/simple_modular_patterns_and_tests/issues"
},
"homepage": "https://github.com/stefuhnee/simple_modular_patterns_and_tests#readme"
}
17 changes: 17 additions & 0 deletions test/greet-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
'use strict';

const expect = require('chai').expect;
const greet = require('../greet.js');

describe('Greeting test', () => {
it('should return a greeting with friend if no argument given', function() {
expect(greet()).to.eql('Hello friend');
});
});

describe('Greeting test via command line utility', function() {
it('should return a greeting with the name passed in the command line', function() {
process.argv = ['node', 'Users/Stefanie/cf/401/class-01/stefanie-hansen/greet.js', 'Stefanie'];
expect(greet(process.argv[2])).to.eql('Hello Stefanie');
});
});