Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update: Refactor tests (closes #103) #110

Merged
merged 8 commits into from
Sep 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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