Add test for includePaths
This commit is contained in:
parent
b5cba0eaaf
commit
7ba09c4bcb
1
test/scss/include-path-tests/file1.scss
Normal file
1
test/scss/include-path-tests/file1.scss
Normal file
|
@ -0,0 +1 @@
|
|||
@import "cats";
|
2
test/scss/include-path-tests/file2.scss
Normal file
2
test/scss/include-path-tests/file2.scss
Normal file
|
@ -0,0 +1,2 @@
|
|||
@import "cats";
|
||||
|
28
test/test.js
28
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',
|
||||
|
|
Loading…
Reference in a new issue