Skip to content

Commit ff92fb9

Browse files
committed
Add additional test to ensure merged options are passed to beforeLint
1 parent da8138e commit ff92fb9

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

lib/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ function mergeOptions(options) {
104104
// Allow additional plugins to be merged with the defaults
105105
// but remove any duplicates so that it respects the new order
106106
if (!isEmpty(options.use)) {
107-
var dedupedPlugins = difference(merged.use, options.use);
108-
merged.use = dedupedPlugins.concat(options.use);
107+
var plugins = difference(merged.use, options.use);
108+
merged.use = plugins.concat(options.use);
109109
}
110110

111111
return merged;
@@ -119,7 +119,7 @@ function mergeOptions(options) {
119119
* @returns {Function} Used by postcss-import transform
120120
*/
121121
function lintImportedFiles(options) {
122-
return function (css, filename) {
122+
return function(css, filename) {
123123
return postcss([
124124
bemLinter(options['postcss-bem-linter']),
125125
reporter(options['postcss-reporter'])

test/test.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,18 @@ describe('suitcss', function () {
145145
beforeLint: beforeLintStub
146146
}).catch(done);
147147

148-
expect(bemLintStub.getCall(0).args[0]).to.equal('/* before lint */');
148+
expect(bemLintStub.args[0][0]).to.equal('/* before lint */');
149+
150+
done();
151+
});
152+
153+
it('should pass the merged options to the beforeLint function', function (done) {
154+
suitcss(read('fixtures/component'), {
155+
root: 'test/fixtures',
156+
beforeLint: beforeLintStub
157+
}).catch(done);
158+
159+
expect(beforeLintStub.args[0][2].root).to.equal('test/fixtures');
149160

150161
done();
151162
});

0 commit comments

Comments
 (0)