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

Commit

Permalink
Avoid race conditon in watch dir tests
Browse files Browse the repository at this point in the history
Use two different directories for
directory watching CLI tests to
avoid races.
  • Loading branch information
saper committed Sep 16, 2015
1 parent 17cfde3 commit 9a2536f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ vendor
test/html-report
test/lcov-report
test/lcov.info
test/fixtures/watching-css-out-01
test/fixtures/watching-css-out-02
coverage
12 changes: 6 additions & 6 deletions test/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,9 +346,11 @@ describe('cli', function() {
fs.appendFileSync(foo, 'body\n\tbackground: white\n');
}, 500);
});
});

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

Expand All @@ -366,14 +368,13 @@ describe('cli', function() {
bin.kill();
var files = fs.readdirSync(destDir);
assert.deepEqual(files, ['index.css']);
rimraf.sync(destDir);
done();
rimraf(destDir, done);
}, 200);
}, 500);
});

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

Expand All @@ -391,8 +392,7 @@ describe('cli', function() {
bin.kill();
var files = fs.readdirSync(destDir);
assert.deepEqual(files, ['foo.css', 'index.css']);
rimraf.sync(destDir);
done();
rimraf(destDir, done);
}, 200);
}, 500);
});
Expand Down

0 comments on commit 9a2536f

Please sign in to comment.