Fixed tests to work with node-v0.1.102
This commit is contained in:
parent
2fe9b0b6bd
commit
8d542f1aa6
@ -1,11 +1,15 @@
|
|||||||
fs = require('fs'), events = require('events');
|
|
||||||
|
|
||||||
waitForWriteAndThenReadFile = function (filename) {
|
|
||||||
process.loop();
|
|
||||||
return fs.readFileSync(filename);
|
|
||||||
};
|
|
||||||
|
|
||||||
describe 'log4js'
|
describe 'log4js'
|
||||||
|
before
|
||||||
|
extend(context, {
|
||||||
|
log4js : require("log4js"),
|
||||||
|
fs: require("fs"),
|
||||||
|
waitForWriteAndThenReadFile : function (filename) {
|
||||||
|
process.loop();
|
||||||
|
return fs.readFileSync(filename, "utf8");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
end
|
||||||
|
|
||||||
before_each
|
before_each
|
||||||
log4js.clearAppenders();
|
log4js.clearAppenders();
|
||||||
event = '';
|
event = '';
|
||||||
@ -132,7 +136,7 @@ describe 'log4js'
|
|||||||
try {
|
try {
|
||||||
fs.unlinkSync('./tmp-tests.log');
|
fs.unlinkSync('./tmp-tests.log');
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
print('Could not delete tmp-tests.log: '+e.message);
|
//print('Could not delete tmp-tests.log: '+e.message);
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -171,12 +175,12 @@ describe 'log4js'
|
|||||||
try {
|
try {
|
||||||
fs.unlinkSync('./tmp-tests.log');
|
fs.unlinkSync('./tmp-tests.log');
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
print('Could not delete tmp-tests.log: '+e.message);
|
//print('Could not delete tmp-tests.log: '+e.message);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
fs.unlinkSync('./tmp-tests-warnings.log');
|
fs.unlinkSync('./tmp-tests-warnings.log');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('Could not delete tmp-tests-warnings.log: '+e.message);
|
//print('Could not delete tmp-tests-warnings.log: '+e.message);
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -207,9 +211,14 @@ describe 'log4js'
|
|||||||
waitForWriteAndThenReadFile('./tmp-tests-warnings.log').should.be 'both\nboth\n'
|
waitForWriteAndThenReadFile('./tmp-tests-warnings.log').should.be 'both\nboth\n'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'Date'
|
describe 'Date'
|
||||||
|
before
|
||||||
|
require("log4js");
|
||||||
|
end
|
||||||
|
|
||||||
describe 'toFormattedString'
|
describe 'toFormattedString'
|
||||||
it 'should add a toFormattedString method to Date'
|
it 'should add a toFormattedString method to Date'
|
||||||
var date = new Date();
|
var date = new Date();
|
||||||
|
6
tests.js
6
tests.js
@ -1,8 +1,6 @@
|
|||||||
require.paths.unshift("./spec/lib", "./lib");
|
require.paths.unshift("./spec/lib", "./lib");
|
||||||
require("jspec");
|
require("jspec");
|
||||||
|
|
||||||
log4js = require("log4js-node");
|
|
||||||
|
|
||||||
var sys = require("sys"), fs = require("fs");
|
var sys = require("sys"), fs = require("fs");
|
||||||
|
|
||||||
quit = process.exit
|
quit = process.exit
|
||||||
@ -11,7 +9,7 @@ print = sys.puts
|
|||||||
readFile = function(path) {
|
readFile = function(path) {
|
||||||
var result;
|
var result;
|
||||||
try {
|
try {
|
||||||
result = fs.readFileSync(path);
|
result = fs.readFileSync(path, "utf8");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
@ -37,7 +35,7 @@ if (process.ARGV[2]) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (specsFound) {
|
if (specsFound) {
|
||||||
JSpec.run({ reporter: JSpec.reporters.Terminal });
|
JSpec.run({ reporter: JSpec.reporters.Terminal, failuresOnly: false });
|
||||||
JSpec.report();
|
JSpec.report();
|
||||||
} else {
|
} else {
|
||||||
print("No tests to run. This makes me sad.");
|
print("No tests to run. This makes me sad.");
|
||||||
|
Loading…
Reference in New Issue
Block a user