Skip to content

Commit

Permalink
Create failing test, address dlmanning#278
Browse files Browse the repository at this point in the history
  • Loading branch information
neagle committed May 21, 2015
1 parent 4045aaa commit 4690842
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"devDependencies": {
"autoprefixer-core": "^5.1.11",
"eslint": "^0.17.1",
"globule": "^0.2.0",
"gulp": "^3.8.11",
"gulp-postcss": "^5.1.6",
"gulp-sourcemaps": "^1.5.2",
Expand Down
23 changes: 23 additions & 0 deletions test/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ var sourcemaps = require('gulp-sourcemaps');
var postcss = require('gulp-postcss');
var autoprefixer = require('autoprefixer-core');
var tap = require('gulp-tap');
var globule = require('globule');

var createVinyl = function createVinyl(filename, contents) {
var base = path.join(__dirname, 'scss');
Expand Down Expand Up @@ -414,4 +415,26 @@ describe('gulp-sass -- sync compile', function() {
}))
.on('end', done);
});

it('should work with gulp-sourcemaps and a globbed source', function(done) {
var files, filesContent, actualContent, expectedContent;

files = globule.find(path.join(__dirname, '/scss/globbed/**/*.scss'));
filesContent = {};

files.forEach(function(file) {
filesContent[path.basename(file)] = fs.readFileSync(file, 'utf8');
});

gulp.src(path.join(__dirname, '/scss/globbed/**/*.scss'))
.pipe(sourcemaps.init())
.pipe(sass.sync())
.pipe(tap(function(file) {
should.exist(file.sourceMap);
actualContent = file.sourceMap.sourcesContent[0];
expectedContent = filesContent[file.sourceMap.sources[0]];
actualContent.should.eql(expectedContent);
}))
.on('end', done);
});
});
16 changes: 16 additions & 0 deletions test/scss/globbed/app.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
p {
border: 1px solid red;
}

small {
font: {
size: 72px;
}
}

h1 {
font: {
size: 8px;
}
}

5 changes: 5 additions & 0 deletions test/scss/globbed/foo/bar.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
h1, h2, h3, h4, h5 {
color: green;
font-weight: 800;
}

0 comments on commit 4690842

Please sign in to comment.