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

Commit

Permalink
test hardening
Browse files Browse the repository at this point in the history
  • Loading branch information
xzyfer committed Feb 22, 2017
1 parent 345ef61 commit dd5cd52
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions test/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var assert = require('assert'),
describe('cli', function() {
// For some reason we experience random timeout failures in CI
// due to spawn hanging/failing silently. See #1692.
this.retries(4);
// this.retries(4);

describe('node-sass < in.scss', function() {
it('should read data from stdin', function(done) {
Expand Down Expand Up @@ -337,7 +337,7 @@ describe('cli', function() {
]);

bin.stdout.setEncoding('utf8');
bin.stdout.once('data', function(data) {
bin.stdout.on('data', function(data) {
assert.strictEqual(data.trim(), 'body{background:white}');
bin.kill();
});
Expand Down Expand Up @@ -383,7 +383,7 @@ describe('cli', function() {
setTimeout(function() {
touch.sync(srcFile);
}, 500);
});
}).timeout(5000);

it('should compile all changed files in watched directory', function(done) {
var destDir = tmpDir({ create: true });
Expand All @@ -402,16 +402,18 @@ describe('cli', function() {
});
bin.on('error', assert.fail);


fs.watch(destDir, once(function() {
bin.kill();
fs.readdir(destDir, function(err, files) {
assert.deepEqual(files, ['foo.css', 'index.css']);
rimraf(destDir, done);
});
}));

setTimeout(function() {
// Two output files are produced so fs.watch
// may fire or twice depending on environment.
// Using a timeout is more predictable but slower.
setTimeout(function() {
bin.kill();
fs.readdir(destDir, function(err, files) {
assert.deepEqual(files, ['foo.css', 'index.css']);
rimraf(destDir, done);
});
}, 1000);

touch.sync(srcFile);
}, 500);
});
Expand Down

0 comments on commit dd5cd52

Please sign in to comment.