node.js - Cannot read property '_host' of null when running supertest in node-inspector -


i'm new angular world , have been using angular-fullstack generator + yeoman build out project. i'm using sublime (not webstorm) , have been trying figure out how set project can debug mocha tests terminal, hitting wall.

here's default things.spec.js that's generated 'yo angular-fullstack' debugger statement added in.

var should = require('should'); var app = require('../../app'); var request = require('supertest');  describe('get /api/things', function() {    it('should respond json array', function(done) {        request(app)           .get('/api/things')           .expect(200)           .expect('content-type', /json/)           .end(function(err, res) {               debugger;               if (err) return done(err);               res.body.should.be.instanceof(array);               done();           });    }); }); 

by combining advice grunt-mocha-test documentation , so answer, i've updated test script in package.json follows:

"scripts": {     "test": "node-debug <path grunt-cli>\\grunt test" } 

when run 'npm test', node-inspector boots browser instance , attaches debug session test process. however, when press "continue", debugger breakpoint not hit , test fails following stack. have clues what's causing this?

typeerror: cannot read property '_host' of null   @ clientrequest.http.clientrequest.onsocket (eval @ wrapped_by_node_inspector (\node_modules\node-inspector\node_modules\v8-debug\v8-debug.js:95:15), <anonymous>:381:28)   @ new clientrequest (http.js:1432:10)   @ object.exports.request (http.js:1843:10)   @ test.request.request (\node_modules\supertest\node_modules\superagent\lib\node\index.js:615:28)   @ test.request.end (\node_modules\supertest\node_modules\superagent\lib\node\index.js:677:18)   @ test.end (\node_modules\supertest\lib\test.js:123:7)   @ context.<anonymous> (\server\api\thing\thing.spec.js:14:8)   @ test.runnable.run (\node_modules\grunt-mocha-test\node_modules\mocha\lib\runnable.js:196:15)   @ runner.runtest (\node_modules\grunt-mocha-test\node_modules\mocha\lib\runner.js:374:10)   @ runner.runtests.next (\node_modules\grunt-mocha-test\node_modules\mocha\lib\runner.js:452:12) 

this looks bug in node inspector. https://github.com/node-inspector/node-inspector/issues/698


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -