New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I get this error when running my simple tests: The super constructor to inherits must not be null or undefined #53

ErnestoIslas opened this Issue Nov 9, 2017 · 6 comments


None yet
5 participants

ErnestoIslas commented Nov 9, 2017

This issue might not be related to mock-couch but I would appreciate some help. I am getting this error when running a simple test (let me know if you need the complete log):

TypeError: The super constructor to "inherits" must not be null or undefined
  at Object.inherits (util.js:971:11)
  at Object.<anonymous> (node_modules\mock-couch\node_modules\spdy\lib\spdy\connection.js:86:6)

This is my simple test (I have deleted some lines; mockedUsers is a simple JSON object):

(function mockConnection(module, require) {
  'use strict';

  const path = require('path');
  const root = path.resolve('./');
  const mockedUsers = require(`${root}/mocks/users`);

  const should = require('should');
  const mock = require('mock-couch');

  describe('Mock couch connection', function mockCouchConnection() {
    let Users;
    let mockCouch;
    const port = 5984;
    const uid = '';

    beforeEach(function beforeEach() {
      mockCouch = mock.createServer({ keepAlive: false, });
      mockCouch.listen(port, function mockCouchListen() {
        // does nothing... yet!
      // This creates a db for Mock Couch. The db is nothing but an array of objects.
      // If we provide an object with an _id property, it will use it. Otherwise, it will create a random one.
      Users = mockCouch.addDB('users', mockedUsers);

    it(`user ${uid} must exist`, function userMustExists(done) {
      // TODO: validate that user actually exists.
}(module, require));

The error happens at this line mockCouch = mock.createServer({ keepAlive: false, });. I have run the code in different Nodejs versions, including 8.4.0, 8.8.0, 7.10.0.



This comment has been minimized.

jeremy-j-ackso commented Nov 30, 2017

I'm getting this issue too.

I think it's being caused by the version of spdy in use in the version of restify that's in use in the package based on this issue in restify: restify/node-restify#1259

This package seems to rely on restify@>=2.7.0 <3.0.0.


This comment has been minimized.

gamegee commented Dec 14, 2017

After some investigation, it seems that the problem come from Node versions.
With node versions < 7.x it works - I tried it with the 6.9.1 and 5.5.5

I'll make a pull request @chris-l - #54


This comment has been minimized.

bfabec commented Jan 16, 2018

We are having the same issue on node 8.9.4, any updates on this yet?


This comment has been minimized.

gamegee commented Jan 17, 2018

The fix I've made is supposed to work.
You can just fork it #54


This comment has been minimized.

gamegee commented Jan 24, 2018


This comment has been minimized.


chris-l commented Jul 11, 2018

It seems the problem was that I forgot to update the shrinkwrap. So even with gamegee patch, it was still using the old version of restify.

Sorry about that! So I have update it now. Try again with the new version of mock-couch.

@chris-l chris-l closed this Jul 11, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment