Skip to content

Commit

Permalink
improve test suite, add istanbul coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
morris committed Oct 3, 2016
1 parent c7eee5c commit 4003520
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 12 deletions.
3 changes: 1 addition & 2 deletions .gitignore
@@ -1,3 +1,2 @@
node_modules/
test/config.json
test/download/
coverage
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -3,6 +3,7 @@
## master

- Updated dependencies
- Improved test suite

## v0.5.0

Expand Down
5 changes: 4 additions & 1 deletion README.md
Expand Up @@ -2,7 +2,6 @@

[![version](https://img.shields.io/npm/v/vinyl-ftp.svg)](https://www.npmjs.com/package/vinyl-ftp)
[![downloads](https://img.shields.io/npm/dm/vinyl-ftp.svg)](https://www.npmjs.com/package/vinyl-ftp)
[![tips](https://img.shields.io/gratipay/morris.svg)](https://gratipay.com/~morris/)

Blazing fast vinyl adapter for FTP.
Supports parallel transfers, conditional transfers, buffered or streamed files, and more.
Expand Down Expand Up @@ -162,3 +161,7 @@ Removes a directory, recursively.
### conn.clean( globs, local[, options] )

Globs remote files, tests if they are locally available at `<local>/<remote.relative>` and removes them if not.

## Development

- Run tests with `CONFIG=test/config/yourserver.json npm test`
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -17,7 +17,7 @@
"node": ">=0.10.0"
},
"scripts": {
"test": "mocha"
"test": "istanbul cover node_modules/mocha/bin/_mocha test"
},
"keywords": [
"vinyl",
Expand All @@ -37,6 +37,7 @@
},
"devDependencies": {
"expect": "^1.20.1",
"istanbul": "^0.4.5",
"mocha": "^3.1.0",
"rmdir": "^1.2.0",
"vinyl-fs": "^2.4.3"
Expand Down
1 change: 1 addition & 0 deletions test/.gitignore
@@ -0,0 +1 @@
download
3 changes: 3 additions & 0 deletions test/config/.gitignore
@@ -0,0 +1,3 @@
*
!.gitignore
!*.dist.json
File renamed without changes.
4 changes: 2 additions & 2 deletions test/fixtures/index.html
@@ -1,12 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<title>Hi.</title>
<title>Hi</title>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<h1>Hello.</h1>
<h1>Hello</h1>
<script src="js/jquery.js"></script>
<script src="js/script.js"></script>
</body>
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/js/jquery.js
@@ -1 +1 @@
$ = function ( selector ) { console.log( selector ) };
$ = function ( selector ) { console.log( selector ); };
2 changes: 1 addition & 1 deletion test/fixtures/js/sub/sub.js
@@ -1 +1 @@
$( 'h1' );
$( 'h2' );
14 changes: 10 additions & 4 deletions test/suite.js
@@ -1,24 +1,30 @@
var expect = require( 'expect' );
var fs = require( 'fs' );
var assert = require( 'assert' );
var VinylFtp = require( '../' );

var suite = module.exports = {};

suite.config = require( './config.json' );
if ( !process.env.CONFIG ) {
console.log( 'Missing CONFIG environment variable' );
process.exit( 1 );
}

suite.config = JSON.parse( fs.readFileSync( process.env.CONFIG ) );
suite.config.log = function () {

var args = Array.prototype.slice.call( arguments, 0 );
suite.log += args.join( ' ' );
console.log.apply( console, arguments );

};
//suite.config.debug = suite.config.log;

suite.done = function ( done ) {

return function () {

setTimeout( function () {

expect( suite.vftp.connectionCount ).toBe( 0 );
assert.equal( suite.vftp.connectionCount, 0 );
done();

}, 1000 );
Expand Down

0 comments on commit 4003520

Please sign in to comment.