Skip to content

Commit

Permalink
fix(stream): Don't log file info when once: true - fixes google/web-s…
Browse files Browse the repository at this point in the history
  • Loading branch information
shakyShane committed Feb 10, 2015
1 parent a21d79e commit 8f4d727
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/public/reload.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ module.exports = function (emitter) {

reload._flush = function (next) {

emitInfo(changed);
if (changed.length) {
emitInfo(changed);
}

next();
};
Expand Down
11 changes: 10 additions & 1 deletion test/specs/api/init.reload.stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ describe("API: .reload()", function () {
stream.write(new File({path: "styles2.css"}));
stream.write(new File({path: "styles3.css"}));
stream.end();
sinon.assert.calledTwice(emitterStub);
sinon.assert.calledOnce(emitterStub);
sinon.assert.calledWithExactly(emitterStub, "browser:reload");
});
it("should be able to call .reload after a stream", function () {
Expand All @@ -87,4 +87,13 @@ describe("API: .reload()", function () {
changed: ["styles.css"]
});
});
it("does not log file info if (once: true)", function () {
var stream = browserSync.reload({stream: true, once: true});
stream.write(new File({path: "styles.js"}));
stream.write(new File({path: "styles2.js"}));
stream.write(new File({path: "styles3.js"}));
stream.end();
sinon.assert.calledOnce(emitterStub);
sinon.assert.calledWithExactly(emitterStub, "browser:reload");
});
});

0 comments on commit 8f4d727

Please sign in to comment.