Last active
December 10, 2015 13:29
-
-
Save kazupon/4441219 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.DS_Store | |
node_modules | |
npm-debug.log | |
*.swp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
module.exports = function (a, b) { | |
return a + b; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var test = require('tape'); | |
var add = require('../lib/add'); | |
/* | |
* tape little reference | |
* ===================== | |
* | |
* reference url | |
* ------------- | |
* https://github.com/substack/tape | |
* | |
* API | |
* --- | |
* - test(name, cb) | |
* - t.plan(n) | |
* - t.end() | |
* - t.fail(msg) | |
* - t.pass(msg) | |
* - t.skip(msg) | |
* - t.ok(value, msg) | |
* Aliases: t.true, t.assert | |
* - t.notOk(value, msg) | |
* Aliases: t.false, t.notok | |
* - t.error(err, msg) | |
* Aliases: t.ifError, t.ifErr, t.iferror | |
* - t.equal(a, b, msg) | |
* Aliases: t.equals, t.isEqual, t.is, t.strictEqual, t.strictEquals | |
* - t.notEqual(a, b, msg) | |
* Aliases: t.notEqual, t.notStrictEqual, t.notStrictEquals, t.isNotEqual, t.isNot, t.not, t.doesNotEqual, t.isInequal | |
* - t.deepEqual(a, b, msg) | |
* Aliases: t.deepEquals, t.isEquivalent, t.looseEqual, t.looseEquals, t.same | |
* - t.notDeepEqual(a, b, msg) | |
* Aliases: t.notEquivalent, t.notDeeply, t.notSame, | |
* t.isNotDeepEqual, t.isNotDeeply, t.isNotEquivalent, t.isInequivalent | |
* - t.throws(fn, expected, msg) | |
* - t.doesNotThrow(fn, expected, msg) | |
* - t.test(name, cb) | |
* - var htest = test.createHarness() | |
*/ | |
test('add', function (t) { | |
t.same(add(1, 1), 2); | |
t.end(); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
module.exports = function (grunt) { // (1): exports | |
// (2): task configuration | |
grunt.initConfig({ | |
jshint: { | |
options: { | |
node: true | |
}, | |
files: { | |
src: [ 'Gruntfile.js' ] | |
} | |
} | |
}); | |
// (3): load plugin task(s) | |
grunt.loadNpmTasks('grunt-contrib-jshint'); | |
// (4): default task(s) | |
grunt.registerTask('default', [ 'jshint' ]); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "foo", | |
"version": "0.0.1", | |
"description": "this is sample grunt project.", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"repository": { | |
"type": "git", | |
"url": "git@gist.github.com:4441219.git" | |
}, | |
"author": "kazupon", | |
"license": "MIT", | |
"devDependencies": { | |
"grunt": "~0.4.0rc4", | |
"grunt-contrib-jshint": "~0.1.0", | |
"tape": "~0.1.5" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"test.js": "test/{%= module_name %}.test.js" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
// Basic template description. | |
exports.description = 'Create a unit test code file.'; | |
// Template-specific notes to be displayed before question prompts. | |
exports.notes = 'Please specify the name of the module that is under lib/.'; | |
// Any existing file or directory matching this wildcard will cause a warning. | |
//exports.warnOn = 'test/*.js'; | |
// The actual init template. | |
exports.template = function (grunt, init, done) { // (1): exports | |
init.process({}, [ | |
// (2): | |
// Prompt for these values. | |
{ | |
name: 'module_name', | |
message: 'What is module name ?', | |
default: '', | |
warning: 'Should be a module name' | |
} | |
], function (err, props) { | |
// (3): | |
// Files to copy (and process). | |
var files = init.filesToCopy(props); | |
// (4): | |
// Actually copy (and process) files. | |
init.copyAndProcess(files, props); | |
// (5): | |
// All done! | |
done(); | |
}); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var test = require('tape'); | |
var {%= module_name %} = require('../lib/{%= module_name %}'); | |
/* | |
* tape little reference | |
* ===================== | |
* | |
* reference url | |
* ------------- | |
* https://github.com/substack/tape | |
* | |
* API | |
* --- | |
* - test(name, cb) | |
* - t.plan(n) | |
* - t.end() | |
* - t.fail(msg) | |
* - t.pass(msg) | |
* - t.skip(msg) | |
* - t.ok(value, msg) | |
* Aliases: t.true, t.assert | |
* - t.notOk(value, msg) | |
* Aliases: t.false, t.notok | |
* - t.error(err, msg) | |
* Aliases: t.ifError, t.ifErr, t.iferror | |
* - t.equal(a, b, msg) | |
* Aliases: t.equals, t.isEqual, t.is, t.strictEqual, t.strictEquals | |
* - t.notEqual(a, b, msg) | |
* Aliases: t.notEqual, t.notStrictEqual, t.notStrictEquals, t.isNotEqual, t.isNot, t.not, t.doesNotEqual, t.isInequal | |
* - t.deepEqual(a, b, msg) | |
* Aliases: t.deepEquals, t.isEquivalent, t.looseEqual, t.looseEquals, t.same | |
* - t.notDeepEqual(a, b, msg) | |
* Aliases: t.notEquivalent, t.notDeeply, t.notSame, | |
* t.isNotDeepEqual, t.isNotDeeply, t.isNotEquivalent, t.isInequivalent | |
* - t.throws(fn, expected, msg) | |
* - t.doesNotThrow(fn, expected, msg) | |
* - t.test(name, cb) | |
* - var htest = test.createHarness() | |
*/ | |
test('{%= module_name %}', function (t) { | |
t.fail('should be implemnted test !!'); | |
t.end(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment