Commit 065cf4b7 by Julian Gruber

assert imagePath type

parent 7cbdcace
......@@ -70,6 +70,10 @@ var prepareOptions = function (options) {
prepareStats(options, stats);
if (options.imagePath && typeof options.imagePath !== 'string') {
throw new Error('imagePath needs to be a string');
}
return {
file: options.file || null,
outFile: options.outFile || null,
......
......@@ -135,6 +135,21 @@ describe('compile file with image path', function(){
}
});
});
it('should throw on non-string path', function(done) {
try {
sass.render({
file: path.resolve(__dirname, 'image_path.scss'),
imagePath: ['/path/to/images'],
success: function () {},
error: function () {}
});
} catch(err) {
assert(err);
return done();
}
done(new Error('did not throw'));
});
});
describe('compile file', function() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment