Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Prepare libsass 3.3: fix tests and build parameters #1146

Merged
merged 3 commits into from
Sep 16, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/libsass.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
'defines': [
'LIBSASS_VERSION="<!(node -e "process.stdout.write(require(\'../package.json\').libsass)")"'
],
'defines!': [
'DEBUG'
],
'sources': [
'libsass/ast.cpp',
'libsass/base64vlq.cpp',
Expand Down
12 changes: 7 additions & 5 deletions test/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ var assert = require('assert'),
resolveFixture = path.resolve.bind(null, __dirname, 'fixtures');

describe('api', function() {

describe('.render(options, callback)', function() {
it('should compile sass to css with file', function(done) {
var expected = read(fixture('simple/expected.css'), 'utf8').trim();
Expand Down Expand Up @@ -980,7 +981,7 @@ describe('api', function() {
file: fixture('include-files/index.scss')
}, function(error, result) {
assert(!error);
assert.deepEqual(result.stats.includedFiles, expected);
assert.deepEqual(result.stats.includedFiles.sort(), expected.sort());
done();
});
});
Expand Down Expand Up @@ -1441,11 +1442,12 @@ describe('api', function() {
fixture('include-files/bar.scss').replace(/\\/g, '/'),
fixture('include-files/foo.scss').replace(/\\/g, '/'),
fixture('include-files/index.scss').replace(/\\/g, '/')
];
].sort();
var actual = result.stats.includedFiles.sort();

assert.equal(result.stats.includedFiles[0], expected[0]);
assert.equal(result.stats.includedFiles[1], expected[1]);
assert.equal(result.stats.includedFiles[2], expected[2]);
assert.equal(actual[0], expected[0]);
assert.equal(actual[1], expected[1]);
assert.equal(actual[2], expected[2]);
done();
});

Expand Down
19 changes: 18 additions & 1 deletion test/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,22 @@ var assert = require('assert'),
stream = require('stream'),
spawn = require('cross-spawn'),
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() {

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() {
it('should read data from stdin', function(done) {
var src = fs.createReadStream(fixture('simple/index.scss'));
Expand Down Expand Up @@ -399,6 +412,10 @@ describe('cli', function() {
});

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 destCss = fixture('source-map/index.css');
var destMap = fixture('source-map/index.map');
Expand Down
3 changes: 1 addition & 2 deletions test/fixtures/source-map/expected.map
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"sources": [
"index.scss"
],
"sourcesContent": [],
"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",
"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",
"names": []
}