Make some test windows friendly.

This commit is contained in:
Pavel Sysolyatin
2014-07-17 14:29:03 +07:00
parent eaa77b0454
commit 3c4c98bb0b
7 changed files with 38 additions and 28 deletions

View File

@@ -4,7 +4,8 @@ var vows = require('vows')
, path = require('path')
, sandbox = require('sandboxed-module')
, log4js = require('../lib/log4js')
, assert = require('assert');
, assert = require('assert')
, EOL = require('os').EOL || '\n';
log4js.clearAppenders();
@@ -31,8 +32,8 @@ vows.describe('log4js fileSyncAppender').addBatch({
fs.readFile(testFile, "utf8", that.callback);
},
'should write log messages to the file': function(err, fileContents) {
assert.include(fileContents, "This should be in the file.\n");
'should write log messages to the file': function (err, fileContents) {
assert.include(fileContents, "This should be in the file." + EOL);
},
'log messages should be in the basic layout format': function(err, fileContents) {
assert.match(
@@ -60,8 +61,8 @@ vows.describe('log4js fileSyncAppender').addBatch({
fs.readFile(testFile, "utf8", that.callback);
},
'log file should only contain the second message': function(err, fileContents) {
assert.include(fileContents, "This is the second log message.\n");
'log file should only contain the second message': function (err, fileContents) {
assert.include(fileContents, "This is the second log message." + EOL);
assert.equal(fileContents.indexOf("This is the first log message."), -1);
},
'the number of files': {
@@ -173,7 +174,7 @@ vows.describe('log4js fileSyncAppender').addBatch({
fs.readFile('tmp-sync-tests.log', 'utf8', this.callback);
},
'should load appender configuration from a json file': function(err, contents) {
assert.include(contents, 'this should be written to the file\n');
assert.include(contents, 'this should be written to the file' + EOL);
assert.equal(contents.indexOf('this should not be written to the file'), -1);
}
}