Skip to content
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

Declaring logError as function instead of arrow function. #681

Merged
merged 1 commit into from
Apr 8, 2018
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
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