tj / should.js

BDD style assertions for node.js -- test framework agnostic
MIT License
2.75k stars 195 forks source link

Object #<Object> has no method 'type' #139

Closed RiteshM closed 11 years ago

RiteshM commented 11 years ago

i am trying to use shouldjs 1.3.0 .when i try to run

My test code is

var strategy = require('../lib'); var should = require("should"); describe('passport-twitter', function() {

it('should export Strategy constructor directly from package', function() { console.log('strategy is',strategy); strategy.should.have.type('function'); });

it('should export Strategy constructor', function() { strategy.Strategy.should.have.type('function'); });

}); and when i run this test.it is giving me error

1) passport-twitter should export Strategy constructor directly from package: TypeError: Object # has no method 'type' at Context. (/home/ritesh/projects/passport-topcoder/test/module.test.js:7:26) at Test.Runnable.run (/usr/local/lib/node_modules/mocha/lib/runnable.js:211:32) at Runner.runTest (/usr/local/lib/node_modules/mocha/lib/runner.js:358:10) at /usr/local/lib/node_modules/mocha/lib/runner.js:404:12 at next (/usr/local/lib/node_modules/mocha/lib/runner.js:284:14) at /usr/local/lib/node_modules/mocha/lib/runner.js:293:7 at next (/usr/local/lib/node_modules/mocha/lib/runner.js:237:23) at Object._onImmediate (/usr/local/lib/node_modules/mocha/lib/runner.js:261:5) at processImmediate as _immediateCallback

2) passport-twitter should export Strategy constructor: TypeError: Object # has no method 'type' at Context. (/home/ritesh/projects/passport-topcoder/test/module.test.js:11:35) at Test.Runnable.run (/usr/local/lib/node_modules/mocha/lib/runnable.js:211:32) at Runner.runTest (/usr/local/lib/node_modules/mocha/lib/runner.js:358:10) at /usr/local/lib/node_modules/mocha/lib/runner.js:404:12 at next (/usr/local/lib/node_modules/mocha/lib/runner.js:284:14) at /usr/local/lib/node_modules/mocha/lib/runner.js:293:7 at next (/usr/local/lib/node_modules/mocha/lib/runner.js:237:23) at Object._onImmediate (/usr/local/lib/node_modules/mocha/lib/runner.js:261:5) at processImmediate as _immediateCallback but the type method is specified in documentation.how to get rid of this error.please help a bit.

instead of this when i try to run

aa

var strategy = require('..'); var should = require("should"); describe('passport-twitter', function() {

it('should export', function() { console.log('strategy is',strategy); 'xxxx'.should.have.type('function'); });

}); still i am getting the error

1) passport-twitter should export: TypeError: Object # has no method 'type' at Context. (/home/ritesh/projects/passport-topcoder/test/module.test.js:7:23) at Test.Runnable.run (/usr/local/lib/node_modules/mocha/lib/runnable.js:211:32) at Runner.runTest (/usr/local/lib/node_modules/mocha/lib/runner.js:358:10) at /usr/local/lib/node_modules/mocha/lib/runner.js:404:12 at next (/usr/local/lib/node_modules/mocha/lib/runner.js:284:14) at /usr/local/lib/node_modules/mocha/lib/runner.js:293:7 at next (/usr/local/lib/node_modules/mocha/lib/runner.js:237:23) at Object._onImmediate (/usr/local/lib/node_modules/mocha/lib/runner.js:261:5) at processImmediate as _immediateCallback

is this something wrong with shouldjs please confirm.need to complete my project up to tomorrow .i am using shouldjs 1.3.0

btd commented 11 years ago

1.3.0 do not have .type. You need 2.0.*