Skip to content

Commit

Permalink
* re-write tests to mocha, remove null check
Browse files Browse the repository at this point in the history
  • Loading branch information
Meettya committed Jan 27, 2013
1 parent f784020 commit 0a166c0
Show file tree
Hide file tree
Showing 11 changed files with 633 additions and 632 deletions.
1 change: 0 additions & 1 deletion .npmignore
@@ -1,4 +1,3 @@
support
test
examples
*.sock
27 changes: 19 additions & 8 deletions Cakefile
Expand Up @@ -15,13 +15,24 @@ if enableColors
reset = '\x1B[0m'


# Run a CoffeeScript through our node/coffee interpreter.
run = (args, cb) ->
proc = spawn 'node', ['./node_modules/.bin/coffee'].concat(args)
proc.stderr.on 'data', (buffer) -> console.log buffer.toString()
###
Just proc extender
###
proc_extender = (cb, proc) =>
proc.stderr.on 'data', (buffer) -> console.log "#{buffer}"
# proc.stdout.on 'data', (buffer) -> console.log "#{buffer}".info
proc.on 'exit', (status) ->
process.exit(1) if status != 0
cb() if typeof cb is 'function'
cb() if typeof cb is 'function'
null

# Run a CoffeeScript through our node/coffee interpreter.
run_coffee = (args, cb) =>
proc_extender cb, spawn 'node', ['./node_modules/.bin/coffee'].concat(args)

# Run a mocha tests
run_mocha = (args, cb) =>
proc_extender cb, spawn 'node', ['./node_modules/.bin/mocha'].concat(args)

# Log a message with a color.
log = (message, color, explanation) ->
Expand All @@ -31,11 +42,11 @@ log = (message, color, explanation) ->
task 'build', 'build module from source', build = (cb) ->
files = fs.readdirSync 'src'
files = ('src/' + file for file in files when file.match(/\.coffee$/))
run ['-c', '-o', 'lib/'].concat(files), cb
run_coffee ['-c', '-o', 'lib/'].concat(files), cb
log ' -> build done', green

task 'test', 'test builded module', ->
build ->
test_file = 'test/run.coffee'
run test_file, -> log ' -> all tests passed :)', green
test_file = './test/extend_test.coffee'
run_mocha test_file, -> log ' -> all tests passed :)', green

6 changes: 6 additions & 0 deletions History.md
@@ -1,3 +1,9 @@
## 0.9.9 / 2013-01-28 01:20 AM

- Re-write tests to Mocha
- Remove 'null' and 'undefined' filter
- Fix Cakefile

## 0.9.7 / 2012-06-21 02:54 PM

- Rename extend.{ext} -> whet.extend.{ext}
Expand Down
4 changes: 1 addition & 3 deletions lib/whet.extend.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 22 additions & 13 deletions package.json
@@ -1,23 +1,32 @@
{
"name" : "whet.extend",
"version" : "0.9.7",
"description" : "A sharped version of port of jQuery.extend that actually works on node.js",
"keywords" : [ "extend", "jQuery", "jQuery extend", "clone", "copy", "inherit" ],
"author" : "Dmitrii Karpich <meettya@gmail.com>",
"name": "whet.extend",
"version": "0.9.9",
"description": "A sharped version of port of jQuery.extend that actually works on node.js",
"keywords": [
"extend",
"jQuery",
"jQuery extend",
"clone",
"copy",
"inherit"
],
"author": "Dmitrii Karpich <meettya@gmail.com>",
"devDependencies": {
"should": "0.5.1",
"coffee-script": ">=1.3.3"
"coffee-script": ">=1.3.3",
"chai": "~1.4.2",
"mocha": "~1.8.1"
},
"scripts": {
"test": "cake test"
},
"repository" : {
"repository": {
"type": "git",
"url" : "https://github.com/Meettya/whet.extend.git"
"url": "https://github.com/Meettya/whet.extend.git"
},
"main": "index.js",
"engines": {
"node": ">=0.6.0"
},
"main" : "index.js",
"engines" : {
"node": ">=0.6.0"
},
"license": "MIT"
}
}
2 changes: 1 addition & 1 deletion src/whet.extend.coffee
Expand Up @@ -17,7 +17,7 @@ module.exports = extend = (deep, target, args...) ->
target = {} if _isPrimitiveType target

for options in args when options?
for name, copy of options when copy? and target[name] isnt copy
for name, copy of options
target[name] = _findValue deep, copy, target[name]

target
Expand Down

0 comments on commit 0a166c0

Please sign in to comment.