Skip to content

Commit

Permalink
Declaring logError as function instead of arrow function.
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Kvistgaard authored and xzyfer committed Apr 8, 2018
1 parent 450a7b8 commit 71471c2
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 71471c2

Please sign in to comment.