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

Commit

Permalink
Reduce race conditons in watcher tests
Browse files Browse the repository at this point in the history
We are getting test failures:

1) cli node-sass in.scss should watch the full scss dep tree for a single file:

      Uncaught AssertionError: false == true

      + expected - actual

      -false

      +true

      at Socket.<anonymous> (test/cli.js:317:9)
      at readableAddChunk (_stream_readable.js:146:16)
      at Socket.Readable.push (_stream_readable.js:110:10)
      at Pipe.onread (net.js:523:20)
  • Loading branch information
saper committed Sep 16, 2015
1 parent d43ab63 commit a6041b7
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 10 deletions.
18 changes: 9 additions & 9 deletions test/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,9 @@ describe('cli', function() {
}, 500);
});

it('should watch the full scss dep tree for a single file', function(done) {
it('should watch the full scss dep tree for a single file (scss)', function(done) {
var src = fixture('watching/index.scss');
var foo = fixture('watching/foo.scss');
var foo = fixture('watching/white.scss');

fs.writeFileSync(foo, '');

Expand All @@ -314,17 +314,17 @@ describe('cli', function() {

bin.stdout.setEncoding('utf8');
bin.stdout.once('data', function(data) {
assert(data.trim() === 'body{background:white}');
assert.equal(data.trim(), 'body{background:blue}');
bin.kill();
done();
});

setTimeout(function() {
fs.appendFileSync(foo, 'body{background:white}\n');
fs.appendFileSync(foo, 'body{background:blue}\n');
}, 500);
});

it('should watch the full sass dep tree for a single file', function(done) {
it('should watch the full sass dep tree for a single file (sass)', function(done) {
var src = fixture('watching/index.sass');
var foo = fixture('watching/bar.sass');

Expand All @@ -337,21 +337,21 @@ describe('cli', function() {

bin.stdout.setEncoding('utf8');
bin.stdout.once('data', function(data) {
assert(data.trim() === 'body{background:white}');
assert.equal(data.trim(), 'body{background:red}');
bin.kill();
done();
});

setTimeout(function() {
fs.appendFileSync(foo, 'body\n\tbackground: white\n');
fs.appendFileSync(foo, 'body\n\tbackground: red\n');
}, 500);
});
});

describe('node-sass --output directory', function() {
it('should watch whole directory', function(done) {
var destDir = fixture('watching-css-out-01/');
var srcDir = fixture('watching-dir/');
var srcDir = fixture('watching-dir-01/');
var srcFile = path.join(srcDir, 'index.scss');

fs.writeFileSync(srcFile, '');
Expand All @@ -375,7 +375,7 @@ describe('cli', function() {

it('should compile all changed files in watched directory', function(done) {
var destDir = fixture('watching-css-out-02/');
var srcDir = fixture('watching/');
var srcDir = fixture('watching-dir-02/');
var srcFile = path.join(srcDir, 'foo.scss');

fs.writeFileSync(srcFile, '');
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions test/fixtures/watching-dir-02/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import './foo';
2 changes: 1 addition & 1 deletion test/fixtures/watching/index.scss
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@import './foo';
@import './white';
1 change: 1 addition & 0 deletions test/fixtures/watching/white.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
body{background:white}

0 comments on commit a6041b7

Please sign in to comment.