Skip to content

Commit

Permalink
Update: Refactor tests (closes #103) (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
phated committed Sep 27, 2016
1 parent 7a0e0ac commit 8e2e0f1
Show file tree
Hide file tree
Showing 17 changed files with 1,893 additions and 1,553 deletions.
9 changes: 4 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,6 @@ File.prototype.clone = function(opt) {
// Clone our file contents
var contents;
if (this.isStream()) {
if (typeof this.contents.clone !== 'function') {
this.contents = cloneable(this.contents);
}

contents = this.contents.clone();
} else if (this.isBuffer()) {
contents = opt.contents ? cloneBuffer(this.contents) : this.contents;
Expand Down Expand Up @@ -177,7 +173,10 @@ Object.defineProperty(File.prototype, 'contents', {
throw new Error('File.contents can only be a Buffer, a Stream, or null.');
}

if (isStream(val)) {
// Ask cloneable if the stream is a already a cloneable
// this avoid piping into many streams
// reducing the overhead of cloning
if (isStream(val) && !cloneable.isCloneable(val)) {
val = cloneable(val);
}

Expand Down
20 changes: 9 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,28 @@
"dependencies": {
"clone": "^1.0.0",
"clone-stats": "^1.0.0",
"cloneable-readable": "^0.4.0",
"cloneable-readable": "^0.5.0",
"readable-stream": "^2.1.0",
"replace-ext": "^1.0.0"
},
"devDependencies": {
"buffer-equal": "0.0.1",
"eslint": "^1.7.3",
"eslint-config-gulp": "^2.0.0",
"event-stream": "^3.1.0",
"expect": "^1.20.2",
"github-changes": "^1.0.1",
"istanbul": "^0.3.0",
"istanbul-coveralls": "^1.0.1",
"istanbul": "^0.4.3",
"istanbul-coveralls": "^1.0.3",
"jscs": "^2.3.5",
"jscs-preset-gulp": "^1.0.0",
"lodash.templatesettings": "^3.1.0",
"mocha": "^2.0.0",
"rimraf": "^2.2.5",
"should": "^7.0.0"
"mississippi": "^1.2.0",
"mocha": "^2.4.5"
},
"scripts": {
"lint": "eslint . && jscs index.js lib/ test/",
"pretest": "npm run lint",
"test": "mocha",
"coveralls": "istanbul cover _mocha && istanbul-coveralls",
"test": "mocha --async-only",
"cover": "istanbul cover _mocha --report lcovonly",
"coveralls": "npm run cover && istanbul-coveralls",
"changelog": "github-changes -o gulpjs -r vinyl -b master -f ./CHANGELOG.md --order-semver --use-commit-body"
},
"engines": {
Expand Down
Loading

0 comments on commit 8e2e0f1

Please sign in to comment.