Skip to content

Commit

Permalink
fix endless loop with empty files
Browse files Browse the repository at this point in the history
  • Loading branch information
sihu committed Mar 23, 2017
1 parent 4bbdac3 commit cdc3da4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,11 @@ class Comb {
let filename = options && options.filename || '';
let context = options && options.context;
let tree;
const lint = this.lint;

if (!text) return this.lint ? [] : text;
if (!text) return new Promise(function(resolve) {
resolve(lint ? [] : text);
});

if (!syntax) syntax = 'css';
this.syntax = syntax;
Expand Down
Empty file added test/core/scss/empty.scss
Empty file.
7 changes: 7 additions & 0 deletions test/core/scss/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,13 @@ describe('scss', function() {
return test.shouldBeEqual('content.scss');
});

it('Should parse an empty file', function() {
let test = new Test(this);
test.comb.configure({});

return test.shouldBeEqual('empty.scss');
});

it('Should parse functions', function() {
let test = new Test(this);
test.comb.configure({});
Expand Down

0 comments on commit cdc3da4

Please sign in to comment.