Fixed tests to work with node-v0.1.102

This commit is contained in:
Gareth Jones 2010-08-11 13:36:51 +10:00 committed by Gareth
parent 2fe9b0b6bd
commit 8d542f1aa6
2 changed files with 21 additions and 14 deletions

View File

@ -1,11 +1,15 @@
fs = require('fs'), events = require('events');
waitForWriteAndThenReadFile = function (filename) {
process.loop();
return fs.readFileSync(filename);
};
describe 'log4js'
before
extend(context, {
log4js : require("log4js"),
fs: require("fs"),
waitForWriteAndThenReadFile : function (filename) {
process.loop();
return fs.readFileSync(filename, "utf8");
}
});
end
before_each
log4js.clearAppenders();
event = '';
@ -132,7 +136,7 @@ describe 'log4js'
try {
fs.unlinkSync('./tmp-tests.log');
} catch(e) {
print('Could not delete tmp-tests.log: '+e.message);
//print('Could not delete tmp-tests.log: '+e.message);
}
end
@ -171,12 +175,12 @@ describe 'log4js'
try {
fs.unlinkSync('./tmp-tests.log');
} catch(e) {
print('Could not delete tmp-tests.log: '+e.message);
//print('Could not delete tmp-tests.log: '+e.message);
}
try {
fs.unlinkSync('./tmp-tests-warnings.log');
} catch (e) {
print('Could not delete tmp-tests-warnings.log: '+e.message);
//print('Could not delete tmp-tests-warnings.log: '+e.message);
}
end
@ -207,9 +211,14 @@ describe 'log4js'
waitForWriteAndThenReadFile('./tmp-tests-warnings.log').should.be 'both\nboth\n'
end
end
end
describe 'Date'
before
require("log4js");
end
describe 'toFormattedString'
it 'should add a toFormattedString method to Date'
var date = new Date();

View File

@ -1,8 +1,6 @@
require.paths.unshift("./spec/lib", "./lib");
require("jspec");
log4js = require("log4js-node");
var sys = require("sys"), fs = require("fs");
quit = process.exit
@ -11,7 +9,7 @@ print = sys.puts
readFile = function(path) {
var result;
try {
result = fs.readFileSync(path);
result = fs.readFileSync(path, "utf8");
} catch (e) {
throw e;
}
@ -37,7 +35,7 @@ if (process.ARGV[2]) {
);
}
if (specsFound) {
JSpec.run({ reporter: JSpec.reporters.Terminal });
JSpec.run({ reporter: JSpec.reporters.Terminal, failuresOnly: false });
JSpec.report();
} else {
print("No tests to run. This makes me sad.");