wallabyjs / public

Repository for Wallaby.js questions and issues
http://wallabyjs.com
760 stars 45 forks source link

Wallaby fails when using knex.js (db query builder) #177

Closed halfdan closed 9 years ago

halfdan commented 9 years ago

The moment I use knex in my project wallaby doesn't seem to be able to run tests anymore. Here's an example project with just two simple tests: https://github.com/halfdan/wallaby-fail

The moment you take out the this._knex = knex(options); in lib/thing.js the tests seem to run fine. With that line the wallaby hangs at the first test:

Thu, 02 Jul 2015 10:24:34 GMT wallaby:workers Parallelism for initial run: 6, for regular run: 2
Thu, 02 Jul 2015 10:24:34 GMT wallaby:workers Starting run worker instance #0
Thu, 02 Jul 2015 10:24:34 GMT wallaby:workers Starting run worker instance #1
Thu, 02 Jul 2015 10:24:34 GMT wallaby:workers Starting run worker instance #2
Thu, 02 Jul 2015 10:24:34 GMT wallaby:workers Starting run worker instance #3
Thu, 02 Jul 2015 10:24:34 GMT wallaby:workers Starting run worker instance #4
Thu, 02 Jul 2015 10:24:34 GMT wallaby:workers Starting run worker instance #5
Thu, 02 Jul 2015 10:24:34 GMT wallaby:workers Web server is listening at 55227
Thu, 02 Jul 2015 10:24:34 GMT wallaby:project File cache requires some updates, waiting required files from IDE
Thu, 02 Jul 2015 10:24:34 GMT wallaby:project File test/thing_spec.js changes are patches only: false
Thu, 02 Jul 2015 10:24:35 GMT wallaby:project Preparing to process test/thing_spec.js
Thu, 02 Jul 2015 10:24:35 GMT wallaby:project Starting processor pool (if not yet started)
Thu, 02 Jul 2015 10:24:37 GMT wallaby:workers Started run worker instance (delayed) #0
Thu, 02 Jul 2015 10:24:37 GMT wallaby:workers Started run worker instance (delayed) #2
Thu, 02 Jul 2015 10:24:37 GMT wallaby:workers Started run worker instance (delayed) #1
Thu, 02 Jul 2015 10:24:37 GMT wallaby:workers Started run worker instance (delayed) #4
Thu, 02 Jul 2015 10:24:37 GMT wallaby:workers Started run worker instance (delayed) #3
Thu, 02 Jul 2015 10:24:37 GMT wallaby:workers Started run worker instance (delayed) #5
Thu, 02 Jul 2015 10:24:37 GMT wallaby:processor No compilers found for test/thing_spec.js
Thu, 02 Jul 2015 10:24:37 GMT wallaby:project Instrumenting test/thing_spec.js, via process pool: true
Thu, 02 Jul 2015 10:24:38 GMT wallaby:project No preprocessors configured for test/thing_spec.js
Thu, 02 Jul 2015 10:24:38 GMT wallaby:project Writing to disk and caching processed file test/thing_spec.js
Thu, 02 Jul 2015 10:24:38 GMT wallaby:project File test/thing_spec.js changes saved, store ts: 1435832654000, change ts: 1435832674999
Thu, 02 Jul 2015 10:24:38 GMT wallaby:project Stopping process pool
Thu, 02 Jul 2015 10:24:38 GMT wallaby:project Running postprocessor
Thu, 02 Jul 2015 10:24:38 GMT wallaby:postprocessor New TypeScript language service is required
Thu, 02 Jul 2015 10:24:38 GMT wallaby:postprocessor TypeScript postprocessor will be removed because in 2 project files none were found by patterns: **/*.ts
Thu, 02 Jul 2015 10:24:38 GMT wallaby:project Postprocessor execution finished
Thu, 02 Jul 2015 10:24:38 GMT wallaby:project Postprocessor is removed as requested by itself
Thu, 02 Jul 2015 10:24:38 GMT wallaby:project Test run started; run priority: 3
Thu, 02 Jul 2015 10:24:38 GMT wallaby:project Running all tests
Thu, 02 Jul 2015 10:24:38 GMT wallaby:workers Starting test run, priority: 3
Thu, 02 Jul 2015 10:24:38 GMT wallaby:nodeRunner Starting sandbox [worker #0, session #p75ci]
Thu, 02 Jul 2015 10:24:38 GMT wallaby:nodeRunner Preparing sandbox [worker #0, session #p75ci]
Thu, 02 Jul 2015 10:24:38 GMT wallaby:nodeRunner Prepared sandbox [worker #0, session #p75ci]
Thu, 02 Jul 2015 10:24:38 GMT wallaby:workers Running tests in sandbox [worker #0, session #p75ci]
Thu, 02 Jul 2015 10:24:38 GMT wallaby:workers Loaded 2 test(s)
Thu, 02 Jul 2015 10:24:39 GMT wallaby:workers Test executed: returns object.key
One of your tests is taking too long to execute, check for possibly recently introduced infinite loops.

I'm using the latest IntelliJ version, node 0.10 and an unregistered version of wallaby. Log output in idea.log doesn't contain anything wallaby related.

ArtemGovorov commented 9 years ago

It looks like knex is having some issue running in io.js. By default, wallaby is using its own node version, that is currently io.js. If you'd like wallaby to run your local default node version (whatever node command runs) you may specify the command as a value of the runner property:

env: {
      type: 'node',
      runner: 'node'
      // or
      // runner: 'path to the desired node version'
    }

Alternatively you may specify a path to the desired node version if 0.10 is not your default version and is installed via nvm for example.

Please let me know if it fixes the issue for you.

ArtemGovorov commented 9 years ago

You may double check what version of node is running by just console.log-ing it: screen shot 2015-07-02 at 9 12 53 pm

halfdan commented 9 years ago

@ArtemGovorov That does indeed fix it! Is there any way Wallaby could emit/catch an error somewhere and display that? It's not very helpful if an unrelated test suddenly times out.

Feel free to close. Thanks for your help! :)

ArtemGovorov commented 9 years ago

@halfdan Awesome, thanks. It normally does display errors like this one, I'll check why it doesn't in this case.