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

Commit a6041b7

Browse files
committed
Reduce race conditons in watcher tests
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)
1 parent d43ab63 commit a6041b7

File tree

6 files changed

+12
-10
lines changed

6 files changed

+12
-10
lines changed

test/cli.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,9 @@ describe('cli', function() {
301301
}, 500);
302302
});
303303

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

308308
fs.writeFileSync(foo, '');
309309

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

315315
bin.stdout.setEncoding('utf8');
316316
bin.stdout.once('data', function(data) {
317-
assert(data.trim() === 'body{background:white}');
317+
assert.equal(data.trim(), 'body{background:blue}');
318318
bin.kill();
319319
done();
320320
});
321321

322322
setTimeout(function() {
323-
fs.appendFileSync(foo, 'body{background:white}\n');
323+
fs.appendFileSync(foo, 'body{background:blue}\n');
324324
}, 500);
325325
});
326326

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

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

338338
bin.stdout.setEncoding('utf8');
339339
bin.stdout.once('data', function(data) {
340-
assert(data.trim() === 'body{background:white}');
340+
assert.equal(data.trim(), 'body{background:red}');
341341
bin.kill();
342342
done();
343343
});
344344

345345
setTimeout(function() {
346-
fs.appendFileSync(foo, 'body\n\tbackground: white\n');
346+
fs.appendFileSync(foo, 'body\n\tbackground: red\n');
347347
}, 500);
348348
});
349349
});
350350

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

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

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

381381
fs.writeFileSync(srcFile, '');
File renamed without changes.
File renamed without changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@import './foo';

test/fixtures/watching/index.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
@import './foo';
1+
@import './white';

test/fixtures/watching/white.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
body{background:white}

0 commit comments

Comments
 (0)