Merge pull request #420 from jlgeering/error-msg-unformatted

preserve the original error message for notification(s) support
This commit is contained in:
Vincent Prouillet 2015-12-21 10:53:18 +00:00
commit 52fba693e0
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);
error.relativePath = relativePath;

View file

@ -155,6 +155,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;