Test that console.log is never called

This commit is contained in:
Gaël Métais
2014-11-28 18:31:14 +01:00
parent 6089e5fe20
commit 35aed5fb55
2 changed files with 14 additions and 2 deletions
+3 -1
View File
@@ -32,7 +32,9 @@
"matchdep": "^0.3.0",
"mocha": "^2.0.1",
"phantomjs": "^1.9.10",
"q": "^1.1.2"
"q": "^1.1.2",
"sinon": "^1.12.1",
"sinon-chai": "^2.6.0"
},
"scripts": {
"test": "grunt test"
+11 -1
View File
@@ -1,6 +1,11 @@
var should = require('chai').should();
var chai = require('chai');
var sinon = require('sinon');
var sinonChai = require('sinon-chai');
var should = chai.should();
var YellowLabTools = require('../../lib/yellowlabtools.js');
chai.use(sinonChai);
describe('yellowlabtools', function() {
@@ -28,6 +33,9 @@ describe('yellowlabtools', function() {
it('succeeds on simple-page.html', function(done) {
this.timeout(15000);
// Check if console.log is called
sinon.spy(console, 'log')
var url = 'http://localhost:8388/simple-page.html';
var ylt = new YellowLabTools(url)
@@ -67,6 +75,8 @@ describe('yellowlabtools', function() {
"offenders": ["body > h1[1]"]
});
console.log.should.not.have.been.called;
done();
}).fail(function(err) {
done(err);