Skip to content

Commit

Permalink
Add test for passing extends to stylelint overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
jasikpark committed Sep 30, 2022
1 parent 736bc29 commit 7ea9f8a
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions lib/__tests__/applyOverrides.test.js
Expand Up @@ -198,6 +198,45 @@ describe('two matching overrides', () => {

expect(applied).toEqual(expectedConfig);
});

test('with extends', () => {
const config = {
extends: ['stylelint-config1'],
rules: {
'block-no-empty': true,
'unit-disallowed-list': ['px'],
},
overrides: [
{
files: ['*.module.css'],
extends: ['stylelint-config2'],
rules: {
'color-no-hex': true,
},
},
{
files: ['*.css'],
extends: ['stylelint-config3'],
rules: {
'block-no-empty': null,
},
},
],
};

const expectedConfig = {
extends: ['stylelint-config1', 'stylelint-config2', 'stylelint-config3'],
rules: {
'block-no-empty': null,
'unit-disallowed-list': ['px'],
'color-no-hex': true,
},
};

const applied = applyOverrides(config, __dirname, path.join(__dirname, 'style.module.css'));

expect(applied).toEqual(expectedConfig);
});
});

describe('no matching overrides', () => {
Expand Down

0 comments on commit 7ea9f8a

Please sign in to comment.