Skip to content

Commit f525f8a

Browse files
committed
add empty scss test case
1 parent e39fa62 commit f525f8a

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

test/__snapshots__/test.js.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ Object {
4141
}
4242
`;
4343

44+
exports[`sass-extract-js should handle file with no variables 1`] = `Object {}`;
45+
4446
exports[`sass-extract-js should handle imports 1`] = `
4547
Object {
4648
"importedVar": true,

test/sass/test-empty.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
html {
2+
background-color: #fff;
3+
}

test/test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const testfiles = {
77
camel: path.resolve(__dirname, './sass/test-opts-camel.scss'),
88
sassOpts: path.resolve(__dirname, './sass/test-opts-sass.scss'),
99
import: path.resolve(__dirname, './sass/test-import.scss'),
10+
empty: path.resolve(__dirname, './sass/test-empty.scss'),
1011
};
1112

1213
const getVars = (file, compileOpts = {}) =>
@@ -25,6 +26,10 @@ describe('sass-extract-js', () => {
2526
expect(getVars(testfiles.import)).toMatchSnapshot();
2627
});
2728

29+
it('should handle file with no variables', () => {
30+
expect(getVars(testfiles.empty)).toMatchSnapshot();
31+
});
32+
2833
it('should pass sass options through', () => {
2934
const opts = {
3035
includePaths: [path.join(__dirname, 'sass', 'nested')],

0 commit comments

Comments
 (0)