Skip to content

Commit

Permalink
Merge pull request #681 from DKvistgaard/master
Browse files Browse the repository at this point in the history
Declaring logError as function instead of arrow function.
  • Loading branch information
xzyfer authored Apr 8, 2018
2 parents 450a7b8 + 71471c2 commit daca90d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ gulpSass.sync = options => gulpSass(options, true);
//////////////////////////////
// Log errors nicely
//////////////////////////////
gulpSass.logError = (error) => {
gulpSass.logError = function logError(error) {
const message = new PluginError('sass', error.messageFormatted).toString();
process.stderr.write(`${message}\n`);
this.emit('end');
Expand Down
18 changes: 18 additions & 0 deletions test/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,15 @@ describe('gulp-sass -- async compile', () => {
stream.write(sassFile);
});

it('should emit logError on sass error', (done) => {
const errorFile = createVinyl('error.scss');
const stream = sass();

stream.on('error', sass.logError);
stream.on('end', done);
stream.write(errorFile);
});

it('should handle sass errors', (done) => {
const errorFile = createVinyl('error.scss');
const stream = sass();
Expand Down Expand Up @@ -397,6 +406,15 @@ describe('gulp-sass -- sync compile', () => {
stream.write(errorFile);
});

it('should emit logError on sass error', (done) => {
const errorFile = createVinyl('error.scss');
const stream = sass.sync();

stream.on('error', sass.logError);
stream.on('end', done);
stream.write(errorFile);
});

it('should work with gulp-sourcemaps', (done) => {
const sassFile = createVinyl('inheritance.scss');

Expand Down

0 comments on commit daca90d

Please sign in to comment.