mweibel / connect-session-sequelize

Sequelize SessionStore for Express/Connect

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

err is TypeError: this._expirationInterval.unref is not a function

nishant-dani opened this issue · comments

I am testing using jest and getting an exception when
This seems similar to #86 . The stack at this time is:

      at SequelizeStore.startExpiringSessions (node_modules/connect-session-sequelize/lib/connect-session-sequelize.js:163:32)
      at new SequelizeStore (node_modules/connect-session-sequelize/lib/connect-session-sequelize.js:41:10)

I added a console.log at the statement and it appears

  this._expirationInterval = setInterval(this.clearExpiredSessions.bind(this), this.options.checkExpirationInterval)
  console.log(`this._expirationInterval is ${this._expirationInterval}, ${typeof this._expirationInterval}`)

this._expirationInterval is 4, number

So it appears that setInterval returns an opaque number instead of a timeout object and that is why the unref call is failing.

The issue was that jest was using jsdom instead of node and that was leading to the incorrect setInterval being resolved. Fixed this by setting jest configuration to node.