santigimeno / node-pcsclite

Bindings over pcsclite to access Smart Cards
ISC License
170 stars 127 forks source link

"npm test" fails with "Uncaught TypeError: number is not a function" #13

Closed LudovicRousseau closed 10 years ago

LudovicRousseau commented 10 years ago
$ npm test

> pcsclite@0.3.0 test /Users/rousseau/Documents/github/node-pcsclite
> mocha

  ․․․․․․․․

  4 passing (13 ms)
  4 failing

  1) Testing CardReader private #_connect() #_connect() success:
     Uncaught TypeError: number is not a function
      at CardReader.<anonymous> (/Users/rousseau/Documents/github/node-pcsclite/test/test.js:81:21)
      at Function.invoke (/Users/rousseau/Documents/github/node-pcsclite/node_modules/sinon/lib/sinon/spy.js:162:59)
      at CardReader.proxy [as _connect] (/Users/rousseau/Documents/github/node-pcsclite/node_modules/sinon/lib/sinon/spy.js:132:34)
      at CardReader.connect (/Users/rousseau/Documents/github/node-pcsclite/lib/pcsclite.js:81:14)
      at PCSCLite.<anonymous> (/Users/rousseau/Documents/github/node-pcsclite/test/test.js:84:24)
      at PCSCLite.emit (events.js:95:17)
      at /Users/rousseau/Documents/github/node-pcsclite/lib/pcsclite.js:62:19
      at Array.forEach (native)
      at /Users/rousseau/Documents/github/node-pcsclite/lib/pcsclite.js:45:23
      at PCSCLite.<anonymous> (/Users/rousseau/Documents/github/node-pcsclite/test/test.js:69:13)
      at Function.invoke (/Users/rousseau/Documents/github/node-pcsclite/node_modules/sinon/lib/sinon/spy.js:162:59)
      at PCSCLite.proxy (/Users/rousseau/Documents/github/node-pcsclite/node_modules/sinon/lib/sinon/spy.js:132:34)
      at /Users/rousseau/Documents/github/node-pcsclite/lib/pcsclite.js:28:11
      at process._tickCallback (node.js:419:13)

  2) Testing CardReader private #_connect() #_connect() error:
     Uncaught TypeError: number is not a function
      at CardReader.<anonymous> (/Users/rousseau/Documents/github/node-pcsclite/test/test.js:97:21)
      at Function.invoke (/Users/rousseau/Documents/github/node-pcsclite/node_modules/sinon/lib/sinon/spy.js:162:59)
      at CardReader.proxy [as _connect] (/Users/rousseau/Documents/github/node-pcsclite/node_modules/sinon/lib/sinon/spy.js:132:34)
      at CardReader.connect (/Users/rousseau/Documents/github/node-pcsclite/lib/pcsclite.js:81:14)
      at PCSCLite.<anonymous> (/Users/rousseau/Documents/github/node-pcsclite/test/test.js:100:24)
      at PCSCLite.emit (events.js:95:17)
      at /Users/rousseau/Documents/github/node-pcsclite/lib/pcsclite.js:62:19
      at Array.forEach (native)
      at /Users/rousseau/Documents/github/node-pcsclite/lib/pcsclite.js:45:23
      at PCSCLite.<anonymous> (/Users/rousseau/Documents/github/node-pcsclite/test/test.js:69:13)
      at Function.invoke (/Users/rousseau/Documents/github/node-pcsclite/node_modules/sinon/lib/sinon/spy.js:162:59)
      at PCSCLite.proxy (/Users/rousseau/Documents/github/node-pcsclite/node_modules/sinon/lib/sinon/spy.js:132:34)
      at /Users/rousseau/Documents/github/node-pcsclite/lib/pcsclite.js:28:11
      at process._tickCallback (node.js:419:13)

  3) Testing CardReader private #_disconnect() #_disconnect() success:
     Uncaught TypeError: number is not a function
      at CardReader.<anonymous> (/Users/rousseau/Documents/github/node-pcsclite/test/test.js:128:21)
      at Function.invoke (/Users/rousseau/Documents/github/node-pcsclite/node_modules/sinon/lib/sinon/spy.js:162:59)
      at CardReader.proxy [as _disconnect] (/Users/rousseau/Documents/github/node-pcsclite/node_modules/sinon/lib/sinon/spy.js:132:34)
      at CardReader.disconnect (/Users/rousseau/Documents/github/node-pcsclite/lib/pcsclite.js:98:14)
      at PCSCLite.<anonymous> (/Users/rousseau/Documents/github/node-pcsclite/test/test.js:131:24)
      at PCSCLite.emit (events.js:95:17)
      at /Users/rousseau/Documents/github/node-pcsclite/lib/pcsclite.js:62:19
      at Array.forEach (native)
      at /Users/rousseau/Documents/github/node-pcsclite/lib/pcsclite.js:45:23
      at PCSCLite.<anonymous> (/Users/rousseau/Documents/github/node-pcsclite/test/test.js:69:13)
      at Function.invoke (/Users/rousseau/Documents/github/node-pcsclite/node_modules/sinon/lib/sinon/spy.js:162:59)
      at PCSCLite.proxy (/Users/rousseau/Documents/github/node-pcsclite/node_modules/sinon/lib/sinon/spy.js:132:34)
      at /Users/rousseau/Documents/github/node-pcsclite/lib/pcsclite.js:28:11
      at process._tickCallback (node.js:419:13)

  4) Testing CardReader private #_disconnect() #_disconnect() success:
     Uncaught TypeError: number is not a function
      at CardReader.<anonymous> (/Users/rousseau/Documents/github/node-pcsclite/test/test.js:128:21)
      at Function.invoke (/Users/rousseau/Documents/github/node-pcsclite/node_modules/sinon/lib/sinon/spy.js:162:59)
      at CardReader.proxy [as _disconnect] (/Users/rousseau/Documents/github/node-pcsclite/node_modules/sinon/lib/sinon/spy.js:132:34)
      at CardReader.disconnect (/Users/rousseau/Documents/github/node-pcsclite/lib/pcsclite.js:98:14)
      at PCSCLite.<anonymous> (/Users/rousseau/Documents/github/node-pcsclite/test/test.js:131:24)
      at PCSCLite.emit (events.js:95:17)
      at /Users/rousseau/Documents/github/node-pcsclite/lib/pcsclite.js:62:19
      at Array.forEach (native)
      at /Users/rousseau/Documents/github/node-pcsclite/lib/pcsclite.js:45:23
      at PCSCLite.<anonymous> (/Users/rousseau/Documents/github/node-pcsclite/test/test.js:69:13)
      at Function.invoke (/Users/rousseau/Documents/github/node-pcsclite/node_modules/sinon/lib/sinon/spy.js:162:59)
      at PCSCLite.proxy (/Users/rousseau/Documents/github/node-pcsclite/node_modules/sinon/lib/sinon/spy.js:132:34)
      at /Users/rousseau/Documents/github/node-pcsclite/lib/pcsclite.js:28:11
      at process._tickCallback (node.js:419:13)

npm ERR! Test failed.  See above for more details.
npm ERR! not ok code 0

The problematic code is like connect_cb(undefined, 1); It looks like undefined is not correct here. I do not know node-js enough to propose a patch.

santigimeno commented 10 years ago

I'll take a look at it. No surprising though as I haven't run the tests for a while. Thanks!

santigimeno commented 10 years ago

Fixed by commit https://github.com/santigimeno/node-pcsclite/commit/bec0c491df1ab3fe753690b6c19a2c674d917f0d