Permalink
Browse files

fix test case on node@0.8

  • Loading branch information...
1 parent cc9ccce commit de4f236588eeabbb2a3849b52bc867eae24063f0 @fengmk2 fengmk2 committed Jan 17, 2014
Showing with 25 additions and 17 deletions.
  1. +6 −1 Makefile
  2. +1 −1 README.md
  3. +2 −2 package.json
  4. +16 −13 test/formstream.test.js
View
@@ -14,7 +14,12 @@ test: install
$(TESTS)
test-cov:
- @$(MAKE) test MOCHA_OPTS='--require blanket' REPORTER=html-cov | ./node_modules/.bin/cov
+ @$(MAKE) test MOCHA_OPTS='--require blanket' REPORTER=travis-cov
+
+test-cov-html:
+ @rm -f coverage.html
+ @$(MAKE) test MOCHA_OPTS='--require blanket' REPORTER=html-cov > coverage.html
+ @ls -lh coverage.html
test-coveralls: test
@echo TRAVIS_JOB_ID $(TRAVIS_JOB_ID)
View
@@ -1,4 +1,4 @@
-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)
+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) [![Dependency Status](https://gemnasium.com/fengmk2/formstream.png)](https://gemnasium.com/fengmk2/formstream)
==========
[![NPM](https://nodei.co/npm/formstream.png?downloads=true&stars=true)](https://nodei.co/npm/formstream/)
View
@@ -8,7 +8,7 @@
},
"config": {
"blanket": { "pattern": "formstream/lib" },
- "cov": { "threshold": 100 }
+ "travis-cov": { "threshold": 100 }
},
"repository": {
"type": "git",
@@ -35,7 +35,7 @@
"connect": "2.12.0",
"connect-multiparty": "1.0.1",
"contributors": "*",
- "cov": "*",
+ "travis-cov": "*",
"coveralls": "*",
"mocha": "*",
"mocha-lcov-reporter": "*",
@@ -213,20 +213,23 @@ describe('formstream.test.js', function () {
});
});
- it('should post not exist file return error', function (done) {
- var form = formstream();
- form.field('foo', 'bar');
- form.field('name', '中文名字');
- form.field('pwd', '哈哈pwd');
- form.file('file', __filename + 'notexists');
- form.setTotalStreamSize(100);
- post(port, '/post', form, function (err, data) {
- should.exist(err);
- err.message.should.include('formstream/test/formstream.test.jsnotexists');
- err.message.should.include('ENOENT, open ');
- done();
+ if (process.version.indexOf('v0.8.') !== 0) {
+ // node 0.8, createSteram not exists file will throw error
+ it('should post not exist file return error ENOENT', function (done) {
+ var form = formstream();
+ form.field('foo', 'bar');
+ form.field('name', '中文名字');
+ form.field('pwd', '哈哈pwd');
+ form.file('file', __filename + 'notexists');
+ form.setTotalStreamSize(100);
+ post(port, '/post', form, function (err, data) {
+ should.exist(err);
+ err.message.should.include('formstream/test/formstream.test.jsnotexists');
+ err.message.should.include('ENOENT, open ');
+ done();
+ });
});
- });
+ }
it('should post fields and stream', function (done) {
var form = formstream();

0 comments on commit de4f236

Please sign in to comment.