Commit 2571f9e8 by Marcin Cieslak

Test against a hopefully correct source map output

Introduce libsass version checking in cli.js
and skip the test if running with libsass 3.2.5
or older.
parent edbf4972
...@@ -7,9 +7,22 @@ var assert = require('assert'), ...@@ -7,9 +7,22 @@ var assert = require('assert'),
stream = require('stream'), stream = require('stream'),
spawn = require('cross-spawn'), spawn = require('cross-spawn'),
cli = path.join(__dirname, '..', 'bin', 'node-sass'), cli = path.join(__dirname, '..', 'bin', 'node-sass'),
fixture = path.join.bind(null, __dirname, 'fixtures'); fixture = path.join.bind(null, __dirname, 'fixtures'),
LIBSASS_VERSION = null;
describe('cli', function() { describe('cli', function() {
before(function(done) {
var bin = spawn(cli, ['-v']);
bin.stdout.setEncoding('utf8');
bin.stdout.once('data', function(data) {
LIBSASS_VERSION = data.trim().split(['\n'])
.filter(function(a) { return a.substr(0,7) === 'libsass'; })[0]
.split('\t')[1];
done();
});
});
describe('node-sass < in.scss', function() { describe('node-sass < in.scss', function() {
it('should read data from stdin', function(done) { it('should read data from stdin', function(done) {
var src = fs.createReadStream(fixture('simple/index.scss')); var src = fs.createReadStream(fixture('simple/index.scss'));
...@@ -399,6 +412,10 @@ describe('cli', function() { ...@@ -399,6 +412,10 @@ describe('cli', function() {
}); });
it('should compile with the --source-map option', function(done) { it('should compile with the --source-map option', function(done) {
if (LIBSASS_VERSION < '3.3') {
this.skip('Source map functionality broken in libsass < 3.3');
}
var src = fixture('source-map/index.scss'); var src = fixture('source-map/index.scss');
var destCss = fixture('source-map/index.css'); var destCss = fixture('source-map/index.css');
var destMap = fixture('source-map/index.map'); var destMap = fixture('source-map/index.map');
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
"sources": [ "sources": [
"index.scss" "index.scss"
], ],
"sourcesContent": [], "mappings": "AAAA,OAAO,CAAC;EACN,KAAK,EAAE,GAAI;EACX,MAAM,EAAE,IAAK,GACd;;AAED,OAAO,CAAC,EAAE,CAAC;EACT,eAAe,EAAE,IAAK,GACvB;;AAED,OAAO,CAAC,EAAE,CAAC;EACT,KAAK,EAAE,IAAK,GAKb;EAND,OAAO,CAAC,EAAE,CAGR,CAAC,CAAC;IACA,WAAW,EAAE,IAAK,GACnB",
"mappings": "AAAA,OAAO,CAAC;EACN,KAAK,EAAE,GAAI;EACX,MAAM,EAAE,IAAK,GAFN;;AAKD,OAAO,CAAC,EAAE,CAAP;EACT,eAAe,EAAE,IAAK,GADZ;;AAIJ,OAAO,CAAC,EAAE,CAAP;EACT,KAAK,EAAE,IAAK,GADF;EAGV,OAAO,CAAC,EAAE,CAAC,CAAC,CAAV;IACA,WAAW,EAAE,IAAK,GADjB",
"names": [] "names": []
} }
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