Skip to content

Commit

Permalink
fixed test causes
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 committed Jun 24, 2013
1 parent 02d3f48 commit 4ca227c
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 30 deletions.
5 changes: 3 additions & 2 deletions .travis.yml
@@ -1,5 +1,6 @@
language: node_js language: node_js
node_js: node_js:
- 0.9
- 0.8 - 0.8
- 0.6 - '0.10'
- '0.11'
script: make test-coveralls
2 changes: 1 addition & 1 deletion LICENSE.txt
@@ -1,6 +1,6 @@
This software is licensed under the MIT License. This software is licensed under the MIT License.


Copyright (C) 2012 by fengmk2 <fengmk2@gmail.com> Copyright (C) 2012 - 2013 by fengmk2 <fengmk2@gmail.com>


Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
Expand Down
28 changes: 19 additions & 9 deletions Makefile
@@ -1,20 +1,30 @@
TESTS = test/*.test.js TESTS = test/*.test.js
REPORTER = spec REPORTER = spec
TIMEOUT = 10000 TIMEOUT = 10000
JSCOVERAGE = ./node_modules/jscover/bin/jscover MOCHA_OPTS =


test: install:
@npm install

test: install
@NODE_ENV=test ./node_modules/mocha/bin/mocha \ @NODE_ENV=test ./node_modules/mocha/bin/mocha \
--bail \
--reporter $(REPORTER) \ --reporter $(REPORTER) \
--timeout $(TIMEOUT) \ --timeout $(TIMEOUT) \
$(MOCHA_OPTS) \
$(TESTS) $(TESTS)


test-cov: lib-cov test-cov:
@FORMSTREAM_COV=1 $(MAKE) test REPORTER=dot @rm -f coverage.html
@FORMSTREAM_COV=1 $(MAKE) test REPORTER=html-cov > coverage.html @$(MAKE) test MOCHA_OPTS='--require blanket' REPORTER=html-cov > coverage.html
@$(MAKE) test MOCHA_OPTS='--require blanket' REPORTER=travis-cov
@ls -lh coverage.html

test-coveralls:
@$(MAKE) test
@echo TRAVIS_JOB_ID $(TRAVIS_JOB_ID)
@$(MAKE) test MOCHA_OPTS='--require blanket' REPORTER=mocha-lcov-reporter | ./node_modules/coveralls/bin/coveralls.js


lib-cov: test-all: test test-cov
@rm -rf $@
@$(JSCOVERAGE) lib $@


.PHONY: test-cov test lib-cov .PHONY: test test-cov test-all test-coveralls
8 changes: 3 additions & 5 deletions README.md
@@ -1,12 +1,10 @@
formstream [![Build Status](https://secure.travis-ci.org/fengmk2/formstream.png)](http://travis-ci.org/fengmk2/formstream) [![Dependencies](http://david-dm.org/fengmk2/formstream.png)](http://david-dm.org/fengmk2/formstream) formstream [![Build Status](https://secure.travis-ci.org/fengmk2/formstream.png)](http://travis-ci.org/fengmk2/formstream) [![Coverage Status](https://coveralls.io/repos/fengmk2/formstream/badge.png)](https://coveralls.io/r/fengmk2/formstream)
========== ==========


![logo](https://raw.github.com/fengmk2/formstream/master/logo.png) ![logo](https://raw.github.com/fengmk2/formstream/master/logo.png)


A [multipart/form-data](http://tools.ietf.org/html/rfc2388) encoded stream, helper for file upload. A [multipart/form-data](http://tools.ietf.org/html/rfc2388) encoded stream, helper for file upload.


jscoverage: [100%](http://fengmk2.github.com/coverage/formstream.html)

## Install ## Install


```bash ```bash
Expand Down Expand Up @@ -82,7 +80,7 @@ fs.stat('./logo.png', function (err, stat) {


(The MIT License) (The MIT License)


Copyright (c) 2012 fengmk2 &lt;fengmk2@gmail.com&gt; Copyright (c) 2012 - 2013 fengmk2 &lt;fengmk2@gmail.com&gt;


Permission is hereby granted, free of charge, to any person obtaining Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the a copy of this software and associated documentation files (the
Expand All @@ -101,4 +99,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2 changes: 1 addition & 1 deletion index.js
@@ -1 +1 @@
module.exports = process.env.FORMSTREAM_COV ? require('./lib-cov/formstream') : require('./lib/formstream'); module.exports = require('./lib/formstream');
15 changes: 8 additions & 7 deletions package.json
Expand Up @@ -3,12 +3,10 @@
"version": "0.0.5", "version": "0.0.5",
"description": "A multipart/form-data encoded stream, helper for file upload.", "description": "A multipart/form-data encoded stream, helper for file upload.",
"main": "index.js", "main": "index.js",
"directories": {
"example": "example",
"test": "test"
},
"scripts": { "scripts": {
"test": "make test" "test": "make test-all",
"blanket": { "pattern": "formstream/lib" },
"travis-cov": { "threshold": 100 }
}, },
"repository": { "repository": {
"type": "git", "type": "git",
Expand All @@ -26,13 +24,16 @@
"dependencies": { "dependencies": {
"mime": "1.2.9", "mime": "1.2.9",
"buffer-concat": "0.0.1", "buffer-concat": "0.0.1",
"pause-stream": "0.0.9" "pause-stream": ">=0.0.10"
}, },
"devDependencies": { "devDependencies": {
"connect": "*", "connect": "*",
"should": "*", "should": "*",
"pedding": "*", "pedding": "*",
"jscover": "*", "blanket": "*",
"travis-cov": "*",
"coveralls": "*",
"mocha-lcov-reporter": "*",
"mocha": "*" "mocha": "*"
}, },
"author": "fengmk2 <fengmk2@gmail.com> (http://fengmk2.github.com)", "author": "fengmk2 <fengmk2@gmail.com> (http://fengmk2.github.com)",
Expand Down
8 changes: 4 additions & 4 deletions test/fixtures/server.js
Expand Up @@ -19,9 +19,9 @@ var app = connect(
for (var k in req.files) { for (var k in req.files) {
var f = req.files[k]; var f = req.files[k];
files[k] = { files[k] = {
size: f.length, size: f.size || f.length,
mime: f.mime, mime: f.type || f.mime,
filename: f.filename, filename: f.name || f.filename,
path: f.path path: f.path
}; };
} }
Expand All @@ -36,4 +36,4 @@ var app = connect(
} }
); );


module.exports = app; module.exports = app;
2 changes: 1 addition & 1 deletion test/formstream.test.js
@@ -1,6 +1,6 @@
/*! /*!
* formstream - test/formstream.js * formstream - test/formstream.js
* Copyright(c) 2012 fengmk2 <fengmk2@gmail.com> * Copyright(c) 2012 - 2013 fengmk2 <fengmk2@gmail.com>
* MIT Licensed * MIT Licensed
*/ */


Expand Down

0 comments on commit 4ca227c

Please sign in to comment.