Merge pull request #681 from DKvistgaard/master

Declaring logError as function instead of arrow function.
master
Michael Mifsud 2018-04-08 13:10:17 +10:00 committed by GitHub
commit daca90dd95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 1 deletions

View File

@ -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');

View File

@ -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();
@ -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');