使用Mocha + TypeScript + Docker远程debuggingnode.js。 debugging器不反映实际的执行?

我在WebStorm工作,如果这可能是问题(但似乎不太可能)。

我在docker容器上运行以下命令来启动集成testing,我想在IDE内远程debugging。

NODE_ENV=test TS_NODE_DISABLE_WARNINGS=1 ./node_modules/.bin/mocha --debug-brk --compilers ts:ts-node/register test/integration/**/*.spec.ts",

执行此操作后,节点进程等待端口8080上的debugging连接。

集成testing看起来像这样:

 import sinon = require('sinon'); import chai = require('chai'); import supertest = require('supertest'); import sinonChai = require('sinon-chai'); const expect = chai.use(sinonChai).expect; import {server} from '../../src/server'; import {authenticate} from '../../src/middleware'; const routeContent = 'whatever'; const authenticatedRoute = '/authenticatedRoute'; describe('The authenticate middleware', () => { before(() => { server.get('/authenticatedRoute', authenticate, (req, res) => { res.status(200); res.send(routeContent); }); supertest(server) .post('/woc/login/') .send({ email: 'foooood@dogs.com', password: 'Choopa' }); }); it('Should verify that a token exists when one is in redis', () => { supertest(server).get(authenticatedRoute) .expect(200); }); }); 

现在这是奇怪的

这些testing成功,当我console.log server的内容和authenticate ,它打印正确的值。 但是,在WebStorm的debuggingUI中,它告诉我有一个引用错误, serverauthenticate都没有定义。

它似乎没有在debugging器中处理ES6导入语句,即使它在处理过程中处理得很好。 它在闭包中不可见地构build了一个middleware_1模块,但是并没有在模块范围中插入authenticate

远程调试会话中的变量

我一直在挣扎着这么多天 – 任何帮助都如此赞赏!