1

I'm trying out laika test framework for meteor. The second example from the homepage uses observe() and I think it is not observing correctly.

suite('Posts', function() {
    test('using both client and server', function(done, server, client) {
    server.eval(function() {
      Posts.find().observe({
        added: addedNewPost
      });
      function addedNewPost(post) {
        emit('post', post);
      }
    }).once('post', function(post) {
      assert.equal(post.title, 'hello title');
      done();
    });
    client.eval(function() {
      Posts.insert({title: 'hello title'});
    });
  });
});

I always get a timeout. Increasing the timeout period doesn't help. I can't figure out what I'm doing wrong and I can't work out how to get any more verbose output. Peppering the tests with calls to console.log() gives nothing.

output:

1) Posts using both client and the server:
 Error: timeout of 2000ms exceeded
  at null.<anonymous> (/usr/local/share/npm/lib/node_modules/laika/node_modules/mocha/lib/runnable.js:165:14)
  at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)
Charles
  • 50,943
  • 13
  • 104
  • 142
Julian Mann
  • 6,256
  • 5
  • 31
  • 43

2 Answers2

2

i've had a similar issue with laika, with node 0.10.10. I switched to node 0.10.4, and the timeouts disappeared.

I don't know if your case is exactly the same as mine, but it's worth a try.

Twark
  • 146
  • 2
  • 4
  • 1
    Yes laika has some issues with node version 0.10.8 to 0.10.10 - it is something with node-phantom module used by laika – Arunoda Susiripala Jun 28 '13 at 09:43
  • I'm having the same problem with `node v0.10.24`. More info can be found under [laika issue #48](https://github.com/arunoda/laika/issues/48). – mfaerevaag Jan 16 '14 at 14:49
0

Probably the mongodb is your bottleneck.

Start mongodb this way:

mongod --smallfiles --noprealloc --nojournal

I was able to run the laika tests under the default 5000ms timeout. However if you're running this on a slow computer, you can simple change the laika default timeout:

laika -t 10000

In my experience, it has nothing to do with the version of nodejs. However there are some problems in mac os x version that set the cpu around 30% to 60%+ in idle.

Mário
  • 1,603
  • 14
  • 24