Skip to content

preserve the original error message for notification(s) support #420

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 21, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
14 changes: 14 additions & 0 deletions test/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down