Commit 4a4bba8c by Kevin Martensson

Add stdin test

parent 7a2d373f
...@@ -2,6 +2,7 @@ var path = require('path'), ...@@ -2,6 +2,7 @@ var path = require('path'),
assert = require('assert'), assert = require('assert'),
fs = require('fs'), fs = require('fs'),
exec = require('child_process').exec, exec = require('child_process').exec,
spawn = require('child_process').spawn,
assign = require('object-assign'), assign = require('object-assign'),
cli = process.env.NODESASS_COVERAGE ? require('../lib-coverage/cli') : require('../lib/cli'), cli = process.env.NODESASS_COVERAGE ? require('../lib-coverage/cli') : require('../lib/cli'),
cliPath = path.resolve(__dirname, '../bin/node-sass'), cliPath = path.resolve(__dirname, '../bin/node-sass'),
...@@ -32,6 +33,19 @@ var sampleCssOutputPath = path.join(__dirname, '../sample.css'); ...@@ -32,6 +33,19 @@ var sampleCssOutputPath = path.join(__dirname, '../sample.css');
var sampleCssMapOutputPath = path.join(__dirname, '../sample.css.map'); var sampleCssMapOutputPath = path.join(__dirname, '../sample.css.map');
describe('cli', function() { describe('cli', function() {
it('should read data from stdin', function(done) {
var src = fs.createReadStream(sampleScssPath);
var emitter = spawn(cliPath, ['--stdout']);
emitter.stdout.on('data', function(data) {
data = data.toString().trim();
assert.equal(data, expectedSampleNoComments.trim());
done();
});
src.pipe(emitter.stdin);
});
it('should print help when run with no arguments', function(done) { it('should print help when run with no arguments', function(done) {
var env = assign(process.env, { isTTY: true }); var env = assign(process.env, { isTTY: true });
exec('node ' + cliPath, { exec('node ' + cliPath, {
......
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