keithwhor / nodal

API Services Made Easy With Node.js
http://www.nodaljs.com/
MIT License
4.51k stars 209 forks source link

Can't execute tests #198

Closed fredrb closed 8 years ago

fredrb commented 8 years ago

Tests are not being executed on my side, the following errors are thrown:

  1) Test Suite "before all" hook:
     Error: timeout of 2000ms exceeded. Ensure the done() callback is being called in this test.
      at Context.<anonymous> (test/runner.js:63:9)

  2) Test Suite "after all" hook:
     Error: timeout of 2000ms exceeded. Ensure the done() callback is being called in this test.
      at Context.<anonymous> (test/runner.js:72:7)

No luck using the done() callback but if I set a timeout (just like for windows) most of the tests are executed correctly. (I'm using Linux by the way).

So:

before(function(done) {
      if (Nodal.env.name === 'development') {
        // child_process.execSync('createuser postgres -s -q');
        this.timeout(30000);
        child_process.execSync('psql -c \'drop database if exists nodal_test;\' -U postgres');
        child_process.execSync('psql -c \'create database nodal_test;\' -U postgres');
        done();
      }
    });

    after(function(done) {
      this.timeout(30000);
      if (Nodal.env.name === 'development') {
        child_process.execSync('psql -c \'drop database if exists nodal_test;\' -U postgres');
      }
      done();
    });

Am I the only one experiencing this on Linux?

And also: is there I way I can set a default password for postgres user when running tests? Or at least a command line parameter like npm test -p pass

keithwhor commented 8 years ago

I run into it intermittently. It just takes PG a while to create the db sometimes. We can change the timeout to 30s.