diff --git a/test-runner.js b/test-runner.js index 6a049aa..845e989 100644 --- a/test-runner.js +++ b/test-runner.js @@ -102,8 +102,8 @@ x11.createClient(function(err, display) { function() { X.terminate(); X.on('end', function() { - mocha.run(function() { - process.exit(); + mocha.run(function(failures) { + process.exit(failures); }); }); diff --git a/test/core-properties.js b/test/core-properties.js index a97f35a..8061c21 100644 --- a/test/core-properties.js +++ b/test/core-properties.js @@ -82,8 +82,8 @@ describe('Window property', function() { }); }); - it('should exist in the ListProperties result after inserted'); - it('should not exist after GetProperty with delete flag called'); + // it('should exist in the ListProperties result after inserted'); + // it('should not exist after GetProperty with delete flag called'); //it('should not exist after GetProperty with delete flag called', function(done) { // done(); //}); diff --git a/test/errors.js b/test/errors.js index 2ff8332..80b0c30 100644 --- a/test/errors.js +++ b/test/errors.js @@ -5,26 +5,30 @@ var assert = require('assert'); describe('Client', function() { var display; - beforeEach(function(done) { - var client = x11.createClient({ debug: true }, function(err, dpy) { - console.log(err) + before(function(done) { + var client = x11.createClient({ debug: false }, function(err, dpy) { + should.not.exist(err); display = dpy; - done(err); + done(); }); }); it('should emit error which is instance of Error with sequence number corresponding to source request', function(done) { + var times = 0; display.client.CreateWindow(); // should emit error var seq = display.client.seq_num; - display.client.once('error', function(err) { - assert.equal(err.constructor, Error); - assert.equal(seq, err.seq); - display.client.CreateWindow(); // should emit error - seq = display.client.seq_num; - display.client.once('error', function(err) { + display.client.on('error', function(err) { + switch (++ times) { + case 11: + display.client.removeAllListeners('error'); + done(1); + break; + default: + assert.equal(err.constructor, Error); assert.equal(seq, err.seq); - done(); - }); - }); - }); + display.client.CreateWindow(); // should emit error + seq = display.client.seq_num; + } + }); }); + });