Add test for includePaths

This commit is contained in:
Julien Muetton 2014-11-26 11:00:35 +01:00
parent b5cba0eaaf
commit 7ba09c4bcb
3 changed files with 29 additions and 2 deletions

View file

@ -0,0 +1 @@
@import "cats";

View file

@ -0,0 +1,2 @@
@import "cats";

View file

@ -5,8 +5,8 @@ var fs = require('fs');
var path = require('path');
var test = require('tape');
function createVinyl(sassFileName, contents) {
var base = path.join(__dirname, 'scss');
function createVinyl(sassFileName, contents, base) {
base = base || path.join(__dirname, 'scss');
var filePath = path.join(base, sassFileName);
return new gutil.File({
@ -101,6 +101,30 @@ test('compile multiple sass files', function (t) {
});
});
test('compile multiple sass files with includePaths', function (t) {
var files = [
createVinyl('file1.scss', null, path.join(__dirname, 'scss', 'include-path-tests')),
createVinyl('file2.scss', null, path.join(__dirname, 'scss', 'include-path-tests'))
];
var options = {
includePaths: [path.resolve(__dirname, 'scss', 'includes')]
};
t.plan(files.length * 4);
var stream = gsass(options);
stream.on('data', function (cssFile) {
t.ok(cssFile, 'cssFile exists');
t.ok(cssFile.path, 'cssFile.path exists');
t.ok(cssFile.relative, 'cssFile.relative exists');
t.ok(cssFile.contents, 'cssFile.contents exists');
});
files.forEach(function (file) {
stream.write(file);
});
});
test('emit error on sass errors', function (t) {
var stream = gsass();
var errorFile = createVinyl('somefile.sass',