Skip to content

Commit

Permalink
feat(plugins): Allow plugins to be given inline within options hash
Browse files Browse the repository at this point in the history
  • Loading branch information
shakyShane committed Mar 17, 2015
1 parent 87a2381 commit fd4ccd9
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/async.js
Expand Up @@ -266,7 +266,7 @@ module.exports = {
try {
bs.registerPlugin(require(name), opts);
} catch (e) {
bs.logger.error("NOPE");
bs.logger.setOnce("useLevelPrefixes", true).error("Plugin {yellow:`%s`} was not found, did you forget to {cyan:npm install} it?", name);
}
}

Expand Down
29 changes: 29 additions & 0 deletions test/specs/plugins/user.plugins.error.js
@@ -0,0 +1,29 @@
"use strict";

var browserSync = require("../../../");

var assert = require("chai").assert;

describe("Plugins: Retrieving user plugins when given inline with errors", function () {

var instance;

before(function (done) {

browserSync.reset();

var config = {
logLevel: "error",
plugins: ["some-rnadomw-name-that-does-not-exist"]
};

instance = browserSync(config, done).instance;
});
after(function () {
instance.cleanup();
});
it("Should give good errors when a plugin does not exist", function (done) {
assert.equal(instance.getUserPlugins().length, 0);
done();
});
});
6 changes: 0 additions & 6 deletions test/specs/plugins/user.plugins.inline.options.js
Expand Up @@ -13,12 +13,6 @@ describe("Plugins: Retrieving user plugins when given inline with options", func

browserSync.reset();

var plugin = {
"bs-html-injector": {
files: "*.html"
}
};

var config = {
logLevel: "silent",
plugins: [
Expand Down

0 comments on commit fd4ccd9

Please sign in to comment.