added a delay to dateFile test, to let the filesystem catch up

This commit is contained in:
Gareth Jones 2013-06-06 08:00:34 +10:00
parent dd25d30228
commit fa179ecba2

View File

@ -99,7 +99,8 @@ vows.describe('../lib/appenders/dateFile').addBatch({
}, },
'with options.alwaysIncludePattern': { 'with options.alwaysIncludePattern': {
topic: function() { topic: function() {
var log4js = require('../lib/log4js') var self = this
, log4js = require('../lib/log4js')
, format = require('../lib/date_format') , format = require('../lib/date_format')
, logger , logger
, options = { , options = {
@ -127,7 +128,10 @@ vows.describe('../lib/appenders/dateFile').addBatch({
logger = log4js.getLogger('tests'); logger = log4js.getLogger('tests');
logger.warn('this should be written to the file with the appended date'); logger.warn('this should be written to the file with the appended date');
this.teardown = removeFile('date-file-test' + thisTime); this.teardown = removeFile('date-file-test' + thisTime);
fs.readFile(path.join(__dirname, 'date-file-test' + thisTime), 'utf8', this.callback); //wait for filesystem to catch up
setTimeout(function() {
fs.readFile(path.join(__dirname, 'date-file-test' + thisTime), 'utf8', self.callback);
}, 100);
}, },
'should create file with the correct pattern': function(contents) { 'should create file with the correct pattern': function(contents) {
assert.include(contents, 'this should be written to the file with the appended date'); assert.include(contents, 'this should be written to the file with the appended date');