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

Fixed the test suite in Windows #160

Merged
merged 1 commit into from
Oct 1, 2013
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
Fixed the test suite in Windows
  • Loading branch information
LaurentGoderre committed Oct 1, 2013
commit 45acd4e0017c364abcbcd6fdae80af5225ab33a7
10 changes: 4 additions & 6 deletions lib/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,11 @@ function render(options, emitter) {
if (err) return emitter.emit('error', ('Error: ' + err).red);
emitter.emit('warn', ('Wrote CSS to ' + options.outFile).green);
emitter.emit('write', err, options.outFile, css);
if (options.stdout) {
emitter.emit('log', css);
}
emitter.emit('render', css);
});

if (options.stdout) {
emitter.emit('log', css);
}

emitter.emit('render', css);
},
error: function(error) {
emitter.emit('error', error);
Expand Down
34 changes: 17 additions & 17 deletions test/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ var path = require('path'),
assert = require('assert'),
fs = require('fs'),
exec = require('child_process').exec,
sass = require(path.join(__dirname, '..', 'sass')),
cli = require(path.join(__dirname, '..', 'lib', 'cli')),
sass = require('../sass'),
cli = require('../lib/cli'),

cliPath = path.resolve(__dirname, '..', 'bin', 'node-sass'),
cliPath = path.resolve(__dirname, '../bin/node-sass'),
sampleFilename = path.resolve(__dirname, 'sample.scss');

var expectedSampleCompressed = '#navbar {width:80%;height:23px;}\
Expand All @@ -27,15 +27,15 @@ var expectedSampleNoComments = '#navbar {\n\

describe('cli', function() {
it('should print help when run with no arguments', function(done) {
exec(cliPath, function(err, stdout, stderr) {
exec('node ' + cliPath, function(err, stdout, stderr) {
done(assert(stderr.indexOf('Compile .scss files with node-sass') === 0));
});
});

it('should compile sample.scss as sample.css', function(done) {
var resultPath = path.join(__dirname, 'sample.css');

exec(cliPath + ' ' + sampleFilename, {
exec('node ' + cliPath + ' ' + sampleFilename, {
cwd: __dirname
}, function(err, stdout, stderr) {

Expand All @@ -47,9 +47,9 @@ describe('cli', function() {
});

it('should compile sample.scss to ../out.css', function(done) {
var resultPath = path.resolve(__dirname, '..', 'out.css');
var resultPath = path.resolve(__dirname, '../out.css');

exec(cliPath + ' ' + sampleFilename + ' ../out.css', {
exec('node ' + cliPath + ' ' + sampleFilename + ' ../out.css', {
cwd: __dirname
}, function(err, stdout, stderr) {

Expand All @@ -62,38 +62,38 @@ describe('cli', function() {

it('should compile with --include-path option', function(done){
var emitter = cli([
'--include-path', path.join(__dirname, '/lib'),
'--include-path', path.join(__dirname, '/functions'),
path.join(__dirname, '/include_path.scss')
'--include-path', path.join(__dirname, 'lib'),
'--include-path', path.join(__dirname, 'functions'),
path.join(__dirname, 'include_path.scss')
]);
emitter.on('error', done);
emitter.on('render', function(css){
assert.equal(css.trim(), 'body {\n background: red;\n color: blue; }');
fs.unlink(process.cwd() + '/include_path.css', done);
fs.unlink(path.resolve(process.cwd(), 'include_path.css'), done);
});
});

it('should compile with the --output-style', function(done){
var emitter = cli(['--output-style', 'compressed', __dirname + '/sample.scss']);
var emitter = cli(['--output-style', 'compressed', path.join(__dirname, 'sample.scss')]);
emitter.on('error', done);
emitter.on('render', function(css){
assert.equal(css, expectedSampleCompressed);
fs.unlink(process.cwd() + '/sample.css', done);
fs.unlink(path.resolve(process.cwd(), 'sample.css'), done);
});
});

it('should compile with the --source-comments option', function(done){
var emitter = cli(['--source-comments', 'none', __dirname + '/sample.scss']);
var emitter = cli(['--source-comments', 'none', path.join(__dirname, 'sample.scss')]);
emitter.on('error', done);
emitter.on('render', function(css){
assert.equal(css, expectedSampleNoComments);
fs.unlink(process.cwd() + '/sample.css', done);
fs.unlink(path.resolve(process.cwd(), 'sample.css'), done);
});
});

it('should write the output to the file specified with the --output option', function(done){
var resultPath = path.resolve(__dirname, '..', 'output.css');
var emitter = cli(['--output', resultPath, __dirname + '/sample.scss']);
var resultPath = path.join(__dirname, '../output.css');
var emitter = cli(['--output', resultPath, path.join(__dirname, 'sample.scss')]);
emitter.on('error', done);
emitter.on('write', function(css){
fs.exists(resultPath, function(exists) {
Expand Down