diff --git a/test/scss/include-path-tests/file1.scss b/test/scss/include-path-tests/file1.scss new file mode 100644 index 0000000..c7ca445 --- /dev/null +++ b/test/scss/include-path-tests/file1.scss @@ -0,0 +1 @@ +@import "cats"; diff --git a/test/scss/include-path-tests/file2.scss b/test/scss/include-path-tests/file2.scss new file mode 100644 index 0000000..6ccb45b --- /dev/null +++ b/test/scss/include-path-tests/file2.scss @@ -0,0 +1,2 @@ +@import "cats"; + diff --git a/test/test.js b/test/test.js index 74803be..06c6b06 100644 --- a/test/test.js +++ b/test/test.js @@ -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',