-
Notifications
You must be signed in to change notification settings - Fork 755
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(plugins): allow module references in options.plugins array - fixes …
- Loading branch information
1 parent
4c5002d
commit aabc03c
Showing
3 changed files
with
55 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
"use strict"; | ||
|
||
var assert = require("chai").assert; | ||
var sinon = require("sinon"); | ||
|
||
describe("Plugins: Retrieving user plugins when given inline as object reference", function () { | ||
|
||
var instance; | ||
var PLUGIN_NAME_1 = "Test Plugin 1"; | ||
var PLUGIN_NAME_2 = "Test Plugin 2"; | ||
var spy1, spy2; | ||
|
||
before(function (done) { | ||
|
||
var browserSync = require("../../../"); | ||
spy1 = sinon.spy(); | ||
spy2 = sinon.spy(); | ||
browserSync.reset(); | ||
|
||
var bs = browserSync.create(); | ||
|
||
var fake1 = { | ||
plugin: spy1, | ||
"plugin:name": PLUGIN_NAME_1 | ||
}; | ||
var fake2 = { | ||
plugin: spy1, | ||
"plugin:name": PLUGIN_NAME_2 | ||
}; | ||
|
||
var config = { | ||
logLevel: "silent", | ||
plugins: [fake1, fake2] | ||
}; | ||
|
||
instance = bs.init(config, done); | ||
}); | ||
after(function () { | ||
instance.cleanup(); | ||
}); | ||
it("Should access to only the user-specified plugins", function (done) { | ||
assert.equal(instance.getUserPlugins().length, 2); | ||
done(); | ||
}); | ||
it("Should have access to only the user-specified plugins", function (done) { | ||
assert.equal(instance.getUserPlugins()[0].name, PLUGIN_NAME_1); | ||
assert.equal(instance.getUserPlugins()[1].name, PLUGIN_NAME_2); | ||
done(); | ||
}); | ||
}); |