Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

node 0.8

  • Loading branch information...
commit ddf08e35d42d957f2a94606874c9863bb5dfb2f1 1 parent 8c4628d
@vesln authored
View
3  .travis.yml
@@ -1,3 +1,4 @@
language: node_js
node_js:
- - 0.6
+ - 0.6
+ - 0.8
View
3  Makefile
@@ -2,11 +2,10 @@ TESTS = test/*.test.js
test:
@NODE_ENV=test ./node_modules/.bin/mocha \
- --require should \
--reporter spec \
$(TESTS)
clean:
rm -f examples/tmp/*
-.PHONY: test clean
+.PHONY: test clean
View
4 package.json
@@ -10,8 +10,8 @@
, "package": "1.0.x"
}
, "devDependencies": {
- "mocha": "0.3.3"
- , "should": "0.3.2"
+ "mocha": "*"
+ , "chai": "*"
}
, "repository" : {
"type" : "git",
View
34 test/logme.test.js
@@ -1,11 +1,11 @@
/**
* Logme - Minimalistic logging.
- *
+ *
* Author: Veselin Todorov <hi@vesln.com>
* Licensed under the MIT License.
*/
-
-var should = require('should');
+
+var should = require('chai').should();
var main = require('../');
var Logme = main.Logme;
var themes = main.themes;
@@ -29,20 +29,20 @@ describe('Logme', function(){
beforeEach(function(){
logme = new Logme;
});
-
+
afterEach(function(){
logme = null;
});
-
+
it('should expose version', function() {
main.version.should.be.ok;
});
-
+
it('should be configurable on construction', function(){
var logme = new Logme({ prefix: 'foo' });
logme.options.prefix.should.equal('foo');
});
-
+
it('should have defaults', function(){
logme.options.should.eql({
level: 'debug',
@@ -50,7 +50,7 @@ describe('Logme', function(){
stream: process.stdout
});
});
-
+
it('should have levels', function(){
logme.levels.should.eql({
debug: 7,
@@ -60,7 +60,7 @@ describe('Logme', function(){
critical: 2
});
});
-
+
describe('tokens', function(){
it('should have date', function(){
logme.tokens.date().should.match(dateRegExp);
@@ -84,7 +84,7 @@ describe('Logme', function(){
logme.tokens.heapUsed().should.match(/\d+/);
});
});
-
+
describe('message', function(){
it('should format messages', function(){
var msg = 'Test msg';
@@ -93,7 +93,7 @@ describe('Logme', function(){
logme.message(level, msg).should.eql(theme[level].replace(':message', msg));
}
});
-
+
it('should replace tokens', function(){
var logme = new Logme({level: 'error', stream: stream});
var debug = logme.templates['debug'];
@@ -105,23 +105,23 @@ describe('Logme', function(){
logme.templates['debug'] = debug;
});
});
-
+
describe('log', function(){
afterEach(function(){
log = null;
});
-
+
it('shouldn\'t log messages if the supplied log level is greater than the defined one', function(){
var logme = new Logme({level: 'error', stream: stream});
should.not.exist(logme.log('debug', 'Foo'));
});
-
+
it('should write to the stream', function(){
var logme = new Logme({level: 'debug', stream: stream });
logme.log('debug', 'Bar')
log.should.equal(logme.message('debug', 'Bar') + '\n');
});
-
+
it('should log multiple values at once', function(){
var logme = new Logme({ level: 'debug', stream: stream, theme: 'minimalistic' });
logme.log('debug', 'Foo', 'bar', 'baz');
@@ -130,7 +130,7 @@ describe('Logme', function(){
log.should.eql('debug: Key: value\n');
});
});
-
+
describe('inspect', function(){
it('should inspect an obj', function(){
var logme = new Logme({ stream: stream, theme: { inspect: false }});
@@ -140,4 +140,4 @@ describe('Logme', function(){
log.should.eql('{ foo: \'bar\' }\n');
});
});
-});
+});
View
9 test/themes.test.js
@@ -1,18 +1,19 @@
/**
* Logme - Minimalistic logging.
- *
+ *
* Author: Veselin Todorov <hi@vesln.com>
* Licensed under the MIT License.
*/
-
+
var main = require('../');
var Logme = main.Logme;
var themes = main.themes;
-
+var should = require('chai').should();
+
describe('themes', function(){
describe('get', function(){
it('should return a theme', function(){
themes.get('default').should.eql(require('../lib/themes/default'));
});
});
-});
+});
Please sign in to comment.
Something went wrong with that request. Please try again.