preserve the original error message

This commit is contained in:
Jean-Luc Geering 2015-12-21 09:31:46 +01:00
parent d62227fb9d
commit 3075a845c6
2 changed files with 15 additions and 0 deletions

View file

@ -125,6 +125,7 @@ var gulpSass = function gulpSass(options, sync) {
message += error.formatted;
error.messageFormatted = message;
error.messageOriginal = error.message;
error.message = gutil.colors.stripColor(message);
return cb(new gutil.PluginError(

View file

@ -153,6 +153,20 @@ describe('gulp-sass -- async compile', function() {
stream.write(errorFile);
});
it('should preserve the original sass error message', function(done) {
var errorFile = createVinyl('error.scss');
var stream = sass();
stream.on('error', function(err) {
// Error must include original error message
err.messageOriginal.indexOf('property "font" must be followed by a \':\'').should.not.equal(-1);
// Error must not format or change the original error message
err.messageOriginal.indexOf('on line 2').should.equal(-1);
done();
});
stream.write(errorFile);
});
it('should compile a single sass file if the file name has been changed in the stream', function(done) {
var sassFile = createVinyl('mixins.scss');
var stream;